Commit graph

119888 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal 236d6714ec msdkcaps: fix ill-format string
This patch fixes this critical warning when registering MSDK:

_dma_fmt_to_dma_drm_fmts: assertion 'fmt != GST_VIDEO_FORMAT_UNKNOWN' failed

It was because the HEVC string with possible output formats has an extra space
that could not be parsed correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6853>
2024-05-29 13:08:55 +00:00
Edward Hervey 94646c642d decodebin3: Specify stream-id for missing decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6886>
2024-05-29 11:44:06 +00:00
Edward Hervey c987eaa427 pbutils: Missing plugin messages can contain the stream-id
In order to help users and applications, allow setting the stream-id for which
there is a missing plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6886>
2024-05-29 11:44:05 +00:00
Seungha Yang 96cf3d7063 d3d12encoder: Do not print error log for not-supported feature
gst_d3d12_result() will print message with ERROR level if failed.
Use FAILED/SUCCEEDED macros instead, since not-supported feature
is not a critical error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6955>
2024-05-29 10:45:13 +00:00
Seungha Yang ec11bb8253 d3d12memory: Allow null allocator in alloc()
Update code as documented

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6940>
2024-05-29 09:45:26 +00:00
Jakub Adam 859b1c8b63 glcolorconvert: update existing sync meta if outbuf has one
Instead of always adding a new one, which means the buffer could end up
with multiple sync meta instances.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6942>
2024-05-29 07:29:43 +00:00
Sebastian Dröge 529f2472b3 gstreamer: parse: Don't assume that child proxy child objects are GstObjects
The name is already passed via the signal parameters so it doesn't have
to be retrieved again via GstObject API, which would crash on other
GObjects. Child proxy child objects can be any kind of GObject and the
code here otherwise handles this correctly already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6938>
2024-05-29 05:33:03 +00:00
Nicolas Dufresne 79312357a6 av1parse: Properly transfer TU timestamp
When transforming from unknown alignment to frame or obu, the TU timestamp
was not properly transferred. Fix this by saving the TU DTS as the first
DTS seen within the the TU data, and the PTS as the last PTS seen in that
TU data. Finally, reset the TU timestamp after each TU have completed.

Fixes #1496

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6895>
2024-05-28 23:59:36 +00:00
Nicolas Dufresne 5b1bc0f19f av1parse: Only place a marker on the last frame of a TU
Markers are meant to indicate the buffer that ends a frame, which imply
something can be displayed. The dependent decode only frames should not
have markers. This should also fix last subframe detection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6895>
2024-05-28 23:59:36 +00:00
Francisco Javier Velázquez-García 5fe7803128 docs: Correct pipeline examples in rawaudioparse
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6933>
2024-05-28 22:20:08 +00:00
Sebastian Dröge bb6d737a1e typefind: Fix handling of ID_ODD_SIZE in WavPack typefinder
Chunks are always starting on an even position and this flag only
specifies that the last byte of the chunk is not valid.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3569

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6941>
2024-05-28 19:18:37 +00:00
Seungha Yang a4dfca3ae4 webview2: Add user-data-folder property
Adding a propery to specify location of WebView2's user data folder
location.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6921>
2024-05-28 16:56:09 +00:00
Seungha Yang 05f9eadcaf qtmux: Handle time information value > UINT32_MAX
If any duration in timescale is larger than UINT32_MAX, use version 1
atom, otherwise file header will be constructed with truncated values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6843>
2024-05-28 16:09:58 +00:00
Seungha Yang c1b1c849f2 d3d12: Add support for Device Removed Extended Data (DRED)
Enable DRED if "d3d12dred > GST_LEVEL_ERROR", and print
DRED debug information on device removed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6718>
2024-05-28 15:09:21 +00:00
Edward Hervey c924e4cc1e hlsdemux2: Minor refactoring of starting segment check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 5bc9883d68 hlsdemux2: Be more tolerant when matching segments with PDT
Some servers might not provide 100% matching PDT when doing updates, or accross
variants. This would cause the code matching segments using PDT to fail if the
segment PDT was 1 microsecond (or whatever small value) before the candidate
segment. And would pick the (wrong) following segment as the matching one.

In order to be more tolerant when matching, we instead check whether the
candidate segment is within the first segment of the segment we are trying to
match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 81fd460c90 hlsdemux2: Fix failure to find a replacement segment on resync
If we end up with a segment with an internal time that varies from the supposed
one, this could be for two reasons:
* We guess-timated the wrong segment to go to when advancing or switching
  variants. In that case we try to find the actual segment to go to (just before
  this change).
* There was a complete playlist change (for whatever reason) and we can't find a
  replacement. In that case we want to carry on playback from this position but
  need to remember that we moved (by setting the stream to DISCONT, and
  resetting the new mapping).

Fixes playback on several broken stream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 3e810a6721 hlsdemux2: Refactor update of GstHLSTimeMap values
This was also missing transferring the PDT if present

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 9a7f455aea hlsdemux2: Fix parsing of EXT-X-DISCONTINUITY-SEQUENCE:0
Since the default value of `m3u8->discont_sequence` (before parsing of the
playlist data) was 0 .. we would never properly detect the presence of that
field if it was present with a value of 0.

This would later on cause havoc in playlist synchronization where we would
assume it didn't have a discontinuity sequence specified (whereas it did, and it
was 0).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey d2b3262b71 hlsdemux2: Increase tolerance for discontinuity detection
A lot of streams will do a poor job of estimating proper duration of fragments
in the playlist, but over several fragments have it correct.

Instead of constantly trying to realign the estimated stream time, allow for a
more realistic tolerance of 3-4 video frames

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 8b6e7a018c hlsdemux2: Ensure a discont will be set when resetting for lost sync
This is to ensures we inform the demuxer/parsers that what follows is not contiguous

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 836bca461a hlsdemux2: Fix handling of variant switching and playlist updates
When updating playlists, we want to know whether the updated playlist is
continuous with the previous one. That is : if we advance, will the next
fragment need to have the DISCONT buffer set on it or not.

If that happens (because we switched variants, or the playlist all of a sudden
changed) we remember that there is a pending discont for the next fragment. That
will be used and resetted the next time we get the fragment information.

Previously this was only partially done. And it was racy because it was set
directly on `GstAdaptiveDemux2Stream->discont` when a playlist was updated,
instead of when the next fragment was prepared.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 7d49b1cc51 adaptivedemux2: Only set DISCONT on beginning of fragments
This avoids accidentally setting it in the middle of a fragment, which could
cause havoc in demuxer/parsers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey 81c42ee14b hlsdemux2: Fix getting starting segment on live playlists
When dealing with live streams, the function was assuming that all segments of
the playlist had valid stream_time. But that isn't TRUE, for example in the case
of failing to synchronize playlists.

Fixes losing sync due to not being able to match playlist on updates

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Jordan Petridis 1126c1d90e ci: Use gst-indent-1.0 in the lint job
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6624>
2024-05-28 13:27:57 +00:00
Jordan Petridis b850a658ed pre-commit: Update the indent hook to work with our fork
We now have gst-indent-1.0 [1] which is a stripped down
fork of the version we expect. It's also using meson,
which is a bonus.

[1] https://gitlab.freedesktop.org/gstreamer/gst-indent

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6624>
2024-05-28 13:27:57 +00:00
Sebastian Dröge 9156b373e6 rtpbin: Regularly emit the sync signal
Even if no new synchronization information is available.

This is necessary because the timestamp offset logic in rtpbin depends
on the base RTP time that is determined by the jitterbuffer, but this
changes all the time (especially in mode=slave) and the timestamp
offsets have to be updated accordingly. Doing so is especially important
if they're only determined by the RTP-Info, which never changes from the
very beginning.

The interval can be configured via the new min-sync-interval property.
Synchronization happens at least that often, but at most as often as the
old sync-interval property allows.
Both intervals are now based on the monotonic system clock.

Additionally, clean up synchronization code a bit, only emit either
inband NTP or RTCP SR synchronization at the same time, based on which
one has the more recent time information, and only emit RTP-Info
synchronization if it wasn't provided previously at the same time as the
NTP-based synchronization information.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:31 +00:00
Sebastian Dröge df8c29e340 rtpjitterbuffer: Set max-rtcp-rtp-sync-time to -1 (disabled)
There is generally no requirement to ignore RTCP SR if the RTP time of
the SR differs a lot from the last received RTP packet. The mapping
between RTP and NTP time stays valid until there was a stream reset, in
which case we wouldn't use that information anyway.

When using rtcp-sync-send-time=false the default of 1s difference can
easily be exceeded, e.g. if encoding of the stream after capture adds
more than 1s of latency.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 95a0649945 rtpbin: Allow synchronizing against RTP-Info without having received any RTCP
Previously the information was provided from rtpjitterbuffer to rtpbin
only once the first RTCP SR was received, which is not necessary at all
as all required information is available from the caps already.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1162

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 8bfba72ea4 rtpbin: Add new never/ntp RTCP sync modes
Never is useful for some RTSP servers that report plain garbage both via
RTCP SR and RTP-Info, for example.

NTP is useful if synchronization should only ever happen based on RTCP
SR or NTP-64 RTP header extension.

Also slightly change the behaviour of always/initial to take RTP-Info
based synchronization into account too. It's supposed to give the same
values as the RTCP SR and is available earlier, so will generally cause
fewer synchronization glitches if it's made use of.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 158f12b5da rtpbin: Handle switches between RTP-Info and NTP-based stream association better
Instead of switching on the very first stream, require that all streams
have switched before switching to the different synchronization
mechanism.

Without this there will be a noticeable gap during the switch. E.g. when
going from RTP-Info to NTP-based association, first the first stream
only would get an offset, then the first two, ... then all of them.
Depending on the order of streams this will cause a lot of changes in
ts-offset during the transition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge b30671a8ee rtpbin: Pass NPT start from rtpjitterbuffer to rtpbin
And use it to detect synchronization changes (e.g. seeks) more reliably
when doing RTP-Info based synchronization.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 3eb22af88b rtpbin: Clean up stream association state
Use fewer magic numbers and keep track of the different synchronization
mechanisms separately. Also keep track of more state to detect more
situations when resynchronization should happen.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge d8dabf142f rtpbin: Constify function parameters and use correct types
Previously these parameters were randomly changed in the body of the
function to avoid having to declare a new variable, which made the code
very hard to follow. By marking them as const this won't be possible
anymore in the future.

Also the RTP clock-base (RTP time from RTSP RTP-Info) is an unsigned
64 bit integer as it's an extended RTP timestamp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 155c3fb3b2 rtpbin: Untangle NTP-based and RTP-Info based stream association
Both were entangled previously and very hard to follow what happens
under which conditions. Now as a very first step the code decides which
of the two cases it is going to apply, and then proceeds accordingly.
This also avoids calculating completely invalid values along the way and
even printing them int the debug output.

Also improve debug output in various places.

This shouldn't cause any behaviour changes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 7d0c7144ba rtpbin: Remove unused variable / function parameter
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 4421c3de75 rtpbin: Handle ntp-sync=true before everything else
This simplifies the code as it's a much simpler case than the normal
inter-stream synchronization, and interleaving it with that only
reduces readability of the code.

Also improve some debug output in this code path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 4b0e75a094 rtpbin: Add some documentation to gst_rtp_bin_associate()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge 70a435c0c4 rtpbin: Don't do any timestamp offsetting in rfc7273-sync=true mode
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1160

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Piotr Brzeziński 4612a6795a vtenc: Enable HEVC with alpha encoding
Adds a separate vtenc_h265a element (with a _hw variant as usual) for the HEVCWithAlpha codec type.
Decided to go with a separate element to not break existing uses of the normal HEVC encoder.
The preserve_alpha property is still only used for ProRes, no need for it here because we explicitly say we want alpha
when using the new element.

For now, the HEVCWithAlpha has an issue where it does not throttle the amount of input frames queued internally.
I added a quick workaround where encode_frame() will block until enqueue_frame() callback notifies it that some space
has been freed up in the internal queue. The limit was set to 5, which should be enough I guess? Hopefully this is not
too prone to race conditions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6664>
2024-05-28 10:53:25 +00:00
Piotr Brzeziński 2aa1f465e2 vtenc: Add missing vtenc_h265 docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6664>
2024-05-28 10:53:25 +00:00
Edward Hervey 39f62862d8 decodebin3: Ensure we get a collection for parsed inputs
When we are dealing with parsed inputs (i.e. using identity), we need to ensure
that we have a valid stream collection (and therefore DBCollection) before
anything flows dowsntream.

In those cases, we hold onto those events until we get such a collection.

Fixes #3356

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey daa022b9ee decodebin3: New mechanism for handling collection and selections
This commit separates collection and selections into a new separate structure:
DecodebinCollection.

This provides a much cleaner/saner way of dealing with collections being
updated, gapless playback, etc...

There is now a list of DecodebinCollection in flight, of which two are special:
* input_collection, the currently inputted/merged collection
* output_collection, the currently active collection on the output of multiqueue

Handling GST_EVENT_SELECT_STREAMS is split, by looking for the collection to
which it applies. And the requested streams are stored in it. IIF that
collection is output_collection we can do the switch, else it will be updated
when it becomes active.

Detecting which collection/selection is active is done by looking at the
GST_EVENT_STREAM_START on the output of the multiqueue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey c4b625a3fe decodebin3: minor refactoring to identify selected stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey bfb64f7f44 decodebin3: Debug line cleanups
Use identifiable items in log lines instead of random pointers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey 39f2d96105 decodebin: Remove unused includes
* config.h is not used, plugin/element is registered in another file
* play-enum.h is not used

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey 48cbb1c96f decodebin3: Remove un-needed variable
We don't do anything with the unknown streams. Detecting that a list of
requested streams don't apply to a given collection should be handled
before-hand

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey 3acb219b76 decodebin3: Remove un-needed variable
pending_select_streams was only set just before releasing/taking the selection
lock in a single place. That temporary lock release is not needed and therefore
the variable isn't needed either

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey 1ab0936196 decodebin3: Remove active_selection list
It's a duplicate of the list of slots which have an output. Use that instead.

Also when we fail to (re)configure an output, remove it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:17 +00:00
Edward Hervey ec468e9524 decodebin3: Cache slot stream_id and rename more variables
* Move the handling of GST_EVENT_STREAM_START on a slot to a separate function

* There was a lot of usage of `gst_stream_get_stream_id()` for the slot
active_stream. Cache that instead of constantly querying it.

* Rename the variables in `handle_stream_switch()` to be clearer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
2024-05-28 08:31:16 +00:00