matroska-demux: Properly handle early time-based segments
authorEdward Hervey <edward@centricular.com>
Wed, 21 Jun 2023 15:05:47 +0000 (17:05 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 23 Jun 2023 06:55:47 +0000 (08:55 +0200)
Refusing an incoming segment in < GST_MATROSKA_READ_STATE_DATA should only be
done if the incoming segment is not in GST_FORMAT_TIME.

In GST_FORMAT_TIME, we are just storing the values and returning, so we can
invert the order of the checks.

Fixes proper segment propagation in matroska/webm DASH use-cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4922>

subprojects/gst-integration-testsuites/testsuites/validate/dash/seek_with_stop_between_fragments/flow-expectations/log-i-sink-expected
subprojects/gst-plugins-good/gst/matroska/matroska-demux.c

index b290b85..54fc456 100644 (file)
@@ -1,6 +1,6 @@
 event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1, stream=(GstStream)"\(GstStream\)\ video-0";
 event caps: video/x-raw, colorimetry=(string)2:4:0:0, format=(string)I420, framerate=(fraction)0/1, height=(int)446, interlace-mode=(string)progressive, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)928;
-event segment: format=TIME, start=0:00:00.014000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000
+event segment: format=TIME, start=0:00:00.000000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000
 event stream-collection: stream-collection, collection=(GstStreamCollection)"\(GstStreamCollection\)\ streamcollection0";
 buffer: content-id=0, pts=0:00:00.014000000, flags=discont, meta=GstVideoMeta
 event flush-start: (no structure)
index 1e771b0..2cb7acf 100644 (file)
@@ -6231,11 +6231,6 @@ gst_matroska_demux_handle_sink_event (GstPad * pad, GstObject * parent,
           "received format %d segment %" GST_SEGMENT_FORMAT, segment->format,
           segment);
 
-      if (demux->common.state < GST_MATROSKA_READ_STATE_DATA) {
-        GST_DEBUG_OBJECT (demux, "still starting");
-        goto exit;
-      }
-
       if (segment->format == GST_FORMAT_TIME) {
         demux->upstream_format_is_time = TRUE;
         demux->segment_seqnum = gst_event_get_seqnum (event);
@@ -6245,6 +6240,11 @@ gst_matroska_demux_handle_sink_event (GstPad * pad, GstObject * parent,
         goto exit;
       }
 
+      if (demux->common.state < GST_MATROSKA_READ_STATE_DATA) {
+        GST_DEBUG_OBJECT (demux, "still starting");
+        goto exit;
+      }
+
       demux->upstream_format_is_time = FALSE;
 
       /* we only expect a BYTE segment, e.g. following a seek */