472 Commits

Author SHA1 Message Date
Thibault Saunier
0b745f67db videorate: Convert input ts to output scale to close segment
Otherwise we compare values that are in two different time scales.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9013>
2025-08-19 17:11:50 +00:00
Thibault Saunier
e697fe98eb videorate: Bring all timestamp in the runtime scale when applying rate to QoS
Otherwise the timescale won't match and we might end up with totally broken
QoS events.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9013>
2025-08-19 17:11:50 +00:00
Thibault Saunier
51d43529c3 videorate: Refactor so upstream/downstream time domains are properly decoupled
Refactor the videorate element to properly separate upstream and downstream
time domains when the `rate` property is set.

The previous implementation had issues with time domain conversions when
changing rates, especially during seeks after which we were basically confusing
input and output timestamps.

This also fixes rate changes as we are now tracking the wanted input timestamps
and not confusing them with the output, so this way we do not drop buffers when
the rate is changed while playing, meaning that the related tests have been
fixed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9013>
2025-08-19 17:11:49 +00:00
Thibault Saunier
242b4fa931 videorate: Handle the case where the base_ts is > qo.timestamp
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9013>
2025-08-19 17:11:49 +00:00
Thibault Saunier
d21c1f13d1 videorate: Do not fail setting caps on flushing pad
Avoiding to error out when flushing "at the wrong time" for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9013>
2025-08-19 17:11:49 +00:00
Jan Alexander Steffens (heftig)
e40a037b67 decodebin3: Update stream tags
parsebin does this, so should decodebin3.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9557>
2025-08-18 09:43:39 +00:00
Andrey Khamukhin
e94830c79d videorate: don't hold the reference to the buffer in drop-only mode
Pushing the buffer via gst_pad_push () in transform_ip () function
causes downstream elements to process the buffer with a reference
count > 1. This leads to performance issue if there are downstream
elements which modify the buffer memory.

However, in drop-only mode this reference is not required.

So, let GstBaseTransform push the buffer in drop-only mode.

Fixes #4258

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9532>
2025-08-13 08:47:27 +00:00
Nirbheek Chauhan
e8e12db5f4 debug: Category init should happen in class_init when possible
plugin_init() will not get called if element/feature registration
happens manually, such as when using linking only specific plugin
features with gstreamer-full. That is possible when plugins contain
static features.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9496>
2025-08-08 11:38:50 +05:30
Sebastian Dröge
8ea031b400 uridecodebin3: Add missing locking and NULL checks when adding URIs to messages
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4559

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9500>
2025-08-06 12:51:54 +00:00
Xavier Claessens
24356c099a audioconvert: Fix regression when using a mix matrix
This fixes regression introduced by commit da3a1011. When a mix matrix
is set, we still want to set the default channel-mask on output caps.

Fixes: #4579

Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9487>
2025-08-06 10:25:51 +00:00
Jan Schmidt
e653acc200 decodebin3: Don't error out for unknown streams in default selection
If there is only unknown stream-type streams in the current collection
don't post an error straight away. This fixes a problem with RTSP
cameras and legacy upstream collection building, if the first
stream that rtspsrc outputs is the ONVIF metadata track. That
happens often on bandwidth-constrained camera inputs, as the
video and audio will naturally take longer to arrive.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9433>
2025-08-04 06:14:00 +00:00
Sebastian Dröge
46df60ed1d Revert "streamsynchronizer: Consider streams having received stream-start as waiting"
This reverts commit a1a189c07cb66af06d7047c74f6421bd36e3d66c.

It breaks the uriplaylistbin tests and needs further investigation.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9309>
2025-06-30 09:26:29 +03:00
Xavier Claessens
472d528ffe audioconvert: Fix setting mix-matrix when input caps changes
When the number of input channels changes, application might have to set
a new mix-matrix. Application must set the new matrix before
audioconvert receives updated caps, otherwise negotiation would fail.
That means it should be allowed to set an invalid mix-matrix until we
receive new caps or next buffer.

This fixes a regression in GStreamer >=1.24.9 caused by:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7363

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9215>
2025-06-26 00:58:05 +00:00
Xavier Claessens
73d5b5b3db audioconvert: Replace g_warning with GST_WARNING_OBJECT
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9215>
2025-06-26 00:58:05 +00:00
Thibault Saunier
e799d79025 playsink: Fix race condition in stream synchronizer pad cleanup during state changes
Prevent race condition where gst_play_sink_do_reconfigure() could be called
from a pad probe while stream synchronizer pads are being released during
GST_STATE_CHANGE_PAUSED_TO_READY transition.

The race occurred when:
1. State change starts releasing stream synchronizer pads
2. Pads are unblocked earlier in the state change, allowing events to flow
3. A streaming thread triggers sinkpad_blocked_cb -> gst_play_sink_do_reconfigure
4. Reconfiguration tries to use already-released pad pointers
5. New pad creation fails with assertion in gst_pad_iterate_internal_links

The fix adds GST_PLAY_SINK_LOCK around the pad cleanup to ensure atomic
cleanup and prevent concurrent access during state transitions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9233>
2025-06-20 11:53:50 +00:00
Théo Maillart
b13fd1db7b urisourcebin: never manually store stream-start
The copy of the exact same stream-start event prevents the multiqueue's sink
event function from being called because it is already stored on both pads at
link time
The text streams are no longer considered sparse by the multiqueue, so
interleave calculation is broken and makes us consume a lot of ram and we can
end up killed by the kernel because of this

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8412>
2025-06-18 12:43:18 +00:00
Philippe Normand
3b896cd4ea encodebasebin: GstPad and GstStructure leak fixes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9167>
2025-06-04 13:39:06 +00:00
Philippe Normand
1d20fd15b0 encodebasebin: Make profile ownership explicit in StreamGroup
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9167>
2025-06-04 13:39:06 +00:00
Philippe Normand
3719b5b616 encodebasebin: Encoding profile ownership fixes
The profile argument passed to gst_encode_base_bin_set_profile is now
transfer-full. This issue was noticed after commit
6beb709d43d2023e7e5dc8f1ee1323bc28c9d1d8 which fixed profile refcount handling
in transcodebin.

Driving-by, an encoding profile leak was also fixed in _set_profile, in case
it's called for an already active element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9167>
2025-06-04 13:39:06 +00:00
Thibault Saunier
ad7c9ce478 glvideomixer, compositor: fix mouse event handling to properly return success
Fix mouse event handling in both glvideomixer and compositor to
check if upstream handled navigation events themselves.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9139>
2025-06-03 15:15:29 +00:00
Enrique Ocaña González
a1a189c07c streamsynchronizer: Consider streams having received stream-start as waiting
When using the custom WebKitMediaSrc element (used by WebKit and able to
perform an initial seek in playbin), a stall caused by streamsynchronizer
was detected during an initial seek. The flow of events revealed that the
intertwining of the initial configuration of the streams with the reset
caused by the flush events from the seek left streamsynchronizer in an
inconsistent state:

streamsynchronizer0:sink_0 (video) events, starting before the seek:
 stream-start --> Sets the stream to wait
 flush-stop --> Clears the stream wait flag
 caps
 tag
 segment
 stream-collection
 (buffers start to come and flow properly)

streamsynchronizer0:sink_1 (audio) events, happening after seek:
 (no flush events, because the stream hadn't been initialized when the seek happened)
 stream-start --> Sets the stream to wait
 caps
 segment
 (stalled because the stream is in wait mode!)

The code in streamsynchronizer expects that all the streams are in wait
state before releasing all of them at once. The flush on the video stream
broke that assumption and that's why the audio stream is never released in
that scenario.

Avoiding the clearing of the wait flag on flush-stop isn't an actual solution
to the problem, as it creates other side effects and at least makes the
gst-editing-services/seek_with_stop test to timeout. The alternate solution
implemented in this patch consists on analyzing if the other streams different
from the one newly added (after the flush) aren't waiting (which would mean
that they've all been unlocked after all of them were waiting before), and,
in that case, mark the new stream as also not waiting.

A new test_stream_start_wait test case has been added to demonstrate this
problem. The test case creates a video stream, pushes a buffer, then
simulates a seek by pushing flush-start, flush-stop, stream-start and segment
events. Note that the flush-stop clears the video stream waiting flag.
After that, a new audio stream is created and stream-start and new segment
events are sent. Note that stream-start will set the audio stream to wait.
Then a buffer is pushed on each stream. In the failing case, the test hangs.
In the working case (after this fix), the test runs properly because the
fact of having seen a stream-start also helps to clear the wait flag.

A second new test_stream_start_wait_sparse test has also been added to prove
that this mechanism can also work with sparse streams (a special case of the
current stream-start handling code). This test behaves like the previous one,
but there's no video buffer after the seek (it'll come in the future, as the
stream is sparse, but actually never comes). The buffer after the seek in the
audio stream starts at its due time. Streamsynchronizer is able to ignore
the wait for the video stream and produce audio buffers on time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4544>
2025-05-30 09:37:45 +00:00
Sebastian Dröge
edca7f83d1 subparse: Make sure that subrip time string is not too long before zero-padding
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4419
Fixes CVE-2025-47806

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9132>
2025-05-29 15:14:19 +00:00
Sebastian Dröge
9e2238adc1 subparse: Check for valid UTF-8 before cleaning up lines and check for regex replace errors
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4418
Fixes CVE-2025-47807

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9132>
2025-05-29 15:14:19 +00:00
Sebastian Dröge
6b19f11751 tmplayer: Don't append NULL + 1 to the string buffer when parsing lines without text
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4417
Fixes CVE-2025-47808

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9132>
2025-05-29 15:14:19 +00:00
Doug Nazar
75cf21d834 gstreamer: A few small memory cleanups
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9044>
2025-05-27 10:44:37 +00:00
L. E. Segovia
7b8d4c0974 orc: Update pregenerated files
Fixes -Wtype-limits on gstbayer.orc when emulating convuuslw.

Regenerated Orc files use OrcOnce, which increases the minimum version to 0.4.34.

See https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/212 (ORC_MIN)

See https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/238 (AVX2 convussql)

See 8a86d51753 (OrcOnce)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9067>
2025-05-25 14:36:17 +00:00
Thibault Saunier
feb3df61a7 debug: Use log contexts in some places
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6855>
2025-05-22 09:53:35 +00:00
Guillaume Desmottes
8f627b1f9c uridecodebin3: Don't hold play items lock while releasing pads
Releasing the pad can cause messages that call back into the message
handler of uridecodebin3 and take exactly the same lock again.

Fix #4443

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9032>
2025-05-21 14:43:08 +00:00
Sebastian Dröge
7ffbb1ce34 subtitleoverlay: Remove 0.10 hardware caps handling
This also reverts c02d41c2. videoconvert and videoscale are supposed to support
raw video with any caps features as long as no conversion is actually necessary,
and assuming they don't breaks usage of GstVideoOverlayCompositionMeta with e.g.
dmabuf or GL memory caps.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9020>
2025-05-21 13:07:51 +00:00
Sebastian Dröge
1c3bc57d00 videoconvertscale: Use new gst_meta_api_type_tags_contain_only() API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9004>
2025-05-21 12:13:56 +00:00
Doug Nazar
74f84484a2 videoconvertscale: Use correct variable size for gst_structure_get()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8975>
2025-05-18 11:03:59 +00:00
Doug Nazar
11dccf43e0 volume: Switch to GST_AUDIO_NE()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8984>
2025-05-14 14:45:55 -04:00
Doug Nazar
bf05a050e9 audiomixer: Switch to GST_AUDIO_NE()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8984>
2025-05-14 14:45:55 -04:00
Doug Nazar
af2b6b4c38 adder: Switch to GST_AUDIO_NE()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8984>
2025-05-14 14:45:55 -04:00
Jochen Henneberg
6f623af4d7 videorate: Revive 'new-pref' property
The 'new-pref' property sets the preference to use the new (next)
instead of the old (previous) buffer. The default is set to 0.5 to get
a similar behaviour as before the change.

Value 0.0 makes sure that only frames are shown where it's known that
the frame content is visible at that time, always show the old frame
until the new frame timestamp is reached.

Then, if the next buffer replaces the previous buffer the new buffer
is pushed as often as possible until PTS is reached. Before the new
buffer was only pushed once the new next buffer arrived.

Use GstClockTimeDiff because it's known that the current buffer time
is inside the time interval of previous buffer and next buffer the
calculation can be done with building absolute values. Special macros
are not needed here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8579>
2025-04-01 10:15:34 +00:00
Doug Nazar
12932ecc90 uridecodebin3: Free various props before being set
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8648>
2025-03-27 09:03:18 +00:00
Edward Hervey
235b0acd63 decodebin3: Don't avoid parsebin even if we have a matching decoder
This is too brittle, there is no guarantee that the input stream has been
properly parsed.

There is another check above (is_input_parsed) that will skip that if the
content came from `urisourcebin` and had a parser applied

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8641>
2025-03-14 09:40:35 +01:00
Tim-Philipp Müller
bd3aabbc25 videorate: add support for JPEG-XS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8601>
2025-03-13 00:11:52 +00:00
Edward Hervey
6454698f82 urisourcebin: Make parsebin activation more reliable
`parsebin` is potentially added by a `typefind` callback.

That `typefind` was activated by a `READY_TO_PAUSED` state change on `urisourcebin`

We want to ensure that it is the "setup_parsebin_for_slot" method that activates
the underlying `parsebin`, and not the external state-change.

Otherwise we would risk a potential deadlock where elements activating in
`parsebin`, and which would cause the upstream `typefind` to switch scheduling
mode, would not be able to acquire the STREAM_LOCK of the `typefind` task.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8511>
2025-03-12 16:15:20 +00:00
Thibault Saunier
ed693c7435 video: Give better names to buffer pools
Making debugging simpler

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8617>
2025-03-12 14:49:22 +00:00
Alyssa Ross
bfd995f9df tcpclientsrc, tcpserversrc: fix building for musl
musl only exposes struct tcp_info when _GNU_SOURCE is defined.

Fixes: b4bef7fd35 ("tcpclientsrc, tcpserversrc: fix tcp stats gathering")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8612>
2025-03-11 12:43:55 +01:00
Dongyun Seo
c206ddd930 playbin3: fix unlocking twice
fix unlocking playbin3 lock twice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8570>
2025-02-28 13:49:11 +00:00
Thibault Saunier
8162b4ec86 audiorate: Take the tolerance into account when filling gaps
The property is defined as:

> The difference between incoming timestamp and next timestamp must exceed
> the given value for audiorate to add or drop samples.

so if the gap duration < tolerance, we should not act.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8498>
2025-02-19 16:32:11 +00:00
Benjamin Gaignard
515e241b38 typefind: Add typefinder for AV1 obu/annexb raw streams
AV1 specification [1] define 2 AV1 raw bitstreams storage
formats without containers:
- OBU in chapiter 5.2
- Annexb in chapiter 11.

Implement a detection function for the both cases mostly
by testing OBU forbidden, type, has_size_field and reserved bits.
For annexb case testing if temporal unit size, frame unit size and
obu length are valid. If they are check that the first OBU is
a temporal delimiter.

[1] https://aomediacodec.github.io/av1-spec/av1-spec.pdf

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8502>
2025-02-18 13:01:13 +00:00
Sebastian Dröge
fb34f63835 uridecodebin3: Don't hold play items lock while activating source items
Activating them can cause messages that call back into the message handler of
uridecodebin3 and take exactly the same lock again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8215>
2025-02-18 09:14:59 +00:00
Sebastian Dröge
6e9a0c2229 videoconvertscale: Explicitly handle overlaycomposition meta caps feature
Otherwise it will be dropped unnecessarily. videoconvertscale can always pass it
through, no matter if it does conversion or not.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8431>
2025-02-14 18:44:33 +00:00
Michael Tretter
1a8143f721 videotestsrc: fix build if adder is disabled
The videotestsrc is not build if the adder plugin is disabled. This is a
copy/paste error introduced in Commit 3de86b2b9725 ("docs: port plugins to
explicit sources").

Fix the check to actually test the 'videotestsrc' option.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8399>
2025-02-03 18:57:34 +00:00
Jochen Henneberg
73c61784d4 audiorate: Account for in buffer samples if fill samples are added
If fill buffers are added to compensate for missing samples the input
buffer is pushed as well and has to be added to output samples count.

This ensure that add - drop == out - in.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8358>
2025-01-24 09:12:50 +01:00
Thibault Saunier
aa78649635 videoconvertscale: Handle large pixel aspect ratios
Some pixel aspect ratios found in dash streams have very large numerators and
denominators (while being close to 1:1). These values can cause integer overflow
during multiplication, leading to negotiation failures.

Add fallback path using gdouble when integer multiplication would overflow,
trading some precision for reliability instead of failing outright.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8262>
2025-01-17 15:13:14 +00:00
Mathieu Duponchelle
3de86b2b97 docs: port plugins to explicit sources
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8273>
2025-01-13 19:17:13 +01:00