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>
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>
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>
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>
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>
Allow the use of a single file for media. Media playlist will use byte
range tags like below while referencing the same single media file.
```
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="main.mp4",BYTERANGE="768@0"
#EXT-X-BYTERANGE:198120@768
#EXTINF:10,
main.mp4
#EXT-X-BYTERANGE:197426@198888
#EXTINF:10,
main.mp4
```
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2439>
When an incoming buffer is received, a deadlock can occur if:
1. 1st buffer is currently being handled by the src pad's task
=> holds semaphore.
2. 1st buffer reaches downstream AudioDecoder => Latency query.
3. src pad's task still holding semaphore while relaying Latency query.
4. `src_query()` calls `Pad::default()` which calls `iterate_internal_links()`.
5. `iterate_internal_links()` tries to acquire the `state` `Mutex` which is
already locked by `handle_push_jitterbuffer()`.
This commit temporarily releases the `state` `Mutex` until the semaphore is
acquired.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2466>
When a threadshare element streams buffers to an element which synchronizes on
the clock or which uses a limited blocking queue, the threadshare context is
perdiodically blocked, preventing other async tasks from progressing.
One workaround is to use a regular `queue` with enough buffering to cope with
early buffers. This is suboptimal though because this `queue` doesn't propagate
backpressure upstream.
The `ts-blocking-adapter` applies an async backpressure when downstream blocks,
allowing the threadshare context to process other tasks. This is achieved by
having the 'sink' Pad forward serialized items (buffers, ...) to the 'src' Pad
Task (thread) via a rendezvous channel.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2427>
Prevent calling clamp() with invalid bounds where min > max, which would
cause a panic with "assertion failed: min <= max". This panic would poison
the mutex lock, causing all subsequent lock().unwrap() calls to fail with
PoisonError.
This can happen when min-bitrate and max-bitrate properties are set
individually, creating a temporary inconsistent state between the values.
Fix by validating the bitrate range before calling clamp() and using
max_bitrate for both bounds when min > max to ensure safe operation.
Use LogContext to log the error only once per unique invalid pair.
Fixes#711
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2456>
This extracts metadata from an S302M audio stream and interpolates PTS
as needed, but still requires a properly packetized stream from
upstream.
Parsing S302M without packetization is not easily possible because of
the lack of synchronization markers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2435>
The `glimagesink` can handle video conversion just fine, we don't need to use
a `videoconvert` in that branch.
This commit also moves the `handle_media_stream()` branches within
`on_incoming_stream()` as the factorization is no longer justified.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2216>