adaptivedemux2: Rework input download wakeups
authorJan Schmidt <jan@centricular.com>
Thu, 15 Sep 2022 16:01:58 +0000 (02:01 +1000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 20 Sep 2022 19:48:17 +0000 (19:48 +0000)
commita03f3df626ed965a102c2db0ea64a579471980d0
treefdc8c2bbbd667ee3e5241bafbff7a033ada86355
parentf9371ccc38dc7953e0fb8591817c108f6fa3caa8
adaptivedemux2: Rework input download wakeups

Change the way streams are woken up to download more data.

Instead of checking the level on tracks that are being
output as data is dequeued, calculate a 'wakeup time'
at which it should download more data, and wake up
the stream when the global output position crosses
that threshold.

For efficiency, compute the earliest wakeup time
for all streams and store it on the period, so the
output loop can quickly check only a single value
to decide if something needs waking up.

Does the same buffering as the previous method,
but ensures that as we approach the end of
one period, the next period continues incrementally
downloading data so that it is fully buffered when
the period starts.

Fixes issues with multi-period VOD content where
download of the second period resumes only after
the first period is completely drained.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3055>
subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-period.c
subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-private.h
subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c
subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-track.c
subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c
subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.h