Commit graph

119583 commits

Author SHA1 Message Date
Piotr Brzeziński a0b35d86f9 vtdec: Handle some errors without stopping the decoder
ReferenceMissingErr is not critical and the simplest solution is to just ignore it. The frame has
the FrameDropped flag set when it occurs, so we can just drop it as usual.
BadDataErr is also not immediately critical, but in its case let's set the ERROR flag,
so the output loop can use GST_VIDEO_DECODER_ERROR to count and error out if it happens too many times.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7044>
2024-06-17 14:53:08 +01:00
Sebastian Dröge a9beac80da av1dec: Don't treat decoding errors as fatal and print more error details
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7041>
2024-06-17 11:03:51 +01:00
Zach van Rijn af8a090201 pcapparse: Avoid unaligned memory access
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3602
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7037>
2024-06-14 18:55:20 +01:00
Mathieu Duponchelle 2015d56a41 rtspsrc: fix invalid seqnum assertions
Upon fatal errors the loop function will first post an error message
then push out an EOS event.

An application may react immediately to the error message by setting the
state of the pipeline to NULL, meaning by the time we push out the EOS
event PAUSED_TO_READY may have reset the seek seqnum to -1.

While this is harmless, the assertion when setting an invalid seqnum
isn't tidy, fix this by simply not resetting to INVALID as it serves no
practical purpose and the next READY_TO_PAUSED will select a new seqnum
anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7034>
2024-06-14 11:02:12 +00:00
Mathieu Duponchelle bb726c7eef codectimestamper: never set DTS to NONE
If we want to avoid the DTS going backward, then we can set DTS to
last_dts as a last resort.

Log a warning in this case

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7033>
2024-06-14 10:45:02 +01:00
Jakub Vaněk f4852a2d8b v4l2src: Interpret V4L2 report of sync loss as video signal loss
Certain V4L2 drivers can report that a video receiver is seeing
some signal, but that it is unable to synchronize to it. IOW: the driver
can sometimes report V4L2_IN_ST_NO_SYNC and not report V4L2_IN_ST_NO_SIGNAL.

In particular, I've seen the tc358743 (HDMI-to-CSI2 converter) driver
sometimes report this when deployed to a fleet of embedded Raspberry Pis.
The relevant kernel code is in [1]. The video output is not practically
usable when V4L2_IN_ST_NO_SYNC is reported (only visually corrupted frames,
sometimes with random "snow", are received). I assume that this happens when
either the HDMI cable is poorly plugged in or damaged or when a CSI2 FFC
cable is used and is damaged.

The change in this commit is useful for detecting this working-but-not-really
condition in application code. Applications already listening for the "Signal lost"
message will gain the ability to handle this condition.

There seem to be more V4L2 error flags like this, see [2]. However, I do not
have practical experience with them and adding only V4L2_IN_ST_NO_SYNC seems
like a safer option.

[1]: https://github.com/raspberrypi/linux/blob/be8498ee21aa/drivers/media/i2c/tc358743.c#L1534
[2]: https://www.kernel.org/doc/html/v6.6/userspace-api/media/v4l/vidioc-enuminput.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7027>
2024-06-13 09:30:51 +00:00
Khem Raj 3e319081f5 uvcgadget: Use g_path_get_basename instead of libc basename
Musl does not implement GNU basename and have fixed a bug where the
prototype was leaked into string.h [1], which resullts in compile errors
with GCC-14 and Clang-17+

| sys/uvcgadget/configfs.c:262:21: error: call to undeclared function 'basename'
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
|   262 |     const char *v = basename (globbuf.gl_pathv[i]);
|       |                     ^

Use glib function instead makes it portable across musl and glibc on
linux

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7a

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7028>
2024-06-13 01:18:29 +01:00
Sebastian Dröge 9a26c25211 av1enc: Handle force-keyunit events properly by requesting keyframes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7022>
2024-06-12 12:56:49 +01:00
Edward Hervey 2b79de8fc1 uridecodebin3: Don't hold PLAY_ITEMS lock when activating them
Once the item is configured it can be activated without holding that lock

Fixes #3610

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7020>
2024-06-11 19:19:38 +01:00
Edward Hervey c1ec23a75e decodebin3: Always ensure we end up with parsebin or identity
This fixes a regression introduced by 6c4f52ea20

There are cases where the input stream will be push-based, time-segment and not
have a collection nor caps. This means the event-based checks are not sufficient
to decide when/where to plug in a identity or parsebin to process the input.

For those corner cases we setup a buffer probe to ensure we always end up with
at least a parsebin

Fixes #3609

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7018>
2024-06-11 17:20:57 +01:00
Seungha Yang 9380f313c3 d3d12videosink: Disconnect window signal handler on dispose as intended
Fixing typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7014>
2024-06-11 10:14:33 +01:00
Edward Hervey d2fc7232e6 decodebin3: Avoid usage of parsebin even more
When dealing with push-based inputs, we are now delaying the creation of
parsebin/identity until we get all pre-buffer events.

We therefore can simplify the handling of new pads being linked and only have to
check if upstream can handle pull-based or not.

Avoids creating parsebin for parsed upstream data altogether

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6995>
2024-06-06 13:07:14 +00:00
Edward Hervey 175a3d17ba 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/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 230d0bf978 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/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey abb2a46787 decodebin3: minor refactoring to identify selected stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 3dbb9fbb39 decodebin3: Debug line cleanups
Use identifiable items in log lines instead of random pointers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 3014faaa2e 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/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey ccef8e18fd 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/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey b6e94cb779 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/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 33ee6c7d03 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/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 6d5d41b677 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/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 1fe3898904 decodebin3: Refactor slot/output (re)configuration
* Re-use existing function where possible
* Only set/reset keyframe probe at unique places

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey bf24f813d5 decodebin3: Refactor linking input to slot
The same sequence of calls was done when doing that

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 400b93e957 decodebin3: input_unblock_streams: Clarify variable
It's a list of pads, not slots

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey e18006f6da decodebin3: Rename multiqueue related functions
To make clear on what they apply

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey d6e2de985a decodebin3: Refactor/rename slot/output
* Centralize associating an output to a slot in one function, including properly
  resetting those fields
* Rename functions to be more explicit
* Move code to "reset" an output stream into a dedicated function (will be used
later)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 13407a11d6 decodebin3: Refactor removal of slot/output from streaming thread
The code was identical in several places

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey b6263febe0 decodebin3: rename/clarify eos and draining usage around multiqueue
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey 8794918607 decodebin3: Document/refactor DecodebinInput handling
* Rename the function names to be clearer, with prefixes
* Pass the input (or stream) directly where appropriate
* Document usage, inputs, ownership
* Rename variables for clarity where applicable
* Avoid double lock/unlock if callee can handle it directly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey a166cc6aea decodebin3: Move gstdecodebin3-parse.c into gstdecodebin3.c
Makes it easier to work with LSP

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey f168005e28 decodebin3: Refactor incoming collection handling
Simplify its usage by having it directly create the message if the collection
changed. This is what caller were always doing and avoids releasing selection
locks yet-another-time

Also use it in more places to avoid code repetition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey 12427d4119 decodebin3: Rename variable for clarity
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey 18fbe14ac8 decodebin3: Refactor GST_EVENT_SELECT_STREAMS handling
* The same code is used for the event, regardless of whether it's coming from
via a pad or directly on the element
* The pending_select_streams list content was never used, switch it to a boolean

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey dd01275e00 decodebin3: Don't forward select streams if we are handling it
Since the introduction of the "SELECTABLE" query, the usage of selection was
clarified. We don't need to forward the GST_EVENT_SELECT_STREAMS at this point.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey 38bae910ad gstpromise: Don't use g_return_* for internal checks
If assertion/checks are disabled bad things will happen and the function won't
return as expected

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6998>
2024-06-06 09:07:54 +00:00
Corentin Damman d81f7579fa gstqsg6material: fix RGB format support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6997>
2024-06-05 23:53:01 +01:00
Sebastian Dröge 300a8141e8 dtlssrtpenc: Don't crash if no pad name is provided when requesting a new pad
It is mandatory to provide a valid pad name for dtlssrtpenc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6994>
2024-06-05 10:10:03 +01:00
Sebastian Dröge cd4d040672 rtspsrc: Only update from the Content-Base header in the initial OPTION / DESCRIBE response
Some servers send a new content base in the SETUP response, which is
just the non-aggregate control URL of the individual streams.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3563

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Sebastian Dröge d263a8d2fe rtspsrc: Handle the case of * as session-wide control URL from the SDP
Just like the comment above says this is supposed to indicate that the
same URL should be used as for the connection so far. If encountering
this case simply do nothing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Sebastian Dröge 6f984939c4 rtspsrc: Also handle rtsps:// and similar URLs as absolute in other places
Previously a direct comparison with `rtsp://` was performed, which
didn't catch cases like `rtsps://`.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Sebastian Dröge dfc03b9a2e rtspsrc: Don't try the SETUP workaround for broken servers with absolute control URIs
Previously only control URIs that started with "rtsp://" were ignored
but it makes more sense to ignore all absolute URIs.

gst_uri_is_valid() conveniently checks for exactly that.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3563

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Martin Nordholts 03b6efcaf5 gst_debug: Add missing gst_debug_log_id_literal() dummy with gst_debug=false
E.g. gst_debug_log_literal() already has a dummy variant.
gst_debug_log_id_literal() is simply missing, which can
cause link errors for project using gstreamer with
gst_debug=false.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6979>
2024-06-01 11:52:32 +03:00
Samuel Thibault 8447c1d386 ptp-helper: Add GNU/Hurd support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6974>
2024-05-31 11:16:12 +03:00
Seungha Yang 5118e657b6 d3d12memory: Fix staging buffer alignment
Not all GPUs can support arbitrary offset of
D3D12_PLACED_SUBRESOURCE_FOOTPRINT when copying GPU memory between
texture and buffer. Instead of calculating size/offset per plane,
calculate the entire size and offsets at once.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6973>
2024-05-30 16:47:35 +03:00
Jakub Adam c305fe7a35 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/6962>
2024-05-30 08:35:17 +00:00
Edward Hervey 48f63a9c64 hlsdemux2: Minor refactoring of starting segment check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey 421832e506 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/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey e7ab454cf5 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/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey 12e8874f88 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/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey e9214e9afc 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/6961>
2024-05-30 07:59:25 +00:00