gstreamer/subprojects
Alicia Boya García 0f8785cbc6 basesink: Support position queries after non-resetting flushes
A flush is resetting or not depending on the reset_time argument in the
FLUSH_STOP event is set.

Resetting flushes reset the running time to zero and clear any existing
segment. These are the kind of flushes used by flushing seeks, and by far the
most common. Non-resetting flushes are much more niche, used for instance for
quality changes in adaptivedemux2 and MediaSource Extensions in WebKit.

A key difference between the seek use case and the quality change use case is
that the latter is much more removed from the player. Seeks generally occur
because an user request it, whereas quality changes can be automatic.

Currently, there are three notable cases where position queries fail:

(a) before pre-roll, as there is no segment yet. This is one is understandable,
as for at least some time before pre-roll, we cannot know if a media stream
would start at 0 or any other position, or the duration of the stream for that
matter.

(b) after a resetting flush caused by a seek. This kind of flush resets the
segment, so it's not surprising position queries fail. This is inconvenient for
applications, as it means they always need to handle position reporting (e.g.
in UI) separately every time they request a seek, e.g. by caching the seek
target and using it when the position query fail. I'm not fond of this
behavior, as it's unintuitive and makes GStreamer harder to use, but at this
point could be difficult to change and it's not within the scope of this
proposal.

(c) after a non-resetting flush, e.g. caused by a quality change. The segment
is not reset in this case. Position queries work until a FLUSH_STOP is sent.
Querying position after a FLUSH_START but before a FLUSH_STOP works, and
returns the position the sink was at the moment the FLUSH_START was received.
**This in fact the only reliable way (short of adding probes to the sink
element) to get this position**, as FLUSH_START receival is asynchronous with
playback.

In the case (c), as of currently, position queries fail once the FLUSH_STOP is
received. But unlike in (b), the application has no position to fall back to,
as the FLUSH_START was initiated by elements inside the pipeline that are in a
lower layer of abstraction. Specific applications that have control of both the
player and the internal element doing the flushing -- such as WebKit -- can
still work around this problem through layer violations (lucky!), but this
still puts in question this behavior in GStreamer.

This patch fixes this case by amending the position query handler of basesink,
which was previously erroneously returning early with "wrong state", even
though the flush occurs in PAUSED or PLAYING.

A unit test checking this behavior has also been added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3471>
2023-03-03 10:16:25 +00:00
..
gst-devtools validate: Protect init function with a recursive mutex 2023-03-02 02:50:45 +00:00
gst-docs docs: iOS tutorials: update for pending ivorbisdec plugin removal 2023-02-27 17:24:16 +00:00
gst-editing-services meson: Cleanup and avoid installing python bindings if python is not found 2023-02-16 19:43:12 +00:00
gst-examples examples: iOS: GstPlay: update for pending ivorbisdec plugin removal 2023-02-27 17:40:43 +00:00
gst-integration-testsuites tests: Move srtp test known issue def to the 'check' testuite 2023-02-16 02:39:05 +00:00
gst-libav ffmpeg: avauddec/avviddec: Free packet side data after usage 2023-02-28 12:01:57 +00:00
gst-omx gst-omx: drop use of GSlice allocator 2023-02-03 17:48:10 +00:00
gst-plugins-bad cccombiner: fix s334-1a in place conversion 2023-03-02 22:52:39 +00:00
gst-plugins-base alsasink: Fix stall when going from PLAYING to NULL (stucked at PAUSED) with uac1 gadget 2023-03-02 03:41:25 +00:00
gst-plugins-good qtdemux: Add MSE-style flush 2023-03-02 17:54:41 +00:00
gst-plugins-ugly mpeg2dec: drop use of GSlice 2023-01-24 15:25:06 +00:00
gst-python python: Use arch-specific install dir 2023-03-01 12:40:07 +00:00
gst-rtsp-server rtsp-server: test-launch: added the argument mount/m to specify the mountpoint 2023-02-12 09:21:19 +01:00
gstreamer basesink: Support position queries after non-resetting flushes 2023-03-03 10:16:25 +00:00
gstreamer-sharp Back to development 2023-01-23 23:04:53 +00:00
gstreamer-vaapi vaapi: Fix some code defects 2023-02-27 11:38:18 +00:00
macos-bison-binary macos-bison-binary: Remove warning when running on arm64 2022-12-16 23:58:07 +00:00
packagefiles/pango-1.50.12 meson: Add a patch that fixes pangocairo usage in gst-plugins-rs 2022-12-17 07:37:03 +05:30
win-flex-bison-binaries meson: Use run_command check: true for windows binary subprojects 2022-10-19 04:05:05 +00:00
win-nasm meson: Use run_command check: true for windows binary subprojects 2022-10-19 04:05:05 +00:00
avtp.wrap subprojects/avtp: Update to latest avtp 0.2.0 2022-03-18 22:49:16 +00:00
bindinator.wrap
cairo.wrap subprojects: cairo: bump to 1.17.6 2022-09-17 22:41:40 +00:00
dav1d.wrap meson: Switch dav1d wrap to a tarball 2023-02-24 15:28:29 +02:00
dssim.wrap
dv.wrap
expat.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
fdk-aac.wrap
FFmpeg.wrap
fontconfig.wrap subprojects: fontconfig: bump to 2.14.0 2022-09-17 22:41:40 +00:00
freetype2.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
fribidi.wrap subprojects: fribidi: bump to 1.0.12 2022-09-17 22:41:40 +00:00
gl-headers.wrap
glib-networking.wrap subprojects: update glib-networking to 2.74.0 and switch to file wrap 2022-11-18 00:51:48 +00:00
glib.wrap subprojects: update glib to 2.74.1 2022-11-18 00:50:56 +00:00
graphene.wrap
gst-plugins-rs.wrap gst-plugins-rs: Track main branch again 2023-01-24 19:08:50 +00:00
gtk-sharp.wrap
gtk.wrap meson: Use gtk tarball for the subproject wrap 2023-02-01 06:29:11 +00:00
harfbuzz.wrap subprojects: harfbuzz: bump to 5.2.0 2022-09-17 22:41:40 +00:00
json-glib.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
lame.wrap meson: Update lame to -7 which contains the def file fix 2022-12-19 01:43:08 +05:30
libdrm.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
libffi.wrap subprojects: libffi: pin to meson-3.2.9999.4 tag 2022-12-31 13:49:17 +00:00
libjpeg-turbo.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
libmicrodns.wrap subprojects: libmicrodns: bump to 0.2.0 + meson fixes 2022-09-17 22:41:40 +00:00
libnice.wrap webrtc: Change requirement to libnice 0.1.20 2023-01-07 16:03:23 +00:00
libopenjp2.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
libpng.wrap
libpsl.wrap
libsoup.wrap subprojects: switch libsoup to a file wrap 2022-11-18 00:56:25 +00:00
libsrtp2.wrap subprojects: Update libsrtp2 wrap to v2.5.0 2023-02-01 10:34:35 +00:00
libwpe.wrap
libxml2.wrap libxml2.wrap: update to latest version 2023-01-25 11:38:52 +00:00
ogg.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
openh264.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
opus.wrap
orc.wrap subprojects: orc: bump to 0.4.33 2022-10-31 23:50:28 +00:00
pango.wrap meson: Add a patch that fixes pangocairo usage in gst-plugins-rs 2022-12-17 07:37:03 +05:30
pixman.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
proxy-libintl.wrap Update proxy-libintl wrap to 0.4 2022-04-22 15:36:40 +00:00
pycairo.wrap
pygobject.wrap meson: Allow sysdeps to be forced as fallback subprojects 2023-02-06 09:26:02 +00:00
sqlite3.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
vorbis.wrap meson: Update some wraps, remove unused wraps 2022-07-16 06:16:17 +00:00
webrtc-audio-processing.wrap
wpebackend-fdo.wrap
x264.wrap
zlib.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00