Commit graph

397 commits

Author SHA1 Message Date
Edward Hervey
09be1ab863 urisourcebin: Also use event probe for HLS use-cases
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3957

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7822>
2024-11-08 09:14:21 +00:00
Jan Schmidt
c02d41c259 subtitleoverlay: Check for memory capsfeature on video/x-raw
Don't assume that video/x-raw caps means buffers are mappable
or can be processed by videoconvert and friends. Only plug
those converters for real system memory, and treat other
memory capsfeatures as hardware surfaces

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7741>
2024-10-30 06:13:23 +00:00
Edward Hervey
39c770af90 playback: Improve stream list search
There is the possibility than an element/code/helper creates an identical
`GstStream` (same type and stream-id) instance instead of re-using a previous
one.

For those cases, when detecting whether a `GstStream` is already present in a
collection, we need to do more checks than just comparing the pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7716>
2024-10-28 10:09:47 +00:00
Edward Hervey
0fda426656 urisourcebin: Aggregate collections from multiple parsebin
In the case where multiple parsebin are present (ex: from rtsp sources), we want
to aggregate the collections provided by the different parsebin and expose a
single "unified" collection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7716>
2024-10-28 10:09:47 +00:00
Edward Hervey
a26984a72b parsebin: Store caps on parsepad as early as possible
When analyzing a new pad, we can store the updated caps on the GstStream if they
are fixed.

If they are not fixed, this function will be called again once the element will
provide them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7716>
2024-10-28 10:09:47 +00:00
Edward Hervey
3fdfef15a1 parsebin: Don't store bogus caps on GstStream
If we can't get the current caps when receiving a stream-start, that's fine,
they can/will be provided by other means at a later time.

What we definitely should not do is provide the starting caps of the chain,
which are potentially completely different from the end ones (like for example
`application/x-rtp`)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7716>
2024-10-28 10:09:47 +00:00
Edward Hervey
1814aec0d5 parsebin: Minor debug statement updates
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7716>
2024-10-28 10:09:47 +00:00
Philippe Normand
cec3c15fc5 encodebasebin: Fix parser selection
If an encoder supports multiple codecs (a bin wrapping/auto-plugging encoders)
then its src pad template caps might list the supported codecs. Without this
patch the selected parser would be the one corresponding to the first codec,
leading to caps negotiation error later on. The proposed fix is to check the
media type on the parser candidates sink pad templates according to the
requested encoded format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7670>
2024-10-26 09:50:42 +00:00
Philippe Normand
080b94b5e6 encodebasebin: Fix parser cleanup
When removing the parser from the stream group, it might not be linked to a
combiner so this needs to be checked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7670>
2024-10-26 09:50:42 +00:00
Sebastian Dröge
073831128b uridecodebin3: Remove "source" property
There is not necessarily a single urisourcebin inside uridecodebin3 so having a
single source property makes little sense. Additionally, this property was never
hooked up at all and always returned NULL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7712>
2024-10-23 12:29:06 +00:00
Tim-Philipp Müller
f5169670bc playback: remove mention of gconf sinks from playbin docs
Fixes #3916

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7676>
2024-10-19 06:12:14 +00:00
Edward Hervey
189cbe7fdd urisourcebin: Don't remove probe if not present
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
2024-10-18 08:49:50 +00:00
Edward Hervey
b2c0f490f0 urisourcebin: Set pad probe before linking pad
We want to grab all events that pass through, so we need to set the
probe **before** the pad is linked

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
2024-10-18 08:49:50 +00:00
Edward Hervey
c97126212f urisourcebin: Streamline event forwarding code
Instead of two different functions for copying events and rewriting the
stream-start event, just have a single one.

This is needed, since we want to do both of those in one go, with the pad lock
taken.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
2024-10-18 08:49:50 +00:00
Edward Hervey
f130382b08 parsebin: Set stream collection on pad before exposing it
We want to ensure the stream-collection is present on the pad (as a sticky
event) before we expose the pad.

This is more reliable since it will ensure it is present before any other event
is pushed through.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
2024-10-18 08:49:49 +00:00
Edward Hervey
cb25b1e95e uridecodebin3: Use lock when checking input/output items
Otherwise there is the risk that the play items list could have changed in
between

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
2024-10-18 08:49:49 +00:00
Edward Hervey
e1e48b9fea decodebin3: Free pending events on input pads when unlinking
Otherwise we could end up with *old* events leaking through on the next linking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
2024-10-18 08:49:49 +00:00
Ruben Gonzalez
dc4dd415f0 typefind: Add typefinder for VVC/H.266
H.266 NAL unit header syntax [1] is similar to H.265 NAL unit header syntax[2]:

```
              H.265                               H.266
+---------------+---------------+   +---------------+---------------+
|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|   |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|F| NALType   | LayerId   | TID |   |F|U| LayerId | NALType   | TID |
+-------------+-----------+-----+   +-------------+-----------------+

Where

* F: `forbidden_zero_bit`: f(1)
* U: `nuh_reserved_zero_bit`: u(1) only H.266
* LayerId: `nuh_layer_id`: u(6)
* NALType: `nal_unit_type`: u(6) in H.265 and u(5) in H.266
* TID: `nuh_temporal_id_plus1`: u(3)

```

NAL unit types have different values:

| NALType  | H.265                              | H.266                     |
|----------|------------------------------------|---------------------------|
| VPS      | HEVC_NAL_VPS(32)                   | VVC_VPS_NUT(14)           |
| SPS      | HEVC_NAL_SPS(33)                   | VVC_SPS_NUT(15)           |
| PPS      | HEVC_NAL_PPS(34)                   | VVC_PPS_NUT(16)           |
| IRAP     | BLA_W_LP(19)..HEVC_NAL_CRA_NUT(21) | IDR_W_RADL(7)..CRA_NUT(9) |

Implementation of `h266_video_type_find` is based on `h265_video_type_find` with
next differences:

- NAL unit header syntax for H.265 and H.266
- Diff NAL unit types values
- Avoid checking nuh_layer_id is zero.  H.266 conformance test suite[3] contains examples with more than one layer.

This typefind was tested with H.266 conformance test suite [3]. Also, with the help of fluster[4],
with H.264 and H.265 conformance test suites to avoid regresions. Pending test vectors to fix:
- 8b422_H_Sony_4
- DEBLOCKING_E_Ericsson_3

[1] https://www.itu.int/rec/T-REC-H.266
[2] https://www.itu.int/rec/T-REC-H.265
[3] https://www.itu.int/wftp3/av-arch/jvet-site/bitstream_exchange/VVC/draft_conformance/draft6/
[4] https://github.com/fluendo/fluster/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7339>
2024-10-14 16:36:46 +02:00
Ruben Gonzalez
5d25ab1306 misc: fix grammar mistake
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7339>
2024-10-14 16:36:25 +02:00
Théo Maillart
aaf9b46e2f decodebin3: do not attempt to remove a null stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7586>
2024-10-03 07:08:37 +00:00
Théo Maillart
4065ac5dcb decodebin3: protect internal reset with SELECTION_LOCK
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7586>
2024-10-03 07:08:37 +00:00
Théo Maillart
ed264d64b0 decodebin3: remove output event probe on remove input stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7586>
2024-10-03 07:08:37 +00:00
Edward Hervey
b21ffc6b9f urisourcebin: Ensure all stream-start are handled
In order to ensure all initial events (stream-start, caps, ..) are present on
pads that we expose, those various sticky events are propagated (from parsebin
to multiqueue output, from multiqueue output to exposed pads).

The problem was that the "hack" in `urisourcebin` to inform downstream elements
that the stream is parsed data and a collection will be present was only done in
one place : a probe on the output of parsebin ... but the stream-start could
potentially have already been propagated to the output pads before that.

In order to fix that, we make sure any pending sticky stream-start event is
updated before being propagated.

Fixes #3788

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7598>
2024-10-02 21:29:00 +00:00
Edward Hervey
32bf29d64d urisourcebin: Allow more cases for posting stream-collection
Previously urisourcebin only allows stream-collections messages from adaptive
demuxers or sources to be posted.

This commit also allows the case where they come from a single parsebin. We
still want to prevent it in the case where they are multiple parsebins, since
that would require some form of aggregation to show a single/unified collection.

In order to avoid a regression with uridecodebin3 behavior, we also implement
support for GST_QUERY_SELECTABLE, so that uridecodebin3 can figure out whether
it should let GST_MESSAGE_STREAM_COLLECTION flow upwards (because app/user could
react on it) or whether it drops it in order for decodebin3 to do the collection
aggregation and posting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7597>
2024-10-02 19:40:48 +00:00
Edward Hervey
9a59fc7168 decodebin3: Make update/posting of collection messages atomic
The presence (or not) of a collection on an input will determine whether events
will be throttled so that there are only forwarded when that input gets a valid
collection.

Therefore the input lock should be used.

In addition to that, we want to ensure that the application/user has a chance to
reliably (i.e. synchronously) specify what streams it is interested in by
sending a GST_EVENT_SELECT_STREAMS.

But we cannot allow anything to go forward until that message posting has come
back, otherwise we run in various races.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7594>
2024-10-02 18:50:06 +00:00
Elliot Chen
6c830c5bd3 decodebin3: check and send selected stream message even if no decoder is selected
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7579>
2024-10-02 10:21:56 +00:00
Sebastian Dröge
275134c883 base: audio: video: Use more efficient caps/structure API in various places
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432>
2024-09-26 19:26:18 +03:00
Sebastian Dröge
b7b24573ce common: Use more efficient versions of GstCapsFeatures API where possible
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432>
2024-09-26 19:26:18 +03:00
Sebastian Dröge
6233eb0ff3 common: Stop using GQuark-based GstStructure field name API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432>
2024-09-26 19:21:29 +03:00
Sebastian Dröge
0c1611d31d common: Stop using GQuark-based GstStructure name API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432>
2024-09-26 19:21:29 +03:00
Diego Nieto
dcfc66a1ac fakevideodec: fix minimum allocation pool size
Before it was setting the minimum between 2 and the minimum gst_query_parse_nth_allocation_pool(). So, always
giving 2 or less.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7465>
2024-09-09 19:37:45 +00:00
Tim-Philipp Müller
3beb06952e gst-plugins-base: use g_sort_array() instead of deprecated g_qsort_with_data()
Fixes compiler warnings with the latest GLib versions.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4127

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7384>
2024-09-02 22:31:34 +00:00
Edward Hervey
ea59c921d6 decodebin3: Fix collection identity check
Collections can be auto-generated from upstream and yet have exactly the same
streams in it.

Therefore do a more in-depth check for equality.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7401>
2024-08-22 09:27:02 +00:00
Mathieu Duponchelle
25f3ab2e6c audioconvert: handle new GstRequestMixMatrix custom upstream event
An example use case is the gstwebrtc-api demo, which will cause
webrtcsink to forward such events. This lets the end user define a mix
matrix without requiring any application code server side.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7363>
2024-08-20 17:05:49 +00:00
Mathieu Duponchelle
fd90d7bdee audioconvert: fix setting of mix matrix at run time
There were two main issues:

The mix matrix was not protected with the object lock

The code was mistakenly assuming that after updating the mix matrix
a reconfigure event sent upstream would be enough to cause upstream to
send caps again, and the converter was only reconstructed in ->set_caps.

That was not actually enough, as if the new matrix didn't affect the
number of input / output channels there was no reason for upstream to do
anything after getting the unchanged caps.

The fix for this was to have ->transform also recreate the converter
when needed, with the added subtlety that depending on the mix matrix
the element could be set to passthrough. This means that when setting
the mix matrix the converter also had to be recreated immediately to
check if the element had to be switched back to non-passthrough.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7363>
2024-08-20 17:05:49 +00:00
Edward Hervey
de6de83986 urisourcebin: Actually drop EOS on old-school pad switch
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7375>
2024-08-19 09:49:12 +02:00
Edward Hervey
7546975856 urisourcebin: Don't hold lock when emitting about-to-finish
This could trigger actions that re-enter this element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7368>
2024-08-17 05:50:26 +00:00
Edward Hervey
701165227f decodebin3: Remove custom EOS handling
Initially introduced in 2017 by 4fcbcf4e48 (and
follow up commits) and ec7d81f67c

See https://bugzilla.gnome.org/show_bug.cgi?id=773341 and
https://bugzilla.gnome.org/show_bug.cgi?id=792693 for more details.

This was made to support the legacy behaviour of adaptive demuxers (regarding
streams added/removed dynamically).

Since then, a lot of things have changed in decodebin3 and related elements
regarding how dynamic streams are handled and this custom behaviour is no longer
needed.

This also removes weird behaviours like EOS being delayed until *all* streams
were EOS, which could cause deadlocks downstream.

Fixes #3666

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7194>
2024-08-16 13:26:14 +00:00
Alicia Boya García
9b0e951512 streamsynchronizer: Add documentation
I didn't find the behavior and purpose of streamsynchronizer documented
or intuitive. Eventually I got Edward to explain it to me, which was
very helpful. Now I'm contributing some docs so that the next person
doesn't have to figure it out by asking around and hoping for an answer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7084>
2024-08-14 13:55:37 +00:00
Philippe Normand
bd64374174 parsebin: accept-caps handling for elements with unusual pad names
In case the last element of the parse chain doesn´t have a sink pad named
"sink", send the accept-caps query to the first sink pad of the element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7255>
2024-07-29 12:41:33 +00:00
Shengqi Yu
df28aceb49 videoscale: correct classification error
videoscale does not have convert function, so remove the convert
description in it's classification. Otherwise, if we want use
autovideoconvert to convert colorsapce, autovideoconvert will select
videoscale to do convert and this will cause to fail.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7215>
2024-07-25 05:42:25 +00:00
Sebastian Dröge
a7bba83ded typefind: Add typefinders for formats that were previously available via ffmpeg
Co-Authored-By: Matthew Waters <matthew@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6505>
2024-07-08 14:31:39 +00:00
Tim-Philipp Müller
6cc25bd630 subparse: remove regex optimized flag explicitly
That way the other flags in jit_flags are not touched and
flags changes in future only need to be done in one place.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7126>
2024-07-03 03:46:19 +00:00
Edward Hervey
01b397601f subparse: Don't use jitted regex when used with valgrind
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7117>
2024-07-02 09:44:25 +02:00
George Hazan
9e1abc0797 parsebin: fix compilation problem with Visual C++ 2017
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7089>
2024-06-22 20:56:03 +03:00
Edward Hervey
11ff2b2835 decodebin3: Fix keyframe drop probe handling
We were storing the probe id in a different structure (DecodebinOutputStream)
than the pad it is targetting (which is in MultiQueueSlot).

The problem is that when re-targetting outputs (to a different slot)... we would
end up having an invalid probe id, or not have a reference to an existing one.

Instead, store the probe id in the same structure as the pad it's targetting

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7069>
2024-06-20 12:56:46 +00:00
Edward Hervey
6aa0c8442d decodebin3: Fix detection of selection done
We should not assert if there are still some old streams that are waiting to be
deactivated.

Instead wait for them to be gone before posting the selection done message

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7069>
2024-06-20 12:56:46 +00:00
Alicia Boya García
223b63b1d2 decodebin3: Add missing INPUT_LOCK() before ensure_input_parsebin()
ensure_input_parsebin() has a top comment saying it must be called with
INPUT_LOCK taken, but 2 out of 3 usages of the function call it without
taking that mutex.

This patch adds locking in these two remaining usages.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5279>
2024-06-17 10:15:28 +00:00
Edward Hervey
c5a39f2dfa 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/7015>
2024-06-11 16:42:27 +00:00
Edward Hervey
74dbbe0091 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/7010>
2024-06-11 14:57:34 +00:00