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.
This commit is contained in:
Mathieu Duponchelle 2019-07-09 23:12:45 +02:00 committed by Mathieu Duponchelle
parent 67b8ce3167
commit 9deb3c27ac

View file

@ -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;
}