rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | From 3ddda676fd4947353840510094cfc5e8326c53da Mon Sep 17 00:00:00 2001 |
| 2 | From: Xiaolei Gao <xiaolei.gao@mediatek.com> |
| 3 | Date: Wed, 28 Dec 2016 15:11:22 +0800 |
| 4 | Subject: [PATCH] qtdemux: resolve special 3gp file not play issue |
| 5 | |
| 6 | resolve special 3gp file can't play issue |
| 7 | Test: |
| 8 | |
| 9 | Signed-off-by: Xiaolei Gao <xiaolei.gao@mediatek.com> |
| 10 | CR-Id: AUTO00001811 |
| 11 | --- |
| 12 | gst/isomp4/qtdemux.c | 18 ++++++++++++++++++ |
| 13 | 1 file changed, 18 insertions(+) |
| 14 | |
| 15 | diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c |
| 16 | index cc40893..4a767b9 100644 |
| 17 | --- a/gst/isomp4/qtdemux.c |
| 18 | +++ b/gst/isomp4/qtdemux.c |
| 19 | @@ -200,6 +200,9 @@ struct _QtDemuxSegment |
| 20 | GstClockTime time; |
| 21 | GstClockTime stop_time; |
| 22 | GstClockTime duration; |
| 23 | + GstClockTime pre_media_stop; |
| 24 | + GstClockTime pre_stop_time; |
| 25 | + GstClockTime pre_duration; |
| 26 | /* media time of trak, all gst time */ |
| 27 | GstClockTime media_start; |
| 28 | GstClockTime media_stop; |
| 29 | @@ -2636,6 +2639,9 @@ check_update_duration (GstQTDemux * qtdemux, GstClockTime duration) |
| 30 | stream->duration = movdur; |
| 31 | if (stream->dummy_segment) { |
| 32 | /* Update all dummy values to new duration */ |
| 33 | + stream->segments[0].pre_stop_time = stream->segments[0].stop_time; |
| 34 | + stream->segments[0].pre_duration = stream->segments[0].duration; |
| 35 | + stream->segments[0].pre_media_stop = stream->segments[0].media_stop; |
| 36 | stream->segments[0].stop_time = duration; |
| 37 | stream->segments[0].duration = duration; |
| 38 | stream->segments[0].media_stop = duration; |
| 39 | @@ -4348,6 +4354,14 @@ gst_qtdemux_prepare_current_sample (GstQTDemux * qtdemux, |
| 40 | /* different segment, activate it, sample_index will be set. */ |
| 41 | if (G_UNLIKELY (stream->segment_index != seg_idx)) |
| 42 | gst_qtdemux_activate_segment (qtdemux, stream, seg_idx, time_position); |
| 43 | + else if (stream->dummy_segment == TRUE) { |
| 44 | + if ((stream->segments[0].time > time_position) || (time_position >= stream->segments[0].pre_stop_time)) { |
| 45 | + gst_qtdemux_activate_segment (qtdemux, stream, 0, stream->segments[0].time); |
| 46 | + stream->segments[0].pre_stop_time = stream->segments[0].stop_time; |
| 47 | + stream->segments[0].pre_duration = stream->segments[0].duration; |
| 48 | + stream->segments[0].pre_media_stop = stream->segments[0].media_stop; |
| 49 | + } |
| 50 | + } |
| 51 | |
| 52 | if (G_UNLIKELY (QTSEGMENT_IS_EMPTY (&stream->segments[stream-> |
| 53 | segment_index]))) { |
| 54 | @@ -7977,6 +7991,10 @@ done: |
| 55 | stream->segments[0].rate = 1.0; |
| 56 | stream->segments[0].trak_media_start = 0; |
| 57 | |
| 58 | + stream->segments[0].pre_stop_time = GST_CLOCK_TIME_NONE; |
| 59 | + stream->segments[0].pre_duration = GST_CLOCK_TIME_NONE; |
| 60 | + stream->segments[0].pre_media_stop = GST_CLOCK_TIME_NONE; |
| 61 | + |
| 62 | GST_DEBUG_OBJECT (qtdemux, "created dummy segment %" GST_TIME_FORMAT, |
| 63 | GST_TIME_ARGS (stream_duration)); |
| 64 | stream->n_segments = 1; |
| 65 | -- |
| 66 | 1.9.1 |
| 67 | |