Commit graph

315 commits

Author SHA1 Message Date
Guillaume Desmottes df3b2e2d41 adaptivedemux2: fix critical when using an unsupported URI
adaptivedemux2 only supports http(s), trying to use it with, say,
file:// was raising a CRITICAL in libsoup.

Fix #2476

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4396>
2023-04-12 06:33:39 +00:00
Matthias Fuchs 884dbb4ace qtwindow: unref caps in destructor
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4393>
2023-04-11 18:39:02 +00:00
Jordan Petridis 1c301df91a jack: remove version guards from the code
We already require >= 1.9.7 in meson and thus we can remove
the older codepath.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4348>
2023-04-05 21:39:00 +00:00
Jan Schmidt 8ec6ef8ca4 adaptivedemux: Don't parse URI unnecessarily
Short-circuit parsing and recreating the playlist URI if
no HLS directives are going to be applied to it.

Fixes problems playing some streams (YouTube) that have
unneeded escaped characters in the URI and then complain
when GStreamer removes the escaping

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4335>
2023-04-04 19:21:31 +00:00
Edward Hervey dd3542aa4d adaptivedemux2: Don't blindly set the main manifest URI as referer
There's no guarantee it will *actually* be the URI which refered to what we are
downloading. It could be a stream URI or anything else.

Instead of putting something wrong, put no (specific) referer as a better choice

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3972>
2023-03-20 07:59:27 +00:00
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 7e2a0779c3 flacenc: Fix mapping of GStreamer image tag type to FLAC image tag type
These enums are not compatible so just casting them does not work.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4210>
2023-03-18 16:17:01 +02: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
Tim-Philipp Müller 0fc568c6b1 gst-plugins-good: re-indent with GNU indent 2.2.12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4182>
2023-03-17 03:18:54 +00: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