qtdemux: Add MSE-style flush

The abort() method of SourceBuffer in Media Source Extensions is
expected to flush the demuxer and discard the current fragment,
if any. The configuration of tracks, if any, should be preserved.

qtdemux has different behavior for flush events depending on the
context.

This patch activates the intended behaviour only for streams of the
VARIANT_MSE_BYTESTREAM type, conformant to the ISO BMFF Bytestream
specification[1]. This flush behaviour is the same as the one
already in use for adaptivedemux sources.

[1] https://www.w3.org/TR/mse-byte-stream-format-isobmff/

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4101>
This commit is contained in:
Alicia Boya García 2023-03-02 18:05:08 +01:00 committed by GStreamer Marge Bot
parent c533010e20
commit c1f4bd5a3f

View file

@ -1985,7 +1985,8 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard)
GST_DEBUG_OBJECT (qtdemux, "Resetting demux");
if (hard || qtdemux->upstream_format_is_time) {
if (hard || qtdemux->upstream_format_is_time
|| qtdemux->variant == VARIANT_MSE_BYTESTREAM) {
qtdemux->state = QTDEMUX_STATE_INITIAL;
qtdemux->neededbytes = 16;
qtdemux->todrop = 0;
@ -2081,7 +2082,8 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard)
g_free (qtdemux->preferred_protection_system_id);
qtdemux->preferred_protection_system_id = NULL;
}
} else if (qtdemux->variant == VARIANT_MSS_FRAGMENTED) {
} else if (qtdemux->variant == VARIANT_MSS_FRAGMENTED
|| qtdemux->variant == VARIANT_MSE_BYTESTREAM) {
gst_flow_combiner_reset (qtdemux->flowcombiner);
g_ptr_array_foreach (qtdemux->active_streams,
(GFunc) gst_qtdemux_stream_clear, NULL);