Jan Schmidt
703d29549a
hlsdemux2: Add gst_hls_media_playlist_sync_skipped_segments()
...
Add a method that transfers over skipped segments from a reference playlist,
used to repopulate a delta playlist
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
7496d2750e
hlsdemux2: Parse EXT-X-SKIP tag
...
Parse the attributes from the EXT-X-SKIP tag
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
8a0190b521
hlsdemux2: Use skip and blocking playlist delivery directives
...
Detect when we can use a blocking request and delta playlist update requests and
add the required delivery directives to the request URI.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
c16366e5f3
hlsdemux2: Add gst_hls_media_playlist_get_next_msn_and_part()
...
Add a function that computes the media sequence number and/or part index that
are immediately after the end of the playlist, for use in blocking playlist
requests
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
d41def562c
hlsdemux2: Use stream llhls_enabled flag
...
Use the stream's copy of the llhls_enabled flag when deciding whether to do
preload requests - the value that was cached when the stream started
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
42b0dd8c41
hlsdemux2: Split the stream object out
...
Move the stream object to a separate file to split the demux level behaviour
from the stream behaviour better.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
5baf5f4b1e
hlsdemux2: Add a timestamp to the playlist
...
Store the timestamp for this playlist. If valid it represents the monotonic time
at which the data was retrieved, minus any proxy cache Age field.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
a3770523c0
adaptivedemux2/downloadrequest: add a helper to retrieve the Age header
...
Add a method to look at HTTP response headers and parse and return any Age
header, provided by caching proxy servers if the data was provided from a cache.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
90bedcb2bc
hlsdemux2: Fix missed segment match for partial-only segment
...
Fix a case where the matching code might not select the final partial-only
segment because it has too short a duration (while it's still being created)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
9edb2f6690
hlsdemux2: In live, match buffering to the hold back distance
...
When playing a live stream, make the recommended buffering threshold at most the
hold-back distance from live. If we start 3 seconds from the live edge, there's
no point trying to buffer more - we'll just hit the live edge and have to wait
for more data to be available anyway.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
1e6550f623
hlsdemux2: Resync stream time on partial segment boundaries
...
When resyncing stream times in a playlist, support at any partial segment
position, not just at full segment boundaries.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
bdec75f9dc
hlsdemux2: Calculate / transfer timing info for preloads
...
When fulfilling data requests, transfer timing information so the stream can
calculate data bitrates.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
5192181ef5
adaptivedemux2: Add most recent data time and offset helper
...
Add a field to the DownloadRequest that reports the most recent time at which
data arrived. Update it in the DownloadHelper.
Add a method to retrieve the GST_BUFFER_OFFSET() for the DownloadRequest's data
buffer (if any).
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
40938c8853
adaptivedemux2: Handle another case in download_request_take_buffer_range
...
Handle the case where we want to get a range from the available data that
doesn't start at the first available byte (and discard the bytes before that
start offset).
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
cbb9cfe987
hlsdemux2: Cancel preload before fetching something else
...
When submitting a request for fragment or header that doesn't match any preload,
make sure there's not an ongoing preload for that data type, to avoid parallel
downloads using up bandwidth.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
70bfeff35d
hlsdemux2: Fix assertion on shutdown
...
After cancelling a DownloadRequest, the download helper may not do so
immediately, so we can't assert on the in_use flag. Also, since there's no
refcount on the preload hint struct in the download request callback data, make
sure no callbacks will be dispatched when we're going to free the preload hint
struct.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
44107d0c4b
hlsdemux2: Implement the stream submit_request() vfunc
...
Implement the submit_request() vfunc for streams and fulfil requests from the
preload hint data if possible.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
a7e5236a39
hlsdemux2/preloader: Implement basic request handling
...
Implement fulfilment of HTTP requests from the active preload downloads by
finding any preload request that can provide the requested data and feeding
bytes from the internal DownloadRequest to the caller provided target
DownloadRequest.
Doesn't yet calculate timestamps to make the target request have a sensible
apparent bitrate.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
940811d593
adaptivedemux2/downloadrequest: Add new methods
...
Add download_request_take_buffer_range() and
download_request_get_bytes_available() methods.
download_request_take_buffer_range() takes bytes from the front of the request
that satisfy the requested start/end byterange, and puts any remaining bytes
back into the DownloadRequest
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
76565e8979
adaptivdemux2: Improve a comment about unlocking download requests.
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
a14f4f7054
adaptivedemux2: Make download mechanism overrideable
...
Make the mechanism by which DownloadRequests are fulfilled overrideable by the
subclass, in case it has an internal mechanism it can use (such as blocking
preloads in HLS)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
cb27c05ca7
hlsdemux2: Add preloader helper.
...
Add a helper that submits and handles blocking preload requests for future
PART/MAP data from live playlists. Add handling in the hlsdemux stream to submit
preload requests when hitting the end of the available segments in a live
playlist.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
5ca336226e
hlsdemux2: Add preload equality helper
...
Add a helper function that compares two preload hints for equality based on URI
and requested byte range.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
30bc72d6c7
adaptivedemux2: Define RFC8673_LAST_BYTE_POS
...
Define the recommended value from RFC8673 for the last byte of an open-ended
range request intended to invoke chunked blocking downloads of an incrementally
created resource.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
61516eadf6
hlsdemux2: Ignore partial segments when not live
...
Add some checks that LL-HLS support is enabled and that the current playlist is
live before proceeding to play any partial segments.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
401ca3ef44
hlsdemux2: Print playlist age in debug output
...
Store the timestamp when playlists are updated, and add some debug output to the
update_fragment_info that estimates how far from the live edge the fragment
currently is
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
43e042c4b7
hlsdemux2: Implement LL-HLS flag and part-hold-back/hold-back in live.
...
Add a flag to hlsdemux to enable or disable LL-HLS handling.
When LL-HLS is enabled and an LL-HLS playlist is loaded, use the part-hold-back
threshold to choose a starting segment.
For live streams that aren't LL-HLS, use the provided hold-back attribute, or
fall back to landing 3 segments from the end.
Make the gst_hls_media_playlist_seek() method able to choose a partial segment
within 2 target durations of the end of the playlist when requested.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
9848c1a1a1
m3u8demux2: Fix off-by-one and leak.
...
Fix an off-by-one in gst_hls_media_playlist_sync_to_playlist() that would ignore
the first fragment in the reference playlist. The error was harmless, since we
expect the reference playlist to be older than the playlist we're
synchronising (so the first/oldest segment in the reference playlist will likely
not exist in the new playlist), so this is just for correctness.
Also fix a segment leak in gst_hls_media_playlist_advance_fragment() when
ignoring the partial_only segment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
676fffd23c
hlsdemux2: Fix segment advance on partial segments.
...
Fix the duration passed to gst_adaptive_demux2_stream_advance_fragment() when
advancing from a partial segment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
e318bc3df5
hlsdemux2: Improve some debug output
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
3537614c2b
hlsdemux2: Add and use gst_hls_media_playlist_find_position()
...
Add a function for synchronising current position with the contents of a
playlist that is specifically for that and can handle synchronising to a partial
segment.
gst_hls_media_playlist_seek() will be used only when performing external seek
requests, to find the best segment or partial segment at which to resume
playback.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
c25814bac0
hlsdemux2: Add debug in find_segment_in_playlist()
...
In m3u8 segment matching, print the PDT that was matched between playlists.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
857541ae07
hlsdemux2: Fix some m3u8 segment leaks
...
Make sure unref m3u8 segments in some missed paths.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
7b9547a119
hlsdemux2: Allow starting at the partial_only segment
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
1b8af98208
hlsdemux2: Recalculate partial segments in anchor segment
...
When recalculating the partial segment stream times in
gst_hls_media_playlist_recalculate_stream_time(), don't miss the anchor segment
itself.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
e1a6ec22ee
hlsdemux2: Dump init uri details for segments.
...
When dumping an m3u8 playlist to debug, include information about any
initialisation data.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
2c82fdf276
hlsdemux2: Use gst_hls_media_playlist_recalculate_stream_time()
...
Instead of recalculating stream times manually in a playlist, let the playlist
do it, so that it fixes up partial segment stream times too.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
d76aacfb82
hlsdemux2: LL-HLS improvements
...
Fixes for stream_time recalculation and handling in partial segments.
Disallow bitrate switching when in the middle of partial segments - only at a
full segment (or right before the first partial segment of a segment).
It's possible but more difficult to switch bitrates in the middle of a partial
segment group, since they are less likely to have aligned keyframes. In any
case, the seek code can't do that right now.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
b6abe94890
hlsdemux2: Continue implementing LL-HLS support
...
Somewhat working support for proceeding into the partial segments appearing at
the live edge of the playlist.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
92e849070f
hlsdemux2: Mark locations where partial segments need handling
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
cfc62a69f7
hlsdemux2: Start adding partial_segment handling
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
9aa2497062
hlsdemux2: Note STABLE-RENDITION-ID is not handled
...
Add a comment that STABLE-RENDITION-ID is not yet parsed or used.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
e2750d4ae3
hlsdemux2: Calculate stream times for partial segments
...
When calculating stream times for segments, fill in the stream time fields on
any attached partial segments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
43a8d45ac6
hlsdemux2: Add unit test for parsing LL-HLS playlist
...
Test parsing of partial segments (EXT-X-PART, EXT-X-PART-INF) and preload
hints (EXT-X-PRELOAD)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
3c50f54310
hlsdemux2: Implement preload hint parsing
...
Load EXT-X-PRELOAD-HINT into a preload_hints array in the media playlist
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
3ed6a23a4d
hlsdemux2: Implement EXT-X-SERVER-CONTROL parsing
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
07f51396af
hlsdemux2: Add parsing of partial segments
...
Add partial segments to each media segment, and potentially create a trailing
dummy segment if there are partial segments at the end of the playlist
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
fac7177354
hlsdemux2: make helper function for parsing times
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Edward Hervey
4e946890b2
adaptivedemux2: Global output position is always positive
...
Change to non-signed GstClockTime for tracking
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Seungha Yang
e1a22402d3
tools: Make sure UTF-8 encoded command line arguments on Windows
...
On Windows, arguments passed in main() are system codepage
encoded and might not be valid UTF-8 string.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3828 >
2023-02-03 16:05:19 +00:00