Commit graph

327 commits

Author SHA1 Message Date
Xavier Claessens
372c44655a janusvr_signaller: Do not block in end_session()
Only stop() is allowed to block, wait there.

Fixes #603

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1848>
2024-10-30 12:36:01 +00:00
Chris Bainbridge
5010ee872d webrtc: Fix Python custom signaller receiving SDP offer
The GstWebRTC API web interface defaults to receiving an SDP offer and
generating an answer, but this can be overridden by entering "offer
options" before clicking to open the remote stream. The Python
webrtcsink-custom-signaller.py example failed in this mode as it was
coded to only generate an offer and receive an answer. Fix this by
implementing support for receiving an offer and sending an answer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1883>
2024-10-28 11:23:32 +00:00
Chris Bainbridge
e30d80c71e webrtc: README: add webrtcsink-custom-signaller.py
Document the Python webrtcsink custom signaller example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1888>
2024-10-28 10:19:25 +00:00
Sebastian Dröge
4abc5c7a48 Be stricter with Impl-trait bounds to enforce type hierarchies
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1871>
2024-10-22 13:43:12 +00:00
Sebastian Dröge
7e59c3f0fd Remove once_cell dependency
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1868>
2024-10-21 17:53:18 +00:00
Sebastian Dröge
0e3d019e24 aws: Don't unnecessarily clone AWS behaviour version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1864>
2024-10-20 19:53:15 +00:00
Sebastian Dröge
00a4398aee aws: Allow a deprecated BehaviourVersion for now
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1864>
2024-10-20 19:53:15 +00:00
Sebastian Dröge
b43a778a8e Fix a couple of type hierarchy bugs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1864>
2024-10-20 19:53:15 +00:00
Sebastian Dröge
54bc7a898e webrtc: Silence two new Rust 1.82 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1860>
2024-10-17 21:38:10 +00:00
Mathieu Duponchelle
959463ff65 webrtcsink: fix session not in place errors
The InPlace/Taken logic was introduced to avoid using an extra lock
around the session, but it places expectations that are not always
obvious to meet around when a session is expected to be taken or not.

Any code that expects to have access to the sessions at all times thus
needs either extra logic in the session wrapper, or to maintain the
state of the session outside of the session (eg mids).

This commit removes the logic, and wraps sessions in Arc<Mutex>>.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1852>
2024-10-17 12:29:53 +00:00
Mathieu Duponchelle
ef06421a25 webrtcsrc: make updated transceiver retrieval backward compatible
In 1.24 and before transceivers for remote sendonly medias are only
created at answer time. If that is the case, we can add the transceiver
ourself, it will get associated when creating the answer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1853>
2024-10-16 14:48:20 +00:00
Mathieu Duponchelle
82d0eaf438 webrtcsrc: fix debug message on offer created
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1853>
2024-10-16 14:48:20 +00:00
Mathieu Duponchelle
3d257b4819 webrtcsink: improve debut message when start session failed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1853>
2024-10-16 14:48:20 +00:00
Chris Bainbridge
785209cc7f custom-signaller: add missing manual-sdp-munging property
All signallers must now implement this property

Fixes #611

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1854>
2024-10-16 15:45:50 +02:00
Mathieu Duponchelle
5f0ca7acde webrtcsink: fix custom_signaller hanging
Since 6a23ae168f, the chain function
of webrtcsink adds a custom meta on input buffers.

That custom meta was registered only by the class_init of the subclasses
of BaseWebRTCSink, but the custom signaller example uses
BaseWebRTCSink::with_signaller() directly.

Fix by registering the meta in BaseWebRTCSink::class_init()

Fixes: #610
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1854>
2024-10-16 15:25:09 +02:00
Mathieu Duponchelle
5e49f1d10e webrtcsrc: address non-compliant transceiver creation
Instead of adding transceivers explicitly then setting the remote
description, expecting the manually added transceivers to get picked
up, we pass a promise to set-remote-description-set, and set the
relevant properties on the automatically created transceivers at that
point.

We then call create-answer and proceed as before.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/596
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1829>
2024-10-14 11:19:38 +00:00
Guillaume Desmottes
027eead86d webrtc: janus: add 'janus-state' property to the sink
This property can be used by applications to track the state of the
signaller, especially to know when the stream is up.

Fix #510

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1505>
2024-10-10 10:59:50 -04:00
Guillaume Desmottes
d8b9a7a486 webrtc: janus: fix typo in doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1505>
2024-10-10 10:57:02 -04:00
Mathieu Duponchelle
b3ace3678b webrtcsink: fix naming of error dot files for discovery pipelines
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1843>
2024-10-03 14:35:45 +00:00
Guillaume Desmottes
d9e8f4054c webrtc: allow PAR change in webrtcsink input caps
We are already allowing resolution changes which can lead to change in
pixel-aspect-ratio.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1830>
2024-09-30 14:40:48 +02:00
Sebastian Dröge
dcb072ee23 webrtc: livekit: Set connection earlier during setup
Otherwise it's not available yet when handling the initial participants
that are already in the session when joining.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1794>
2024-09-30 13:04:24 +03:00
Sebastian Dröge
cd2b641321 livekitwebrtcsrc: Add API for disabling/enabling a track
A disabled track is still negotiated but no data is sent for it
temporarily until it is enabled again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1794>
2024-09-30 13:04:24 +03:00
Sebastian Dröge
27dc76826e livekitwebrtcsrc: Add pad properties for various LiveKit participant / track metadata
The content of the TrackInfo and ParticipantInfo structs is exposed as
gst::Structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1794>
2024-09-30 13:04:24 +03:00
Mathieu Duponchelle
87c6719e1d webrtcsink: add define-encoder-bitrates signal
When congestion control is used for a session with multiple encoders,
the default implementation simply divides the overall bitrate equally
between encoders.

This is not always desirable, and this patch exposes a new signal
that users can register to, with two arguments:

* The overall bitrate to allocate
* A structure with an encoder.stream_name -> bitrate mapping

Handlers should return a similar structure with a custom mapping.

An example is also provided.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1792>
2024-09-25 15:19:44 +00:00
François Laignel
f532d523b2 webrtcsink: fix RFC7273 attributes
RFC7273 related attributes are set in the SDP offer by passing them via the
transceiver `codec-preferences` signal. These attributes are intended to be set
at the media level so they must be prefixed by `a-` in the `Caps` argument to
the signal. Otherwise they end up under `a=fmtp`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1810>
2024-09-25 09:30:48 +00:00
Mathieu Duponchelle
5c66d8c107 webrtcsrc: ensure source pad has msid when added
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1800>
2024-09-24 14:50:30 +00:00
Mathieu Duponchelle
f70482d9bc webrtcsrc: fix default msid property value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1800>
2024-09-24 14:50:30 +00:00
Mathieu Duponchelle
a85b0cb72e webrtcsrc: expose MSID property on source pad
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1789>
2024-09-20 09:31:57 +03:00
Mathieu Duponchelle
6a23ae168f webrtcsink: implement mechanism to forward metas over control channel
It may be desirable for the frontend to receive ancillary information
over the control channel.

Such information includes but is not limited to time code metas, support
for other metas (eg custom meta) might be implemented in the future, as
well as downstream events.

This patch implements a new info message, probes buffers that arrive at
nicesink to look up timecode metas and potentially forwards them to the
consumer when the `forward-metas` property is set appropriately.

Internally, a "dye" meta is used to trace the media identifier the
packet we are about to send over relates to, as rtpfunnel bundles all
packets together.

The example frontend code also gets a minor update and now logs info
messages to the console.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1749>
2024-09-19 08:41:47 +00:00
Mathieu Duponchelle
db026ad535 gstwebrtc-api: expose API on consumer-session for munging stereo
We cannot do that by default as this is technically non-compliant,
so we need to expose API to let the user opt into it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1754>
2024-09-19 07:37:23 +00:00
Sebastian Dröge
c505d9a418 Update to async-tungstenite 0.28
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1772>
2024-09-10 09:19:18 +03:00
Arun Raghavan
e72db57179 webrtc: Fix whipclientsink name in README
The element name was changed, but the documentation wasn't updated to
match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1764>
2024-09-03 16:44:19 -04:00
Mathieu Duponchelle
2f9bb62b6b gstwebrtc-api: create control data channel when offering
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1755>
2024-08-27 07:52:12 +02:00
Mathieu Duponchelle
4cf93ccbdb net/webrtc: Add missing npm command to README
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/589

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1746>
2024-08-22 15:46:28 +02:00
Jerome Colle
dee0e32dde webrtcsink: add nvv4l2av1enc support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1735>
2024-08-22 06:41:52 +00:00
Mathieu Duponchelle
8ad882bed5 gstwebrtc-api: address issues raised by mix matrix support
1c48d7065d was mistakenly merged too
early, and there were concerns about the implementation and API design:

The fact that the frontend had to expose a text area specifically for
sending over a mix matrix, and had to manually edit in floats into the
stringified JSON was suboptimal.

Said text area was always present even when remote control was not
enabled.

The sendControlRequest API was made more complex than needed by
accepting an optional stringifier callback.

This patch addresses all those concerns:

The deserialization code in webrtcsink is now made more clever and
robust by first having it pick a numerical type to coerce to when
deserializing arrays with numbers, then making sure it doesn't allow
mixed types in arrays (or arrays of arrays as those too must share
the same inner value type).

The frontend side simply sends over strings wrapped with a request
message envelope to the backend.

The request text area is only shown when remote control is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1725>
2024-08-22 05:54:46 +00:00
Mathieu Duponchelle
5dc2d56c0e webrtcsink: store mids per-session instead of globally
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1730>
2024-08-21 21:20:40 +00:00
Mathieu Duponchelle
16ee51621e webrtcsink: fix segment format mismatch with remote offer
webrtcsink was starting the negotiation process on Ready and concurrently
moving the consumer pipeline to Playing, but when answering the remote
description was set so fast that input streams were connected (and the time
format set on appsrc) before the state change to Paused had completed.

This meant gst_base_src_start was happening after that and setting the format
back to bytes, the time segment that was next coming in then caused:

basesrc gstbasesrc.c:4255:gst_base_src_push_segment:<video_0> segment format mismatched, ignore

And the consumer pipeline errored out.

The same issue existed in theory when webrtcsink was creating the offer,
but was much harder to trigger as it required that the remote answer
came in before the state change to Paused had completed.

This commit fixes the issue by simply waiting for the state to have
changed to Paused before negotiating.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1730>
2024-08-21 21:20:40 +00:00
Mathieu Duponchelle
1c48d7065d gstwebrtc-api example: add support for requesting mix matrix
This is one example of how a consumer might send over custom upstream
event requests to the producer.

As webrtcsink will deserialize numbers in priority as integers, we need
a custom stringifying function to ensure members of the matrix array are
indeed serialized with the floating point.

An optional stringifier parameter is thus added to the
sendControlRequest API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1711>
2024-08-15 15:42:04 +00:00
Mathieu Duponchelle
01e28ddfe2 webrtcsink: implement generic data channel control mechanism ..
.. and deprecate data channel navigation in favor of it.

A new property, "enable-data-channel-control" is exposed, when set to
TRUE a control data channel is offered, over which can be sent typed
upstream events.

This means further upstream events will be usable, for now only
navigation and custom upstream events are handled.

In addition, send response messages to notify the consumer of whether
its requests have been handled.

In the future this can also be extended to allow the consumer to send
queries, or seek events ..

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1711>
2024-08-15 15:42:04 +00:00
Mathieu Duponchelle
0a6963f7ce gstwebrtc-api: example: use http by default
That way the webpage connects with ws:/ to the signaller.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/589
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1704>
2024-08-14 14:10:04 +00:00
Sebastian Dröge
bc930122ba webrtcsrc: Make sure to always call end_session() without the state lock
This was already done in another place for the same reason: preventing a
deadlock. It's probably not correct as hinted by the FIXME comment but
better than deadlocking at least.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1701>
2024-08-13 06:04:09 +00:00
Mathieu Duponchelle
0da1c8e9c9 webrtcsink: fix assertions when finalizing
Dumping the pipeline on state changes from an async bus handler was
triggering criticals.

Instead, dump from the sync handler.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1706>
2024-08-12 09:13:06 +02:00
Mathieu Duponchelle
9080c90120 net/webrtc: add support for answering to webrtcsink
Support was added to the base class when the AWS KVS signaller was
implemented, but the default signaller still only supported the case
where the producer was creating the offer.

Also extend the javascript API

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1702>
2024-08-09 14:02:48 +02:00
Mathieu Duponchelle
a9ff9615ff net/webrtc: correct signaller debug category
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1702>
2024-08-08 18:28:43 +02:00
Mathieu Duponchelle
64f0b76f71 webrtc: update README with section on embedded signalling / web services
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1671>
2024-08-08 16:40:46 +02:00
Mathieu Duponchelle
9455e09d9f webrtcsink: expose properties for running web server
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1671>
2024-08-08 16:40:46 +02:00
Mathieu Duponchelle
b709c56478 webrtcsink: expose properties for running signalling server
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1671>
2024-08-07 19:55:00 +02:00
Sebastian Dröge
6c04b59454 webrtcsrc: Don't hold the state lock while removing sessions
Removing a session can drop its bin and during release of the bin its
pads are removed, but the pad-removed handler is also taking the state
lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1695>
2024-08-07 09:35:15 +00:00
Sebastian Dröge
b83b6031e5 Update etherparse and async-tungstenite dependencies
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1691>
2024-08-06 09:00:32 +03:00