Commit graph

4287 commits

Author SHA1 Message Date
L. E. Segovia
d81b7b1cdb cargo_wrapper: Fix mismatched quotes causing SyntaxError
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2471#note_3077591

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2529>
2025-08-29 20:07:00 -03:00
Mathieu Duponchelle
9738c10ff0 textaccumulate: fix typo (latency != lateness)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2528>
2025-08-29 22:16:54 +02:00
Mathieu Duponchelle
ebc943e54c textaccumulate: add mechanism for recalculating timeout ..
.. when queue fills again

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2528>
2025-08-29 22:16:54 +02:00
Mathieu Duponchelle
22168549fa textaccumulate: drain to last match on timeout
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2528>
2025-08-29 22:16:54 +02:00
François Laignel
83d16a1cca threadshare: separate blocking & throttling schedulers
Rationale:

* Detecting whether current thread uses a throttling or blocking scheduler
  is now immediate instead of relying on a sentinel name.
* Each scheduler can be optimized for its purpose.
* Blocking scheduler can now be reused saving a few CPU cycles entering
  and leaving.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2526>
2025-08-29 15:45:31 +02:00
François Laignel
e92250847d threadshare: standalone examples: log stats on EOS
... not on stop as it added extra noise to the parked duration report.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2524>
2025-08-29 11:20:22 +02:00
Sebastian Dröge
8807eefd32 deny: Update
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2520>
2025-08-29 07:08:02 +00:00
Sebastian Dröge
2716e46593 threadshare: Fix build on non-Solaris/Darwin UNIXes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2515>
2025-08-29 09:33:27 +03:00
L. E. Segovia
611bb49b40 threadshare: Fix missing Darwin platform compatibility
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2515>
2025-08-28 20:48:28 -03:00
L. E. Segovia
8ba691f085 threadshare: Fix compatibility with getifaddrs 0.5
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2515>
2025-08-28 20:48:28 -03:00
François Laignel
ac86e0590e threadshare: standalone rtprecv example: fix deadlock
Consider the following sequence:

1. The pipeline is being started. This occurs under the main thread.
2. A source just pushed a buffer. This occured under a ts-Context thread, let's
   call it ts-ctx-1.
3. The above buffer reaches `rtprecv`, which creates a src pad, which calls the
   'pad-added' callback (under ts-ctx-1).
4. The 'pad-added' callback adds elements, link them and sync their state with
   the pipeline (under ts-ctx-1).

A deadlock can occur if:

A. The pipeline on-going starting process picks an element that was just added
   by `pad-added`, but not synced yet => the pipeline acquires the element's
   mutex (under the main thread).
B. 'pad-added' reaches `sync_with_parent()` for the element => tries to acquire
   the element's mutex (under ts-ctx-1).
C. The `prepare()` method for the element attempts to spawn a ts-Task on
   ts-ctx-1, which is blocked. So the ts-Task spawned notification is not
   triggered.
D. Because the `prepare()` method was executed on the main thread, which is not
   a ts-Context thread, the ts-Task spawned notification is awaited
   synchronously. So the element state transition is blocked, keeping the
   element mutex, keeping ts-ctx-1 blocked.

I couldn't find an easy way to automatically detect these conditions. The
workaround here is to use a different ts-Context for the elements which are
added in 'pad-added', their ts-Tasks will be spawned on a ts-Context which can't
to be blocked by the starting process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2518>
2025-08-28 21:45:49 +02:00
François Laignel
f553bd6495 threadshare: standalone examples: more improvements
* Only set `num-buffers` on the main source (the one that logs statistics).
  Previously all sources would push `num-buffers` so the last 5s were excluded
  from stats because some elements would start stopping before the main source
  which would cause outliers. All sources now keep pushing buffers until the
  main has logged the global stats & request the pipeline to shut down.
* Log when all sinks have received the Segment event. This helps identify
  deadlocks in some branches. When EOS is received a log warns if not all
  sinks notified they received the Segment event.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2518>
2025-08-28 21:45:49 +02:00
François Laignel
d976d2e376 threadshare: fix resources not available when preparing asynchronously
[MR 2494] introduced `task::TransitionStatus::block_on_or_add_subtask_then()`
which allows executing a function after the transition succeeds or fails,
whatever the executor being used.

In that MR, I moved the resource assignments into that function in `prepare()`,
the reasoning being that if the Task transition failed, the resources would be
useless. Examples for such resources include: dataqueues, channel senders, etc.

This was actually a bad idea: if the transition happens asynchronously, the
state change can complete and buffers can start flowing before the transition
completes, leading to resources not being available, while they will be a
moment later and could have buffered the incoming items.

This commit reverts the resource assignments before the Task transition requests
for those handled by `prepare()`.

[MR 2494]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2494

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2517>
2025-08-28 21:02:25 +02:00
Mathieu Duponchelle
d59485ed5e aws/polly: downgrade log level on queries
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2510>
2025-08-28 17:03:01 +00:00
Mathieu Duponchelle
7fd461fd24 aws/polly: fix gap forwarding as with 11labs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2510>
2025-08-28 17:03:01 +00:00
Mathieu Duponchelle
a162b82b73 aws/polly: bring in shift forward logic from 11labs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2510>
2025-08-28 17:03:00 +00:00
Mathieu Duponchelle
98eec93dd5 elevenlabssynthesizer: fix debug
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2510>
2025-08-28 17:03:00 +00:00
François Laignel
e480aebcf2 threadshare: runtime/pad: lower log level pushing Buffer to flushing pad
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2512>
2025-08-28 17:20:46 +02:00
Sebastian Dröge
5525a2b80a Revert "analytics: Ignore some tests that fail due to core changes until fixed"
This reverts commit 8765480d60.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2444>
2025-08-28 14:30:12 +00:00
Sebastian Dröge
817d923459 analyticscombiner: Use NULL caps instead of EMPTY caps in the array for streams with no caps
EMPTY/ANY caps are not considered fixed caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2444>
2025-08-28 14:30:12 +00:00
Sanchayan Maity
fe23979a9a Switch reqwest to use rustls
We need to specify the rustls dependency explicitly configured with the
required feature/provider which in this case is ring. Without this the
selection of TLS back end can fail for HTTPS as rustls crate mandates
that either of ring or aws-lc-rs be selected explicitly via feature
flags or code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2500>
2025-08-28 18:42:09 +05:30
Olivier Crête
020efadd1f meta: Updated for GstMetaTransformCopy::new
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2508>
2025-08-28 15:28:57 +03:00
Sebastian Dröge
f953914238 deny: Update
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2508>
2025-08-28 15:22:09 +03:00
Sebastian Dröge
bc0c1960cf Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2508>
2025-08-28 15:22:09 +03:00
Sebastian Dröge
ec4f00fa05 threadshare: Update to getifaddrs 0.5
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2503>
2025-08-28 09:53:34 +00:00
Robert Mader
6f40cb0430 gtk4: Add 10/12/16bit SW decoder formats
See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8330

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2408>
2025-08-28 09:17:46 +00:00
Sebastian Dröge
2876943bde mp4: Skip tests using x264enc if it does not exist
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/723

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2499>
2025-08-28 08:07:14 +00:00
Sanchayan Maity
788781e915 speechmatics: Specify rustls as an explicit dependency
Commit b01829ac3 switched speechmatics use of async-tungstenite to
rustls. However, this resulted in an error like below.

```
Could not automatically determine the process-level CryptoProvider from Rustls crate features.
Call CryptoProvider::install_default() before this point to select a provider manually, or make sure exactly one of the 'aws-lc-rs' and 'ring' features is enabled.
See the documentation of the CryptoProvider type for more information.
```

rustls crate requires that a specific provider be selected explicitly
by installing the provider manually which would require a code change
or specifying as an explicit dependency with the ring feature enabled.
Fix this by opting for the latter approach.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2502>
2025-08-28 11:59:16 +05:30
Mathieu Duponchelle
2732b0e543 text: implement new textaccumulate element
The code was lifted from the accumulator in `awstranslate`, this element
can be used to accumulate words and punctuation into complete sentences
(or sentence fragments) for synthesis and / or translation by further
elements downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2350>
2025-08-27 19:28:41 +02:00
Mathieu Duponchelle
18703abc0d translationbin: use textaccumulate element before tee
awstranslate no longer performs text accumulation, we can now do it only
once instead of once per translation language.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2350>
2025-08-27 17:30:35 +02:00
Mathieu Duponchelle
cfe167d2e1 awstranslate: remove text accumulation feature
Users should now place a `textaccumulate` element in front of the
translator in order to achieve the previous behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2350>
2025-08-27 17:30:35 +02:00
Sanchayan Maity
b01829ac35 speechmatics: Use rustls for async-tungstenite
We need to use rustls as without this, using rustls with
async-tungstenite fails to build in net/webrtc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2487>
2025-08-27 18:17:21 +05:30
Sanchayan Maity
83ed0bed76 webrtcsink: Fix typo in doc comment for web-server-path
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2487>
2025-08-27 18:17:21 +05:30
Sanchayan Maity
bbfe378e33 webrtc: Migrate to warp 0.4 and switch to tokio-rustls
warp 0.4 dropped support for TLS. tokio_native_tls seems unmaintained
along with which our use of PKCS#12 was problematic. See the below two
issues.

- https://github.com/sfackler/rust-native-tls/issues/27
- https://github.com/FiloSottile/mkcert/pull/58#issuecomment-451782395

PKCS#12 is also completely unusable on any modern system failing with
the error referenced in the below issue.
- https://github.com/tokio-rs/tls/issues/152

While this is a breaking change from the point of view of PKCS#12 not
being usable any more, use of PKCS#12 meant none of the TLS stuff has
been functional for the signalling server anyway.

We already depend on rustls one way or another and async-tungstenite
also supports rustls. Switch to tokio-rustls/rustls for TLS usage.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/715
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2487>
2025-08-27 18:17:20 +05:30
Sanchayan Maity
c3890ffa4e webrtcsink: Fix uri and cafile property setting for signaller
When run-signalling-server is true, if a certificate is provided,
signaller uri should use wss and the cafile property should also
be set to use this certificate.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/633
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2487>
2025-08-27 16:26:43 +05:30
Sanchayan Maity
69d4a2bbdc webrtc: Update the documentation for using embedded web services
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2487>
2025-08-27 16:26:43 +05:30
Mathieu Duponchelle
7f0ec3e87c elevenlabssynthesizer: improve gap handling in non-clip overflow modes
In these modes, we might output audio with a longer duration than the
input text. Take this into account when forwarding gaps, if at all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2493>
2025-08-27 09:29:26 +00:00
François Laignel
c1e9d034bc threadshare: fix ts-inter test one_to_one_up_first
The test has been seen failing on CI a couple of times. I ran it 5000 times
locally without failure. This commit attempts to prevent CI from failing by
waiting for the latency event then start counting 10 buffers before checking
the resulting latency.

Also fix confusing naming for the latency field in `InterSrc`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2497>
2025-08-26 22:09:14 +02:00
François Laignel
3fec94a234 threadshare: examples: add a new benchmark program
This new example is built upon the existing `ts-standalone`:

* `ts-standalone` allows focusing on the overhead of threadshare specific
  constructs. It uses a very light source element because buffer content is not
  the concern in this case.
* `ts-standalone-rtprecv` aims at simulating a closer to real world use case:
  it uses `ts-audiotestsrc` and `rtprecv`. `rtprecv` can push buffers either
  from the upstream thread or from a blocking thread. Note that this example
  intentionally drops buffers so `rtprecv` can exhibit both behaviours.

Reminders:

* Use `GST_DEBUG=ts-standalone*:4` to display statistics.
* Compile with `--release`.
* Compile with `--feature tunning` to get stats about the duration the
  Throttling Scheduler at the sink spent parked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2496>
2025-08-26 20:19:20 +02:00
François Laignel
0f87d52d0d threadshare: always use block_on_or_add_subtask
Some state transitions relied on `block_on`, which caused a panic due to an
attempt to block while runing on a `Context` in the following situation:

* Upstream runs on a `Context`.
* Current threadshare element state is sync on parent in a `pad-added`
  callback.

This commit:

* Uses `block_on_or_add_subtask` in all call sites where `block_on` was used.
* Renames `task::TransitionStatus::await_maybe_on_context` as
  `block_on_or_add_subtask()`. Previous name didn't make it explicit it could
  block. The new name matches the similar function in `executor`.
* Implements a new `block_on_or_add_subtask_then()` on `task::TransitionStatus`.
  Compared to `block_on_or_add_subtask()`, it will also execute the provided
  function after the transition occured or failed, whathever the executor being
  used.
* Remove `task::TransitionStatus::block_on` as private: it shouldn't be used in
  user code (it's still used in unit tests though).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2494>
2025-08-26 18:48:55 +02:00
Robert Mader
5d976540b3 gtk4: Try importing dmabufs withouth DMA_DRM caps
If an upstream elements uses dmabufs - and supports the videometa -
but negotiated sysmem caps, try to use the dmabuf texture builder
for direct GPU buffer imports.

This is notably the case if a udmabuf allocator is used, but also
if elements support dmabufs but do not yet support the DMA_DRM API.
An example for the later is Snapshot on phones. On one hand its
current implementation around camerabin makes using DMA_DRM caps hard
without breaking capturing with software encoders, while on the other
hand importing buffers with GL/VK not only avoids a buffer upload/copy,
but also `DMA_BUF_IOCTL_SYNC` calls, which are potentially expensive
on aarch64. Finally importing dmabufs potentially allows offloading to
display planes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2490>
2025-08-24 16:45:23 +02:00
Robert Mader
b2ae5dfa54 gtk4: Add debug logs for frame type
Since commit 7b561354 it is easy - and helpful for development
and debugging.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2490>
2025-08-23 17:06:17 +02:00
r4v3n6101
de26c2d58b rtmp4gdepay2: fix condition while creating parser
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2441>
2025-08-22 08:05:33 +00:00
François Laignel
db8dabf195 threadshare: update examples
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2484>
2025-08-20 18:05:08 +02:00
Thibault Saunier
9dcb2afaf7 cargo_wrapper: Fix depfile generation for binaries and add debug logging
The depfile generation was only handling lib.rs files, missing main.rs
files used by binary crates. This caused incomplete dependency tracking
for binary targets.

Also added debug logging to help diagnose issues with Cargo.toml
detection and stripped whitespace from source paths to handle parsing
edge cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2471>
2025-08-20 06:51:33 +00:00
Thibault Saunier
738de23ef8 cargo_wrapper: Ignore stale dep files from previous branch builds
When switching between branches that have different plugins or dependencies,
stale .d files from the previous branch can cause cargo to be unnecessarily
invoked on every build, even when no actual changes have been made.

This fix checks the modification time of dependency files against the current
build start time and ignores any .d files that weren't generated during the
current cargo run. This prevents spurious rebuilds when switching between
branches with different plugin configurations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2471>
2025-08-20 06:51:33 +00:00
Thibault Saunier
c1712113a9 cargo_wrapper: Fix log file name
We were using the same log files for bins and plugins

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2471>
2025-08-20 06:51:33 +00:00
Thibault Saunier
04e9660c26 cargo_wrapper: Reindent and cleanup
This commit should go into a new .git-blame-ignore-revs file when we have the
final hash

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2471>
2025-08-20 06:51:33 +00:00
Tim-Philipp Müller
01b8303b5c threadshare: blocking_adapter: fix Since marker in docs
Should be 0.14.2 since it has been backported to the 0.14 branch.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2479>
2025-08-20 06:21:17 +00:00
François Laignel
829cc21696 threadshare: inter: update doc example
Use recent improvements:

* `ts-audiotestsrc` can now be used properly.
* `ts-blocking-adapter` must be used before a blocking element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2477>
2025-08-19 16:49:24 +02:00