From c1f4bd5a3f97caf3fbbee29dc491e6ccd24b2b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Thu, 2 Mar 2023 18:05:08 +0100 Subject: [PATCH] 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: --- subprojects/gst-plugins-good/gst/isomp4/qtdemux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index c13addee22..19e3b0427b 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -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);