#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);
}
if (video) {
-#define DEFAULT_FRAMERATE_NUM 30
-#define DEFAULT_FRAMERATE_DEN 1
media_format_mimetype_e mime;
int width = 0;
int height = 0;
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);
}
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);