qtdemux: Forward segments directly if we are operating in PUSH mode on fragmented...
authorSebastian Dröge <sebastian@centricular.com>
Wed, 1 Jun 2016 17:28:39 +0000 (20:28 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 7 Jun 2016 13:19:39 +0000 (16:19 +0300)
We shouldn't go through segment activation as we will only have a limited
understanding of how the whole stream timeline looks like from the moof. We
only know about the current fragment, while upstream knows about the whole
stream.

This fixes seeking in DASH streams, both for seeks after the current moof and
for seeks into the current moof. The former would fail because the moof ends
and we can't activate any segment, the latter would cause a segment that stops
at the moof end, and no further fragments would be played because we end up
being EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=767071

gst/isomp4/qtdemux.c

index 477694f..d7337a5 100644 (file)
@@ -2164,8 +2164,16 @@ gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstObject * parent,
 
       /* map segment to internal qt segments and push on each stream */
       if (demux->n_streams) {
-        gst_event_replace (&demux->pending_newsegment, NULL);
-        gst_qtdemux_map_and_push_segments (demux, &segment);
+        if (demux->fragmented) {
+          GstEvent *segment_event = gst_event_new_segment (&segment);
+
+          gst_event_replace (&demux->pending_newsegment, NULL);
+          gst_event_set_seqnum (segment_event, demux->segment_seqnum);
+          gst_qtdemux_push_event (demux, segment_event);
+        } else {
+          gst_event_replace (&demux->pending_newsegment, NULL);
+          gst_qtdemux_map_and_push_segments (demux, &segment);
+        }
       }
 
       /* clear leftover in current segment, if any */