From ca06b57d304a5d35b93de2ae40ab95c3f9b77050 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Wed, 12 Aug 2015 19:47:39 +0900 Subject: [PATCH] If decoded buffer timestamp is less than start position, will be dropped buffer Change-Id: I17fe595bd1fb6029b2fc0146cb805066c2c279b9 Signed-off-by: Gilbok Lee --- packaging/libmm-transcode.spec | 2 +- transcode/mm_transcode_seek.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packaging/libmm-transcode.spec b/packaging/libmm-transcode.spec index 303857f..e8dd8f8 100644 --- a/packaging/libmm-transcode.spec +++ b/packaging/libmm-transcode.spec @@ -1,7 +1,7 @@ Name: libmm-transcode Summary: Multimedia Framework Video Transcode Library Version: 0.9 -Release: 7 +Release: 8 Group: System/Libraries License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/transcode/mm_transcode_seek.c b/transcode/mm_transcode_seek.c index 302be8d..1289529 100755 --- a/transcode/mm_transcode_seek.c +++ b/transcode/mm_transcode_seek.c @@ -60,7 +60,15 @@ _mm_cb_audio_output_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer us if (handle->param->seeking) { /* Shifting the decoded out buffer time as the start time */ - GST_BUFFER_PTS (GST_PAD_PROBE_INFO_BUFFER(info)) -= start_pos_ts; + if (GST_BUFFER_PTS (GST_PAD_PROBE_INFO_BUFFER(info)) >= start_pos_ts) { + GST_BUFFER_PTS (GST_PAD_PROBE_INFO_BUFFER(info)) -= start_pos_ts; + } else { + /* If input buffer time is less than start position, + * input buffer will be dropped. + */ + return GST_PAD_PROBE_DROP; + } + } } return GST_PAD_PROBE_OK; @@ -95,7 +103,15 @@ _mm_cb_video_output_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer us if(handle->param->seeking) { /* Shifting the decoded out buffer time as the start time */ - GST_BUFFER_PTS (GST_PAD_PROBE_INFO_BUFFER(info)) -= start_pos_ts; + if (GST_BUFFER_PTS (GST_PAD_PROBE_INFO_BUFFER(info)) >= start_pos_ts) { + GST_BUFFER_PTS (GST_PAD_PROBE_INFO_BUFFER(info)) -= start_pos_ts; + } else { + /* If input buffer time is less than start position, + * input buffer will be dropped. + */ + return GST_PAD_PROBE_DROP; + } + } } return GST_PAD_PROBE_OK; -- 2.7.4