Commit graph

4256 commits

Author SHA1 Message Date
Sebastian Dröge
144aeb615a fmp4mux: Fix handling of negative DTS in composition time offset
Actually negative DTS (i.e. < 0) was handled correctly before when
queueing buffers, but this didn't handle the case correctly where the
very same stream has DTS/PTS shifted to be positive (i.e. start DTS is
before earliest PTS).

To solve this, pass through all DTS as signed values and at the very end
for every fragment calculate the offset between the two in addition to
the PTS/DTS offset of each buffer, and adjust the composition time
offsets accordingly.

This way the final PTS of each buffer after demuxing is equal to the
actual running time of the very same buffer before muxing. Previously
all PTS would've been shifted forwards by a couple of frames, which then
broke A/V synchronization.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2232>
2025-05-05 16:47:34 +03:00
Sebastian Dröge
8f8a663555 fmp4mux: Add explanatory comment why tfdt is mapped to the earliest PTS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2232>
2025-05-05 16:46:51 +03:00
Sebastian Dröge
a9a3a7a435 dav1ddec: Implement hack to finish output buffer with a reference count of 1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:53 +00:00
Sebastian Dröge
2166befce7 dav1ddec: Set output frame duration via the codec frame
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:53 +00:00
Sebastian Dröge
9012099e62 dav1ddec: Directly decode into downstream allocated buffers if possible
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/670

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:53 +00:00
Sebastian Dröge
0afd415bcb dav1ddec: Simplify LATENCY query handling
And don't keep state locked while querying upstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:53 +00:00
Sebastian Dröge
6ee63a465d dav1ddec: Allocate output buffers from an internal buffer pool
In the best case we can directly output them without copying now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:52 +00:00
Sebastian Dröge
ebaf8ce8a5 dav1ddec: Move more video format mapping logic into functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:52 +00:00
Sebastian Dröge
6ae34b751a dav1ddec: Keep state unlocked while calling into the decoder
This is a preparation for handling allocations ourselves from the
element as that would call back from the decoder into the element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:52 +00:00
Sebastian Dröge
52037c8aca dav1ddec: Store the output state instead of just the video info in the decoder state
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2190>
2025-05-03 15:36:52 +00:00
Sebastian Dröge
6df4adac31 fmp4mux: Use earliest PTS for the base media decode time (tfdt)
While this is supposed to be a decode time, this doesn't really match
the description in the specification. It starts at 0 and increases by
the duration of each fragment, i.e. is the sum of all previous sample
durations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2223>
2025-05-02 21:03:19 +03:00
Sebastian Dröge
3012dac758 fmp4mux: Remove redundant if
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2223>
2025-05-02 19:05:12 +03:00
Sebastian Dröge
86d2f2ce1f fmp4mux: Write lmsg as compatible brand into the last fragment
While this is only defined as such in DASH, it's used more widely and
shouldn't hurt to always have it there.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2222>
2025-05-02 15:45:25 +03:00
Piotr Brzeziński
d10993e15e gstwebrtc-api: Support starting a producer session for a given consumer
Updates the API with necessary plumbing to allow to track consumers
being added/removed, as well as starting a producer session targeted at
a consumer peer waiting for one.

The example page has also been updated to demonstrate this
functionality.

Can be tested by launching a webrtcsrc without a peer-id specified.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2206>
2025-05-01 13:14:55 +00:00
Piotr Brzeziński
abf97ba2a9 webrtc: Allow producers to start a session for a chosen consumer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2206>
2025-05-01 13:14:55 +00:00
Sebastian Dröge
0afe3e1846 Update everything else to bitstream-io 4.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2219>
2025-04-30 13:01:22 +00:00
Sebastian Dröge
cb1a04465e rtp: Update to bitstream-io 4.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2219>
2025-04-30 13:01:22 +00:00
Sebastian Dröge
9d1de72aa8 Update dependencies
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2220>
2025-04-29 08:30:44 +03:00
Sebastian Dröge
79a93999c0 tracers: Update to etherparse 0.18
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2220>
2025-04-29 08:27:32 +03:00
Sebastian Dröge
5eee9e9eee skia: Update to 0.84
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2220>
2025-04-29 08:25:39 +03:00
Thibault Saunier
1181dea306 ci: Add test-static-link-all meson logs as artifacts
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1847>
2025-04-28 21:26:02 +03:00
Thibault Saunier
5a4e536d6a skia: Implement a video compositor using skia
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1847>
2025-04-28 21:26:02 +03:00
Mathieu Duponchelle
ec79102ec5 aws: pin aws-smithy-runtime-api to a compatible version
We pin `aws-smithy-runtime` to 1.7.8 since
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2214,
we need to prevent `aws-smithy-runtime-api` from updating to `1.8.0` in
order for the build to pass after `cargo update`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2218>
2025-04-28 16:43:14 +02:00
Sebastian Dröge
8596d34f19 ci: Remove typos CI job
It's not really scalable in a repository with lots of different pieces
of code. What is an intentional typo (`fiel`) in one directory might be
an actual typo (`field`) elsewhere, and unfortunately this can't be
configured in a useful way on a per-directory basis.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Sebastian Dröge
322fc4b400 mp4mux: Fix typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Sebastian Dröge
b06ae44ed4 fmp4mux: Set fragment header buffer offset to the fragment's sequence number
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Sebastian Dröge
1a381de8aa fmp4mux: Remove obsolete TODO comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Sebastian Dröge
3ae7913ef2 fmp4mux: Fix typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Sebastian Dröge
7e00e8c90b fmp4mux: Add TODO comments for creating codec specific boxes when receiving caps
Keeps error checking up-front and keeps things more consistent overall.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Sebastian Dröge
3e5da7a783 fmp4mux: Create FLAC dfLa box when receiving the caps too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Sebastian Dröge
03e9a9f0fe fmp4mux: Add support for AC-3 / EAC-3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
2025-04-28 08:13:36 +00:00
Mathieu Duponchelle
8256601d1d webrtcsink: fix deadlock on encoder-setup
Switching to a lockable session re-introduced a similar deadlock to the
one fixed by f82a731b3a: we would call
encoder-setup with the session lock, the default handler would try to
lock the settings, thus not respecting the locking order (settings,
state, session).

We fix this by setting up the whole encoding chain outside of any locks,
then calling a reduxed version of Session.connect_input_stream() (sans
encoder-setup / payloader-setup signal calls).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2215>
2025-04-25 13:52:23 +02:00
Mathieu Duponchelle
12e6922ac2 webrtcsink: fix deadlock on fast session removal
When a session was removed while its input streams were still getting
connected, a race condition was possible where:

* connect_input_stream was getting called from webrtcbin's pc thread
* the state of the pipeline was getting set to NULL in another thread
* connect_input_stream tried to sync state to NULL, and deadlocked
  because webrtcbin tried to stop its pc thread synchronously

This commit fixes this by making sure we hold the session lock when
setting the state of the pipeline to NULL, thus ensuring
`connect_input_stream` isn't getting called at the same time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2215>
2025-04-25 13:52:23 +02:00
Mathieu Duponchelle
30a0b155fc webrtcsink: fix locking order
settings is always to be locked before state

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2215>
2025-04-25 13:52:23 +02:00
Mathieu Duponchelle
7cf2736a15 webrtcsink: call webrtcbin:add-ice-candidate without session lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2215>
2025-04-25 13:52:23 +02:00
Mathieu Duponchelle
5b01fdff8c webrtcsink: don't send messages on not-yet-opened data channels
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2215>
2025-04-25 13:52:23 +02:00
Mathieu Duponchelle
783b75fef8 webrtc/signalling: don't error out on messages for unknown sessions
An error message is to be considered fatal by its receiver, but sending
it to webrtcsink when it sends a message for an unknown session leaves
it vulnerable to a race condition where the server has received an
endSession message from a consumer, but hasn't notified webrtcsink yet.

This commit simply removes the sending of an error message for unknown
sessions, it could instead send a new UnknownSession message, or revamp
the error message to include a code, but that isn't critically needed as
webrtcsink will anyway receive the endSession message eventually.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2215>
2025-04-25 13:52:23 +02:00
L. E. Segovia
655566e9e3 ci: Further deny AWS-related updates and fix related checks, part 2
- Add constraint on aws-smithy-runtime on aws and webrtc
- Downgrade aws-sdk-s3
- Drop aws-smithy-http 0.62
- Update cargo-outdated ignores
- Update Cargo.lock

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2214>
2025-04-23 12:00:53 -03:00
Sebastian Dröge
013f8dbd4f Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2213>
2025-04-23 13:12:55 +03:00
Sebastian Dröge
34875da4d1 rtsp: Update lru to 0.14
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2213>
2025-04-23 13:09:08 +03:00
Sebastian Dröge
e1080a0caf tracers: Update to etherparse 0.17
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2213>
2025-04-23 13:07:35 +03:00
L. E. Segovia
f376d3c1cd ci: Further deny AWS-related updates and fix related checks
- Downgrade aws-sigv4 to drop aws-smithy-http 0.62
- Update deny to ignore bitstream v2
- Update cargo-outdated ignores
- Update Cargo.lock

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2212>
2025-04-23 06:27:29 +00:00
Doug Nazar
52cf612ead gtk4: Avoid deprecated function with newer gtk
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2166>
2025-04-22 18:17:22 +00:00
Doug Nazar
a12b4e200c meson: Update to waylandegl feature
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2166>
2025-04-22 18:17:22 +00:00
Doug Nazar
ade1369db0 meson: Only add glib/gio/gtk features if required by enabled packages
If those features are requested, however no package has those as a
dependency, the compile will fail with error unable to find feature.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2166>
2025-04-22 18:17:22 +00:00
Sebastian Dröge
1ea767ac2a Update to bitstream-io 3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2211>
2025-04-22 07:21:56 +00:00
Philippe Normand
6f7a1e21d5 pcap_writer: Mark target-factory and pad-path props as construct-only
Otherwise the tracer's constructed() vfunc will emit a warning and will not
configure the tracer hooks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2209>
2025-04-20 10:24:13 +00:00
Sebastian Dröge
f5052e719f quinn: Update to web-transport-quinn 0.5 and disable aws-lc-rs
This reverts commit e056d9244d.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2199>
2025-04-19 05:50:39 +00:00
L. E. Segovia
397300a1ce Downgrade AWS SDK and aws-lc-rs
This locks the AWS SDK ecosystem to the version prior to making
aws-lc-rs the default TLS provider crate. This was done in the
March 11, 2025 release of the AWS SDK:

https://github.com/awslabs/aws-sdk-rust/releases/tag/release-2025-03-11

For future notes:

- once AWS sorts out their ballooning crate size, revert this commit and
  regen the lockfile
- if other crates need to be added/downgraded, check for the immediate
  version before adding the default-https-client feature, in https://lib.rs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2199>
2025-04-19 05:50:39 +00:00
L. E. Segovia
b8b703c519 Update Cargo.lock
This commit removes windows-targets 0.48.5 which does not build for
Windows 7 by updating the AWS Rust SDK; post March 11, 2025,
they've switched to using rustls for TLS, and bindgen is compulsory
for non-standard platforms.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2199>
2025-04-19 05:50:39 +00:00