Commit graph

3849 commits

Author SHA1 Message Date
Tim-Philipp Müller
8a047a619e gst-libav: drop use of GSlice allocator
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3784>
2023-02-03 17:48:09 +00:00
Tim-Philipp Müller
f5977dae15 rtsp-server: drop use of GSlice allocator
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3784>
2023-02-03 17:48:09 +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
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
Seungha Yang
090d50e1a0 tests: Add CUDA memory allocator test
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:43 +00:00
Seungha Yang
10ade466ef nvenc: Use CUDA stream of memory if exists
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:43 +00:00
Seungha Yang
7a8bb85523 cudaupload, cudadownload: Update for shared CUDA stream
Use CUDA stream of memory if exists

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:43 +00:00
Seungha Yang
aabcba16db nvdecoder: Skip synchronization if downstream buffer holds CUDA stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
ddc5f1d425 cudaconvertscale: Add support for shared CUDA stream
If CUDA stream is shared by upstream/downstream, don't sync at
convert element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
1cb47d549b cudaconverter: Don't sync per conversion
Caller should take care of synchronization

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
8d14194fdd nvencoder: Add support for shared CUDA stream
Sets CUDA stream on CUDA buffer pool so that CUDA stream object
can be shared

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
d409c35367 cudabufferpool: Add support for CUDA stream use in memory
* Use GstCudaPoolAllocator
* Pass configured GstCudaStream object to allocator

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
30d06e03c2 cudamemory: Make GstCudaStream-aware
This will be used for CUDA stream sharing.

* Adding GstCudaPoolAllocator object. The pool allocator will
  control synchronization of allocated memory objects.
* Modify gst_cuda_allocator_alloc() API so that caller can specify/set
  GstCudaStream object for the newly allocated memory.
* GST_CUDA_MEMORY_TRANSFER_NEED_SYNC flag is added in addition to
  existing GST_CUDA_MEMORY_TRANSFER_NEED_{UPLOAD,DOWNLOAD}.
  The flag indicates that any GPU command queued in the CUDA stream
  may not be finished yet, and caller should take care of the
  synchronization.
  The flag is controlled by GstCudaMemory object if the memory holds
  GstCudaStream. (Otherwise, GstCudaMemory will do synchronization
  as before this commit). Specifically, GstCudaMemory object will set
  the new flag automatically when memory is mapped with
  (GST_MAP_CUDA | GST_MAP_WRITE) flags. Caller will need to unset
  the flag via GST_MEMORY_FLAG_UNSET() if it's already synchronized
  by client code.
* gst_cuda_memory_sync() helper function is added to perform synchronization
* Why not use CUevent object to keep track of synchronization status?
  CUDA provides fence-like interface already via CUevent object,
  but cuEventRecord/cuEventQuery APIs are not zero-cost operations.
  Instead, in this version, the status is tracked by using map and
  object flags.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
9eaae61a44 cudamemory: Allow nullptr allocator object
The GstCudaAllocator object doesn't hold any device object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
0a81c8deb3 nvcodec: Port to GstCudaStream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
a7c54ebc06 cuda: Add GstCudaStream object
Wrap CUstream handle with GstCudaStream to make it ref-counted
object. This GstCudaStream object will be used later for
CUDA stream sharing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
661b5f60c6 cuda: Provide single header include entry point
Add "gstcuda.h" header file

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang
c0a4f41525 pluginloader-win32: Prepend gstreamer-1.0-0.dll directory to PATH env for child process
Usually gst-plugin-scanner.exe will be located under libexec/gstreamer-1.0
or even somewhere user specified location via GST_PLUGIN_SCANNER
environment. So, in order for child process to be able to load
GStreamer DLLs, parent process will need to update PATH env

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3886>
2023-02-03 14:25:21 +00:00
Seungha Yang
bc0708eafb nvencoder: Fix min buffers parameter of allocation query in auto GPU mode
At the time when propose_allocation() get called, encoder session
would not be initialized yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3888>
2023-02-03 22:19:22 +09:00
Sebastian Dröge
8aa376d541 gstreamer: Decide rate-control-mode based on the bitrate/cqp/crf settings
And also keep the default encoder settings but simply override them with
our own values that we care about.

This mirrors the encoder configuration behaviour from ffmpeg.
2023-02-03 12:48:56 +02:00
Sebastian Dröge
70c83bc59c gstreamer: Use GLib types instead of stdint.h types consistently 2023-02-03 12:48:56 +02:00
Sebastian Dröge
dd1db338df gstreamer: Fix double unref
The ownership of the caps is passed to `gst_video_encoder_set_output_state()`.
2023-02-03 12:48:56 +02:00
Sebastian Dröge
df064c6cc2 gstreamer: Configure colorimetry and HDR metadata if present
This raises the minimum GStreamer requirement to 1.16 as used by the CI
and optionally makes use of 1.18 features, including HDR.
2023-02-03 12:48:25 +02:00
Sebastian Dröge
aeee6f5b6a gstreamer: Set correct maximum width/height limits 2023-02-03 12:35:24 +02:00
Sebastian Dröge
65eb56e7ad gstreamer: Use correct 10-bit format on big endian systems 2023-02-03 12:35:24 +02:00
Sebastian Dröge
90fd191392 gstreamer: Set force_key_frames=true in CQP/CRF mode
Other modes don't support that so keyframes can't be requested at
arbitrary times.
2023-02-03 12:35:24 +02:00
Sebastian Dröge
f24643b48f gstreamer: Add support for setting arbitrary parameters via parameters-string property 2023-02-03 12:35:18 +02:00
Sebastian Dröge
d746164ba0 gstreamer: Fix naming of function name that was taken over from the SVT-HEVC encoder 2023-02-03 12:34:38 +02:00
Sebastian Dröge
ddb9a037e1 gstreamer: Don't overwrite application configuration on initialization and initialize with the default configuration 2023-02-03 12:34:38 +02:00
Sebastian Dröge
7b1b33aff2 gstreamer: Clean up property handling
Use more correct types, defaults and clean up property names a bit.
This now matches the configuration provided by ffmpeg.
2023-02-03 12:34:38 +02:00
Sebastian Dröge
78ee7e82d9 gstreamer: Mark all internal functions as static 2023-02-03 12:34:38 +02:00
Sebastian Dröge
10769e7fe6 gstreamer: Fix encoder and buffer state life cycle
Allocate/deallocate the encoder in `open()`/`close()` and its buffers in
`start()` / `stop()`.

Also fail correctly if configuring the encoder fails.
2023-02-03 12:34:38 +02:00
Sebastian Dröge
24d6027d2e gstreamer: Remove unused frame_count and dts_offset 2023-02-03 12:34:38 +02:00
Sebastian Dröge
2d250439f1 gstreamer: Fix debug category description 2023-02-03 12:34:38 +02:00
Adrian Fiergolski
79d2af5626 avtp: rvf: add missing since markers
Add missing markers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1335>
2023-02-02 19:15:46 +01:00
Adrian Fiergolski
9f880b37fc avtp: rvf: add AVTP RVF de-payload support
Add AVTP Raw Video Format de-payload support. The element supports only
GRAY16_LE output format, so:
- active pixels (no vertical blanking),
- progressive mode,
- 8 and 16-bit pixel depth,
- mono pixel format,
- grayscale colorspace.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1335>
2023-02-02 19:15:42 +01:00
Adrian Fiergolski
d8f449ccda avtp: cvf: extract AVTP VF depayload base class
Extract a part which could be common with the AVTP RVF depayload plugin to a separate class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1335>
2023-02-02 19:15:38 +01:00
Adrian Fiergolski
4f2fde0163 avtp: rvf: add AVTP RVF payload support
Add AVTP Raw Video Format payload support. The element supports only GRAY16_LE
input format, so:
- active pixels (no vertical blanking),
- progressive mode,
- 8 and 16-bit pixel depth,
- mono pixel format,
- grayscale colorspace.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1335>
2023-02-02 19:15:33 +01:00
Adrian Fiergolski
8702a1fa67 avtp: cvf: extract AVTP VF payload base class
Extract a part which could be common with the AVTP RVF payload plugin to a separate class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1335>
2023-02-02 19:15:29 +01:00
Jan Schmidt
edd5911249 gl/cocoa: Return a strong ref to the parent GstGLContext
If the GstGLCAOpenGLLayer was initialized via a parent
context, make sure to ref the context before returning it
from getGLContext as all callers will unref it.

Follow up to !3729

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3881>
2023-02-02 13:53:07 +00:00
Jan Schmidt
138863b327 gsturi: Add API to order query strings
Add gst_uri_get_query_string_ordered() and gst_uri_to_string_with_keys() that
allow constructing the URI string with query arguments in a specific order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3803>
2023-02-02 11:02:47 +01:00
Piotr Brzeziński
ae200a4d62 vtenc: Disable HW acceleration for interlaced ProRes
Due to a bug in the VT API, attempting to encode interlaced content
with ProRes results in an error, halting the pipeline instead of
gracefully falling back to software encoding.
Should be removed in the future if Apple ever fixes this issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3222>
2023-02-02 06:18:02 +00:00
He Junyan
60731adea6 va: Avoid the array index overflow when filling 8x8 scaling list.
The VA API has not defined the scaling list entries for U/V planes
for the 4:4:4 stream. In fact, we do not meet the 4:4:4 format output
for H264 so far, and scaling list is not used frequently, so we just
print out some warning and ignore these scaling list values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3749>
2023-02-02 00:41:42 +00:00
Thibault Saunier
6b30a5d987 adaptivedemux2: Generate proper stream-id taking into account upstream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3160>
2023-02-01 22:26:34 +00:00
Thibault Saunier
3963396716 gstutils: Add a utility to create a stream-id without a pad
We already have functions to generate a stream-id from pads but in the
end those pads are not even used in most cases. This adds functions to
generate a stream-id even before creating the source pads for the
element that is going to use it. For example a demuxer that is properly
implements the GstStream/GstStreamCollection API will not have a Pad but
already needs to generate a stream-id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3160>
2023-02-01 22:26:33 +00:00
Colin Kinloch
25b4e84fe5 validate: Allow Ctrl-C to quit on fault
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3868>
2023-02-01 21:40:01 +00:00
Seungha Yang
29bd8de052 nvvp9dec: Fix return value
It should return GstFlowReturn value, not boolean

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3870>
2023-02-02 05:07:44 +09:00
Sebastian Dröge
b12c66042b aom: Include stream-format and alignment in the AV1 caps
The decoder does not work with arbitrary alignment and annexb stream
format and the encoder can give the information that it outputs
obu-stream/tu to downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3862>
2023-02-01 19:04:32 +00:00
Seungha Yang
09d29cca5a pluginloader-win32: Watch child process handle on connection
... so that parent can avoid waiting if child process got terminated
unexpectedly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3863>
2023-02-01 17:00:11 +00:00
Seungha Yang
464a8be3a4 pluginloader-win32: Check pipe state in child process
Retry if server is not ready for the connection

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3863>
2023-02-01 17:00:11 +00:00
Seungha Yang
0df7cd852c pluginloader-win32: Enhance debug log
Change log level to ERROR if it's unexpected, and print error reasons

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3863>
2023-02-01 17:00:10 +00:00
Seungha Yang
f314884b7d pluginloader-win32: Zero initialize overlapped struct before use
Helper child process might be spawned multiple times for some reason
then overlapped struct can hold garbage data. Always clear the struct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3863>
2023-02-01 17:00:10 +00:00
Olivier Crête
16158df5b2 wayland: Export the _get_type() functions
Add the macro before the declaration so the types are properly exported,
this makes it possible to do dynamic casting and checks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3858>
2023-02-01 15:29:26 +00:00
James Hilliard
fc5159c2d8 Fix gstreamer-validate-1.0 dependency name
The gst-devtools project generates gstreamer-validate-1.0.pc, this
must match the dependency in gst-editing-services for detection
to work properly.

Fixes:
Run-time dependency gst-validate-1.0 found: NO (tried pkgconfig and cmake)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3859>
2023-02-01 14:15:45 +00:00
Matthew Waters
659c45ee7e qml6: implement qml6gloverlay
Based on the Qt5 version of qmlgloverlay.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3845>
2023-02-01 13:23:52 +00:00
Tim-Philipp Müller
aeb0fa9993 subprojects: Update libsrtp2 wrap to v2.5.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3860>
2023-02-01 10:34:35 +00:00
Guillaume Desmottes
3d1390d31a rtpptdemux: set different stream-id on each src pad
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3855>
2023-02-01 09:17:33 +00:00
Guillaume Desmottes
cc2b8f6ae8 rtpssrcdemux: set different stream-id on each src pad
All the RTP src pads were sharing the same stream-id while each actually
carry a different stream.

This was causing problem for example when funneling the streams together
and then trying to split them using 'streamiddemux'.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3855>
2023-02-01 09:17:33 +00:00
Sebastian Dröge
3ca85189fd rtspsrc: Also consider "Method Not Valid In This State" error in broken control URL handling workaround
Some servers send a 455 error instead of any reasonable error when using
a correctly constructed control URL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3854>
2023-02-01 07:55:24 +00:00
Thibault Saunier
35e2ecd48b clocksync: Add "QoS" support
When ClockSync synchronizes the data stream on the clock, it should also
push `QoS` events if the user wants to do it as, as stated in [the QoS
design doc] "Elements that synchronize buffers on the pipeline clock
will usually measure the current QoS".

The logic has been replicated from `GstBaseSink`.

[the QoS design doc]: https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/qos.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2225>
2023-02-01 07:02:19 +00:00
Jordan Petridis
dfc6545741 meson: Use gtk tarball for the subproject wrap
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3852>
2023-02-01 06:29:11 +00:00
Mengkejiergeli Ba
dfe16a5cf2 msdkallocator: Use const ptr of videoinfo in func param
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3621>
2023-02-01 04:31:23 +00:00
Benjamin Gaignard
16ad80179b codec2json: Add av12json element
This element convert AV1 frame header into human readable
json data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3734>
2023-01-30 19:46:55 +00:00
Benjamin Gaignard
fd588a50e4 codec2json: Add vp82json element
This element convert vp8 frame header into human readable
json data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3734>
2023-01-30 19:46:55 +00:00
Matthew Waters
b134433e0b examples/webrtc-sendrecv: add some dot file dumps on async-done and error messages
Just as a helpful thing if debugging is needed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3823>
2023-01-30 05:22:59 +00:00
Tim-Philipp Müller
9a300fc501 validate-scenario: fix g-i warning in annotation
gst-validate-scenario.c:2485: Warning: GstValidate: missing ":" at column 28:

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3841>
2023-01-28 20:03:05 +00:00
Mathieu Duponchelle
4d240c27b7 BaseSrc: fix transfer annotation for fixate virtual method
The fixate virtual method has the same semantics as gst_caps_fixate(),
so the caps parameter must be marked as (transfer full).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3830>
2023-01-28 03:48:21 +00:00
Matthew Waters
293ad62035 qt6: add qml6glsrc element
Same functionality as qmlglsrc (Qt5) but for Qt6.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3737>
2023-01-28 02:24:09 +00:00
Thibault Saunier
fa23e24f41 validate: Fix gst_validate_execute_action annotation
The action passed in is transfer full

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3829>
2023-01-28 01:31:14 +00:00
Alicia Boya García
8a6023a38a qtdemux: Use safer clearing functions in dispose()
In theory, `dispose()` functions should be idempotent and should be
prepared not to crash or cause a double-free if an unref done from
inside caused a recursive call to `dispose()` of the same object.

https://developer.gnome.org/gobject/stable/howto-gobject-destruction.html

This patch modifies the `dispose()` method to honor these constraints.

Since the double `dispose()` call won't actually occur in qtdemux (there
is no cycle detection mechanism that could invoke it to work that way),
this is more of a code cleanup than a user-facing problem fix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3822>
2023-01-28 00:32:57 +00:00
Tim-Philipp Müller
4051581ed8 codecparsers: vp9parser: use single allocation for parser structs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3790>
2023-01-27 23:50:19 +00:00
Thibault Saunier
d1e3941a89 uritranscodebin: Fix unref of NULL
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3831>
2023-01-27 21:58:43 +00:00
Seungha Yang
c6a6c56cdf win32ipc: Add support for zero-copy rendering
* Extend protocol so that client can notify of releasing shared memory
* Server will hold shared memory object until it's released by client
* Add allocator/buffer pool to reuse shared memory objects and buffers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3765>
2023-01-27 18:55:13 +00:00
Seungha Yang
c32b898cbb mpegpsdemux: Ignore DTS if PTS < DTS
It's possibly timestamp rollover case. But PTS < DTS is already
invalid case anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3657>
2023-01-27 17:48:32 +00:00
Georges Basile Stavracas Neto
a8a7ee6d83 glvideomixer: Add xalign and yalign properties
With the addition of the 'keep-aspect-ratio' sizing policy, content
that doesn't fit the target size is downscaled according to its own
aspect ratio to fit that target size, and centered.

Centering might not always be the desired behaviour, however;
consumers of this API might want to align the resulting picture to
the left or to the right.

To account for any of these cases, add two new properties to the
glvideomixer pad: xalign, and yalign. They operate on normalized
coordinates (0.0 for start, 1.0 for end), and default to 0.5 which
centers content.

<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3762>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3762>
2023-01-27 16:21:28 +00:00
Sebastian Dröge
c5d211d45a gldisplay: Mark gst_gl_display_create_context() other_context parameter as nullable
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/438

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3825>
2023-01-27 16:22:06 +02:00
Mathieu Duponchelle
c8298a2787 BaseSrc, PushSrc: add nullable annotations to virtual methods
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3806>
2023-01-26 22:35:31 +00:00
Daniel Knobe
5e9a32ed8c imagefreeze: add bayer support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3807>
2023-01-26 21:30:51 +00:00
Tim-Philipp Müller
beb4f4bff1 sdpdemux: add "media" property to allow audio-only or video-only streaming
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3531>
2023-01-26 16:17:21 +00:00
Tim-Philipp Müller
7f2a9d738a sdpdemux: add "rtcp-mode" property to disable RTCP
If we know there's only one stream we care about and we
don't have to synchronise audio and video, or send RRs,
we might just as well not hook up all the RTCP bits and
use fewer threads and sockets and simplify the pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3531>
2023-01-26 16:17:21 +00:00
Seungha Yang
983d78daa5 wasapi2src: Fix loopback capture on Windows 10 Anniversary Update
... or older. Work around an OS bug that loopback capture
device doesn't notify event.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1738
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3782>
2023-01-26 13:31:20 +00:00
Víctor Manuel Jáquez Leal
6b04c8ee56 vulkan: imagebufferpool: Remove video meta handling.
Remove video meta handling since it's not used at all, also removed its usage in
vkvideofilter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3722>
2023-01-26 11:49:00 +00:00
Jan Alexander Steffens (heftig)
e3fa65abab aggregator: Warn about the right segment's format
We were checking the head segment here, not the current segment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/611>
2023-01-26 10:39:08 +01:00
Jan Alexander Steffens (heftig)
08d4b0051a aggregator: Always lock aggpad around update_time_level
`aggpad->segment` is protected by the `aggpad`'s object lock. We need to
take the lock before calling `update_time_level`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/611>
2023-01-26 10:39:08 +01:00
Bart Van Severen
024ef7659d rtsp: gstrtspurl: gst_rtsp_url_get_request_uri: fix incorrect scheme for tls transport methods
gst_rtsp_url_get_request_uri returns rtsp://... url when requested url is rtsps://, this is not
in accordance with https://www.rfc-editor.org/rfc/rfc7826.html#section-19.2.
This also impedes setting up a rtsps session with a live555 rtsp server.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3568>
2023-01-26 07:46:59 +00:00
Bart Van Severen
a62b07f3b4 sdp: gstmikey: gst_mikey_message_to_caps: extract salt and append to srtp-key
A KEMAC can hold both key and salt, so if salt is present, we should extract it
and append it to the srtp-key cap because libsrtp expects the srtp-key to hold
the concantenated srtp master key and salt.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3568>
2023-01-26 07:46:59 +00:00
Bart Van Severen
5678151799 sdp: gstmikey: gst_mikey_message_to_caps: extract ROC from first crypto session
We need the ROC to decrypt a SRTP stream as the ROC is part of the AES IV.
So look for first crypto session, from which we can get the ROC and find corresponding
crypto policy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3568>
2023-01-26 07:46:59 +00:00
Daniel Ulery
befab7af72 filesink: Adds rb+ file mode
Adds rb+ file mode to filesink so that files can be pre-allocated. This
can be use to keep reduce fragmentation over time with splitmuxsink.

Fixes  #955

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1532>
2023-01-26 07:05:21 +00:00
Víctor Manuel Jáquez Leal
d8cb9d2ce3 vulkan: physicaldevice: Dump 1.3 features and properties.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3721>
2023-01-26 03:19:58 +00:00
Víctor Manuel Jáquez Leal
e54d334526 vulkan: memory: Flush non coherent memory after write.
Spec 7.1.3:

If a memory object does not have the VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
property, then vkFlushMappedMemoryRanges must be called in order to guarantee
that writes to the memory object from the host are made available to the host
domain, where they can be further made available to the device domain via a
domain operation. Similarly, vkInvalidateMappedMemoryRanges must be called to
guarantee that writes which are available to the host domain are made visible to
host operations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3723>
2023-01-26 02:31:09 +00:00
Sebastian Dröge
aba0b0e90a gstreamer: Use stream-format=obu-stream alignment=tu in the caps
There is no byte-stream/au format for AV1 but only for H264, and the
encoder actually outputs obu-stream/tu instead of the annexb
stream-format that is similar to H264 byte-stream format.

Without this the encoder can't be used with elements that require a
specific AV1 stream-format, e.g. the MP4 or Matroska/WebM muxer.
2023-01-26 01:46:46 +00:00
Seungha Yang
621feb32e9 gst-plugin-scanner: Add support for Windows
Adding Win32 specific plugin loader implementation.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/11
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3512>
2023-01-25 18:24:28 +00:00
U. Artie Eoff
d071ea714d vp9parser: remove checks for g_new0 result
The g_new0 aborts the process if it fails.  Thus,
there is no need to check if the g_new0 call succeeded.

This should silence a resource leak warning by static
scan.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3788>
2023-01-25 17:36:54 +00:00
Nirbheek Chauhan
32e8ff4e2a webrtc_sendrecv.py: Fix PEP8 warnings in CI lint
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3742>
2023-01-25 16:53:17 +00:00
Nirbheek Chauhan
6a83602601 webrtc_sendrecv.py: Handle LATENCY messages
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3742>
2023-01-25 16:53:17 +00:00
Nirbheek Chauhan
5500c228f6 webrtc_sendrecv.py: Add bus message handling
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3742>
2023-01-25 16:53:17 +00:00
Nirbheek Chauhan
9b2404e76d webrtc_sendrecv.py: Add support for using H264 encoding
Currently only works when we are creating the offer or the offer only
contains H264.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3742>
2023-01-25 16:53:17 +00:00
Nirbheek Chauhan
6f99faa080 webrtc_sendrecv.py: Use sine wave for audio instead of red-noise
Makes it easier to notice when there's packet loss or other audio
distortion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3742>
2023-01-25 16:53:17 +00:00
Pawel Stawicki
492d2b6498 v4l2h264dec: Fix Raspberry Pi4 will not play video in application
Ensure object v4l2object->pool will be released by
correctly releasing the temporary thread-safety lock

Fixes issue #1729

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3786>
2023-01-25 16:07:50 +00:00
Georges Basile Stavracas Neto
56513a18cb glvideomixer: Add 'sizing-policy' pad property
The sizing policy allows selecting between the current behavior,
which deforms the texture to fill the width and height of the
pad; and a new 'keep-aspect-ratio' sizing policy, which fits the
texture within the rectangle respecting its original aspect ratio.

The reason for this is that this allows avoiding extra elements
in the pipeline, and reduces the number of buffer passing through
the pipeline.

Most of this code is a direct port of the sizing policy handling
of the compositor element, except it is adapted to operate on GL
texture coordinates through the projection matrix.

<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3760>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3760>
2023-01-25 15:16:31 +00:00
Sebastian Dröge
bfaa02ab56 gst: Fix gst_type_find_peek() return value annotation
It's not possible to annotate a in-parameter for a return value array as
the array length. Both are assumed to have the same direction and the
current annotation causes the size parameter to be considered an out
parameter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3787>
2023-01-25 13:16:44 +00:00
Sebastian Dröge
0378bd3fed sdp: Fix gst_mikey_payload_key_data_set_interval() array length annotation
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1744

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3787>
2023-01-25 13:16:44 +00:00
Nirbheek Chauhan
f1570b26a6 Add a wrap for the latest gtk4
This is the oldest tag that contains meson fixes needed to be able to
build gtk as a subproject on macOS and Windows.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3708>
2023-01-25 11:38:52 +00:00
Nirbheek Chauhan
947c464830 libxml2.wrap: update to latest version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3708>
2023-01-25 11:38:52 +00:00
Nirbheek Chauhan
cc3078d819 meson: Add a wrap file for libsrt2p
And allow fallback to it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3708>
2023-01-25 11:38:52 +00:00
Nirbheek Chauhan
8e8d8206f1 meson: Add build_rpath for qt5 plugin on macOS
Without this, the plugin cannot be loaded in a devenv because the
RPATH is not added to the plugin dylib. This RPATH will be stripped on
install, which is what we want.

When deploying apps, people are supposed to use `macdeployqt` to
create an AppBundle that bundles Qt for you and sets the RPATHs
correctly to point to that bundled Qt.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3708>
2023-01-25 11:38:52 +00:00
Nirbheek Chauhan
eff9455ada nvcodec: Log readable errors when initializing CUDA
It is really difficult for people to figure out why nvcodec has
0 features. Even the debug log is cryptic. Also make sure the errors
go to the ERROR log level, which is more likely to be enabled by
default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3776>
2023-01-25 10:08:10 +00:00
Nirbheek Chauhan
43ae6b421b nvcodec: Fix reporting of CuDeviceGetCount error
cuda_ret is was always going to be CUDA_SUCCESS in the error log.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3776>
2023-01-25 10:08:10 +00:00