summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEunhae Choi <eunhae1.choi@samsung.com>2016-08-29 01:46:55 -0700
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2016-08-29 01:46:55 -0700
commit2f10eae46496920b448b543d6ac76e5e985450c8 (patch)
tree9ca6c6abda690f7bc6c9e6861e9915127f59b4d0
parent0f2b709b577659cde8be952b0e86d511c02cd0f2 (diff)
parent4c0748f9f492782c7be35699bec1745d4e7293fc (diff)
downloadlibmm-player-accepted/tizen/common/20160831.162145.tar.gz
libmm-player-accepted/tizen/common/20160831.162145.tar.bz2
libmm-player-accepted/tizen/common/20160831.162145.zip
-rw-r--r--src/mm_player_es.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mm_player_es.c b/src/mm_player_es.c
index 5033f13..c90924c 100644
--- a/src/mm_player_es.c
+++ b/src/mm_player_es.c
@@ -33,11 +33,14 @@
#include <gst/app/gstappsrc.h>
/*---------------------------------------------------------------------------
-| LOCAL VARIABLE DEFINITIONS for internal |
+| LOCAL VARIABLE DEFINITIONS for internal |
---------------------------------------------------------------------------*/
+#define DEFAULT_FRAMERATE_NUM 30
+#define DEFAULT_FRAMERATE_DEN 1
+#define DEFAULT_VIDEO_FRAME_DURATION 33 /* ms */
/*---------------------------------------------------------------------------
-| LOCAL FUNCTION PROTOTYPES: |
+| LOCAL FUNCTION PROTOTYPES: |
---------------------------------------------------------------------------*/
static int __parse_media_format(MMPlayerVideoStreamInfo * video, MMPlayerAudioStreamInfo * audio, media_format_h format);
static int __convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo * video, media_format_mimetype_e mime);
@@ -115,8 +118,6 @@ __parse_media_format(MMPlayerVideoStreamInfo * video,
}
if (video) {
-#define DEFAULT_FRAMERATE_NUM 30
-#define DEFAULT_FRAMERATE_DEN 1
media_format_mimetype_e mime;
int width = 0;
int height = 0;
@@ -478,6 +479,7 @@ _mmplayer_submit_packet(MMHandleType hplayer, media_packet_h packet)
if (buf != NULL && size > 0) {
GstMapInfo buff_info = GST_MAP_INFO_INIT;
uint64_t pts = 0;
+ uint64_t duration = 0;
/* get size */
_buffer = gst_buffer_new_and_alloc(size);
@@ -506,13 +508,25 @@ _mmplayer_submit_packet(MMHandleType hplayer, media_packet_h packet)
}
media_format_unref(fmt);
}
+
+ /* get duration */
+ if (media_packet_get_duration(packet, &duration) != MEDIA_PACKET_ERROR_NONE) {
+ LOGW("failed to get duration info");
+ /* keep push without error handling */
+ }
+
+ if (duration == 0) {
+ duration = DEFAULT_VIDEO_FRAME_DURATION * GST_MSECOND;
+ }
+
+ GST_BUFFER_DURATION(_buffer) = (GstClockTime)duration;
}
/* get pts */
if (media_packet_get_pts(packet, &pts) != MEDIA_PACKET_ERROR_NONE) {
- LOGE("failed to get pts info");
- ret = MM_ERROR_PLAYER_INTERNAL;
- goto ERROR;
+ LOGE("failed to get pts info");
+ ret = MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
GST_BUFFER_PTS(_buffer) = (GstClockTime)pts;
gst_app_src_push_buffer(GST_APP_SRC(element), _buffer);