From 9deb3c27acd4161f810cd782f03bcdaccf2643c7 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 9 Jul 2019 23:12:45 +0200 Subject: [PATCH] qtdemux: fix conditions for end of segment in reverse playback The time_position field of the stream is offset by the media_start of its QtDemuxSegment compared to the start of the GstSegment of the demuxer, take it into account when making comparisons. --- gst/isomp4/qtdemux.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 8e03d6a..f7994b8 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -6305,8 +6305,16 @@ gst_qtdemux_loop_state_movie (GstQTDemux * qtdemux) stream = QTDEMUX_NTH_STREAM (qtdemux, i); position = stream->time_position; + if (!GST_CLOCK_TIME_IS_VALID (position)) + continue; + + if (stream->segment_index != -1) { + QtDemuxSegment *segment = &stream->segments[stream->segment_index]; + position += segment->media_start; + } + /* position of -1 is EOS */ - if (position != GST_CLOCK_TIME_NONE && position < min_time) { + if (position < min_time) { min_time = position; target_stream = stream; } -- 2.7.4