Edward Hervey
bead28ad5c
hlsdemux2: Don't set a referer when updating playlists
...
In the same way we don't for regular playlists in the base class.
If there is a referer specified by the app/user, the downloadhelper will set it
accordingly.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3972 >
2023-03-20 07:59:26 +00:00
Sebastian Dröge
ccad9a7338
plugins: Fix various trivial clang compiler warnings
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4210 >
2023-03-18 16:16:55 +02:00
Seungha Yang
40300172ad
adaptivedemux2: Fix MSVC build error
...
downloadrequest.c(497): error C4013: 'atoi' undefined; assuming extern returning int
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4107 >
2023-03-03 23:15:42 +09:00
Rafał Dzięgiel
2d79f7d392
dashdemux2: mpdclient: Debug all restrictions when selecting rep
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3894 >
2023-02-18 22:47:18 +01:00
Rafał Dzięgiel
d86b2d4efa
dashdemux2: Add start-bitrate property
...
Similarly to hlsdemux2 that has this property, also add it to dashdemux2
so users can use it to choose first alternate.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3894 >
2023-02-18 22:47:07 +01:00
Rafał Dzięgiel
9d720554a0
dashdemux2: Improve initial representation selection
...
Do not always start with lowest quality possible. Use properties set
by user to select best allowed initial representation at startup too.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3894 >
2023-02-18 21:05:25 +00:00
Rafał Dzięgiel
38028c9873
hlsdemux2: Make start-bitrate property work without connection-speed
...
Makes "start-bitrate" work without setting "connection-speed" property. Having
another property set as a requirement for this one to work is unexpected.
This commit allows to request some initial bitrate for first segment, then
go into adaptive streaming for the rest of media playback.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3895 >
2023-02-17 17:48:40 +01:00
Edward Hervey
f072b25940
adaptivedemux2: Use track ID for debugging
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3890 >
2023-02-10 10:56:52 +00:00
Edward Hervey
5e193730db
adaptivedemux2: Split track id from event stream-id
...
The id is used for naming of the various objects and debugging. We don't
want/need it to be obfuscated with the massive upstream id.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3890 >
2023-02-10 10:56:52 +00:00
Edward Hervey
0639f117cb
hlsdemux2: Remove enable-llhls property
...
This was only used for testing purposes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:24 +00:00
Edward Hervey
854683c871
hlsdemux2: Don't leak PDT datetime
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:24 +00:00
Edward Hervey
96613c45fb
adaptivedemux2: Don't leak taglist
...
Clarify the ownership in the documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:24 +00:00
Edward Hervey
123030feac
adaptivedemux2: Don't leak track tags
...
The tags are fully transfered to this function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
6f6c0cbbaf
adaptivedemux2: Log request duration in debug output
...
When completing, log how long a HTTP request took into the debug output.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
714628f1ec
hlsdemux2: Improve live playlist update intervals
...
The live playlists should be updated at a defined interval. The problem is that
this interval was used *after* the playlist was finally received and processed,
which resulted in a gradual shift happening in playlist updates.
Instead store and use the time at which playlists were requested to determine
when the next one should be downloaded.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
6684aee14c
hlsdemux2: Fix playlist reload interval when unchanged
...
When falling back to using the regular last segment, use that duration as the
identical-playlist reload interval (and not the playlist target duration which
could be much larger)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
5935c8049a
hlsdemux2: Fix position searching
...
The scanning is done in a reverse order, the proper full checks to do are
therefore:
* If the position is beyond half a "segment duration", it's in the following
segment
* If the position is within the first half of a segment, it's in that one
* If the segment is the first one and the position is within half a duration
backwards, we consider the position as being within that first segment
Also handle the case where a "partial only" segment doesn't have a reliable
duration, and therefore use the playlist target duration instead.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
1c6364673d
hlsdemux2: Handle all cases for starting segment calculation
...
The implementation wouldn't work with regular HLS streams (i.e. the final
fallback).
Now that the implementation uses time to search for the starting
segment (instead of just the n-th from the end), we can specify the correct
hold_back fallback value from the RFC
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
3129970c8a
hlsdemux2: Fix buffering threshold calculation and handling
...
* The checks for smaller values were wrong
* Properly initialize the stream default recommended buffering threshold so that
a default (10s) value is used until the subclass can provide a proper value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
eb1eb64506
hlsdemux2: Make sure simple media playlist is properly primed
...
By setting/propagating stream time initially
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
3d0e8aa07e
adaptivedemux2: Fix manifest access during seeking query
...
Avoid a deadlock if a downstream seeking query happens while the scheduler
thread is holding the manifest lock (for example during a seek back to live).
Instead, do a more elaborate fix where the external calls that need access to a
'manifest' access a copy that's updated during a manually triggered manifest
update callback.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
5334007a0b
adaptivedemux2: Symbol hygiene cleanup
...
Rename track_dequeue_data_locked() to
gst_adaptive_demux_track_dequeue_data_locked(), since it's non-static.
Make find_stream_for_track_locked() static since it's only used in the main
gstadaptivedemux.c file.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
6bb74ed2a0
adaptivedemux2: Fix download error handling more
...
gst_adaptive_demux2_stream_finish_download() will already schedule another
fragment download if it can so don't fall through to the retry code that will
also try and schedule a download (triggering an assert).
Fix the logic in general to retry advancing into the live seek range once.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
b1354058e1
hlsdemux2: Immediately request playlist after URI changes
...
When the stream switches to a new playlist / variant while the loader is waiting
on a timer to refresh the old playlist, cancel the timer and submit the request
for the new URI.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
6d7d3d93e6
hlsdemux2: Re-add support for fallback variant URLs
...
fallback variant URLs get accumulated into a list in the variant now. If there's
one available, switch to it after a variant update failure (failure to load the
variant 3 times)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
d5b8929315
hlsdemux2: Demote log message
...
Don't complain loudly about replacing the current pending playlist, just log it
at debug level
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
91c8f3f990
hlsdemux2: Wait for playlist load after a switch
...
Check in update_fragment_info() if the playlist we want has actually been loaded
yet, and return BUSY if not.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
2b93dae59a
hlsdemux2: Handle async playlist loading failures
...
Add failed variant playlists to a list and failover to other variants until
there is none left
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
454779f094
hlsdemux2: Wait for playlist switch during seek.
...
When switching to/from an iframe variant to do seeking, wait for the target
playlist to load before handling the seek.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
fe41db92db
hlsdemux2/playlist-loader: Implement more features
...
Implement limited retries on download errors before reporting it, and remember
permanent redirects, with LL-HLS directives removed.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
9ae3978c72
hlsdemuxdemux2: Consider the hold-back when calculating seek range
...
When calculating the seek range for a live stream, use the same hold-back logic
as when choosing a starting segment, including low-latency segments if
enabled. Permits seeking closer to the live edge when re-synching or catching
up.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
083538df9e
hlsdemux2: Continue reworking code for async playlist updates
...
Everything is working again now except for corner cases:
- Failing over to another playlist after a load failure
- Remembering playlist redirects and using that URI
directly next time.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
93d92d5ddf
adaptivedemux2: Handle more async stream cases
...
Handle BUSY flow returns when making calls from external threads, and inhibit
fragment downloads during stream prepare
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
7b3a1bac0a
hlsdemux2: Add llhls-enabled property to streams
...
Tidying: Make the llhls-enabled setting configurable through a stream property
instead of set manually after construction.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
d5edd48f13
hlsdemux2: Add gst_hls_demux_stream_set_playlist_uri
...
Add a method that configures the new playlist URI for a stream.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
2c822735ba
hlsdemux2: Add HLS playlist loader
...
Add a helper that asynchronously loads and refreshes the playlist for HLS
streams.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
52d577eee1
adaptivedemux2: Fix for failed download handling
...
When playing at the live edge of a live playlist, and a download fails, we don't
expect there to be a next fragment. That case is handled lower down anyway, so
don't retry infinitely on spurious http errors at the live edge.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
ceda805abb
adaptivedemux2: Drop segment lock on stream_seek error.
...
If stream_seek() fails, make sure to drop the segment lock before bailing out.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
44d3751d68
adaptivedemux2: Add gst_adaptive_demux2_stream_wait_prepared()
...
Add a method that waits for a stream to signal the prepare_cond after it returns
a BUSY flow return.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
d3acafbb5a
adaptivedemux2: Remove gst_adaptive_demux2_stream_has_selected_tracks
...
Use gst_adaptive_demux2_stream_is_selected_locked() instead, which is identical
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
8d0c7d9d93
adaptivedemux2: Move GST_ADAPTIVE_DEMUX_FLOW_BUSY to adaptivedemux.h
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
0962908e62
adaptivedemux2: Add start/stop vfuncs
...
Remove the can_start() vfunc, in favour of vfuncs when the stream starts/stops,
allowing the sub-class to do custom logic before (or preventing) the stream from
starting and stopping.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
fa0e9e2ec5
hlsdemux2: Remove unused function argument
...
Remove the demux argument from the
gst_hls_demux_stream_update_rendition_playlist() method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
67bc8d7cc0
adaptivedemux2: Add gst_adaptive_demux_get_loop()
...
Add an accessor function for retrieving the demuxer's scheduler thread loop.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
2082c8912d
adaptivedemux2: Add gst_adaptive_demux_period_add_stream()
...
Make a function for adding a stream to a period, for better encapsulation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
82839fb82f
adaptivedemux2: Add new flow return value for BUSY and PREPARE stream state
...
Neither are used yet, they're just placeholders.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Edward Hervey
b03e68ea8c
hlsdemux2: support old compilers
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:23 +00:00
Jan Schmidt
1cede1d0cf
hlsdemux2: Place HLS delivery directives in UTF-8 order.
...
Use new GstURI gst_uri_to_string_with_keys() API to produce the playlist URI
with query arguments in UTF-8 order.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
21cb739830
hlsdemux2: Avoid assert in _has_next_fragment()
...
gst_hls_demux_stream_has_next_fragment() can be called with a NULL
current_segment if we're past the end of the current playlist. In that case,
just return FALSE instead of hitting a critical in the playlist code.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
018a6192bd
hlsdemux2: Include skipped segments in MSN calculation
...
When a playlist has skipped segments, increment the MSN to account for them so
the remaining segments end up with the right sequence numbers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
268a25b979
hlsdemux2: Use partial segment for playlist update interval
...
When playing LL-HLS playlists in LL-HLS mode, update the playlist more often (on
the partial segment interval) or else we end up downloading them in bursts and
playing further from the live edge than intended.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
55f6cd9243
hlsdemux2: Do a full playlist reload if delta fails
...
If we do a delta playlist request but then can't merge the result with the
existing playlist, retry with a full playlist request.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
874b665710
hlsdemux2: Fill in skipped segments if possible
...
After reloading a playlist using a delta request, use the previous playlist to
fill in skipped segments if possible.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
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
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