blob: bb07bc0247b494fbe29d71404a177676f1666558 [file] [log] [blame]
From 3ddda676fd4947353840510094cfc5e8326c53da Mon Sep 17 00:00:00 2001
From: Xiaolei Gao <xiaolei.gao@mediatek.com>
Date: Wed, 28 Dec 2016 15:11:22 +0800
Subject: [PATCH] qtdemux: resolve special 3gp file not play issue
resolve special 3gp file can't play issue
Test:
Signed-off-by: Xiaolei Gao <xiaolei.gao@mediatek.com>
CR-Id: AUTO00001811
---
gst/isomp4/qtdemux.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index cc40893..4a767b9 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -200,6 +200,9 @@ struct _QtDemuxSegment
GstClockTime time;
GstClockTime stop_time;
GstClockTime duration;
+ GstClockTime pre_media_stop;
+ GstClockTime pre_stop_time;
+ GstClockTime pre_duration;
/* media time of trak, all gst time */
GstClockTime media_start;
GstClockTime media_stop;
@@ -2636,6 +2639,9 @@ check_update_duration (GstQTDemux * qtdemux, GstClockTime duration)
stream->duration = movdur;
if (stream->dummy_segment) {
/* Update all dummy values to new duration */
+ stream->segments[0].pre_stop_time = stream->segments[0].stop_time;
+ stream->segments[0].pre_duration = stream->segments[0].duration;
+ stream->segments[0].pre_media_stop = stream->segments[0].media_stop;
stream->segments[0].stop_time = duration;
stream->segments[0].duration = duration;
stream->segments[0].media_stop = duration;
@@ -4348,6 +4354,14 @@ gst_qtdemux_prepare_current_sample (GstQTDemux * qtdemux,
/* different segment, activate it, sample_index will be set. */
if (G_UNLIKELY (stream->segment_index != seg_idx))
gst_qtdemux_activate_segment (qtdemux, stream, seg_idx, time_position);
+ else if (stream->dummy_segment == TRUE) {
+ if ((stream->segments[0].time > time_position) || (time_position >= stream->segments[0].pre_stop_time)) {
+ gst_qtdemux_activate_segment (qtdemux, stream, 0, stream->segments[0].time);
+ stream->segments[0].pre_stop_time = stream->segments[0].stop_time;
+ stream->segments[0].pre_duration = stream->segments[0].duration;
+ stream->segments[0].pre_media_stop = stream->segments[0].media_stop;
+ }
+ }
if (G_UNLIKELY (QTSEGMENT_IS_EMPTY (&stream->segments[stream->
segment_index]))) {
@@ -7977,6 +7991,10 @@ done:
stream->segments[0].rate = 1.0;
stream->segments[0].trak_media_start = 0;
+ stream->segments[0].pre_stop_time = GST_CLOCK_TIME_NONE;
+ stream->segments[0].pre_duration = GST_CLOCK_TIME_NONE;
+ stream->segments[0].pre_media_stop = GST_CLOCK_TIME_NONE;
+
GST_DEBUG_OBJECT (qtdemux, "created dummy segment %" GST_TIME_FORMAT,
GST_TIME_ARGS (stream_duration));
stream->n_segments = 1;
--
1.9.1