From afa5481c5016b1ae45fa72648fd5df33375feb54 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Sat, 14 Feb 2015 11:11:30 -0300 Subject: [PATCH] qtdemux: do not use sparse streams in push-based seeking Using the sparse streams can make the push-based seeking return too far in the stream. It also can lead to issues as the sparse streams will be ignored when restarting playback and, if the sparse stream is the one that has the earliest sample, it will confuse qtdemux's offsets as one stream will have an earlier offset than the demuxer's one which might lead to early EOS. https://bugzilla.gnome.org/show_bug.cgi?id=742661 --- gst/isomp4/qtdemux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 4baf7b7b50..ccb6c4f612 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -1180,7 +1180,7 @@ gst_qtdemux_move_stream (GstQTDemux * qtdemux, QtDemuxStream * str, static void gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time, - gint64 * key_time, gint64 * key_offset) + gboolean use_sparse, gint64 * key_time, gint64 * key_offset) { guint64 min_offset; gint64 min_byte_offset = -1; @@ -1201,6 +1201,9 @@ gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time, str = qtdemux->streams[n]; + if (str->sparse && !use_sparse) + continue; + seg_idx = gst_qtdemux_find_segment (qtdemux, str, desired_time); GST_DEBUG_OBJECT (qtdemux, "align segment %d", seg_idx); @@ -1321,7 +1324,7 @@ gst_qtdemux_do_push_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event) /* find reasonable corresponding BYTE position, * also try to mind about keyframes, since we can not go back a bit for them * later on */ - gst_qtdemux_adjust_seek (qtdemux, cur, &key_cur, &byte_cur); + gst_qtdemux_adjust_seek (qtdemux, cur, FALSE, &key_cur, &byte_cur); if (byte_cur == -1) goto abort_seek; @@ -1406,7 +1409,7 @@ gst_qtdemux_perform_seek (GstQTDemux * qtdemux, GstSegment * segment, if ((segment->flags & GST_SEEK_FLAG_KEY_UNIT) && !qtdemux->fragmented) { gint64 min_offset; - gst_qtdemux_adjust_seek (qtdemux, desired_offset, &min_offset, NULL); + gst_qtdemux_adjust_seek (qtdemux, desired_offset, TRUE, &min_offset, NULL); GST_DEBUG_OBJECT (qtdemux, "keyframe seek, align to %" GST_TIME_FORMAT, GST_TIME_ARGS (min_offset)); desired_offset = min_offset;