qtdemux: Don't emit GstSegment correcting start time when in MSE mode
authorEnrique Ocaña González <eocanha@igalia.com>
Wed, 1 Feb 2023 11:09:52 +0000 (12:09 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 18 Feb 2023 10:38:30 +0000 (10:38 +0000)
commitbe4dc2d05fb9984e520d7949dfc5b6ecd458f197
tree5a046147705d120f0855a4d0a717007b9443b6bb
parentdd49b8a43ee0cd0c656adbcd93216cf5f77e4d02
qtdemux: Don't emit GstSegment correcting start time when in MSE mode

When using qtdemux in a pipeline that should only work as a pure demuxer (not
for actual playback), qtdemux shouldn't emit new GstSegments to correct
the start time (jump to the future) to ensure that the user experiences no
playback delay. By doing so, it's generating the wrong segments when an append
of data from the past happens. When that happens, downstream elements such as
parsers (eg: aacparse) may clip those buffers laying before the GstSegment and
create problems on the GStreamer client app (eg: WebKit).

Getting buffers clipped out because of the wrong GstSegments started becoming
a problen when this commit was introduced:

ab6e49e9cc audioparsers: add back segment clipping to parsers that have lost it

This clipping makes test DASH shaka 35 from MVT tests[1] to fail in
WebKitGTK/WPE (at least) and can potentially cause a number of other problems
in the WebKit Media Source Extensions (MSE) code.

Note that this new behaviour of not emitting new GstSegments only makes sense
when qtdemux is being used as a pure demuxer and not as part of a regular
pipeline. This is why the variant field has been added. When equal to
VARIANT_MSE_BYTESTREAM, it will make qtdemux behave differently in push mode,
taking decisions that meet the expectations for an MSE-like processing mode.
This kind of tweaks have been done in the past for MSS streams, for instance.
That code has been refactored to use VARIANT_MSS_FRAGMENTED now, instead of
its own dedicated boolean flag.

Co-authored by: Alicia Boya García <ntrrgc@gmail.com>

...who suggested to use "variant: mse-bytestream" in the caps to identify that
mode, as proposed in her unmerged patch:

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/467

[1] https://github.com/rdkcentral/mvt

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3990>
subprojects/gst-integration-testsuites/medias
subprojects/gst-integration-testsuites/testsuites/validate.testslist
subprojects/gst-integration-testsuites/testsuites/validate/mse/segment_future_past_mse/segment_future_past_mse.validatetest [new file with mode: 0644]
subprojects/gst-integration-testsuites/testsuites/validate/mse/segment_future_past_mse/segment_future_past_mse/flow-expectations/log-fakesink0-sink-expected [new file with mode: 0644]
subprojects/gst-integration-testsuites/testsuites/validate/mse/segment_future_past_mse_edit_lists/segment_future_past_mse_edit_lists.validatetest [new file with mode: 0644]
subprojects/gst-integration-testsuites/testsuites/validate/mse/segment_future_past_mse_edit_lists/segment_future_past_mse_edit_lists/flow-expectations/log-fakesink0-sink-expected [new file with mode: 0644]
subprojects/gst-integration-testsuites/testsuites/validate/mse/segment_future_past_nomse/segment_future_past_nomse.validatetest [new file with mode: 0644]
subprojects/gst-integration-testsuites/testsuites/validate/mse/segment_future_past_nomse/segment_future_past_nomse/flow-expectations/log-fakesink0-sink-expected [new file with mode: 0644]
subprojects/gst-plugins-good/gst/isomp4/qtdemux.c
subprojects/gst-plugins-good/gst/isomp4/qtdemux.h