matroska-demux: Properly handle early time-based segments

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>
This commit is contained in:
Edward Hervey 2023-06-21 17:05:47 +02:00 committed by Edward Hervey
parent 8e4bfd896b
commit bf0446ad73
2 changed files with 6 additions and 6 deletions

View 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)

View 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 */