Commit graph

105 commits

Author SHA1 Message Date
Mathieu Duponchelle
e110847ede Relicense from MIT to MPL-2.0
Fixes #107
2022-10-11 08:07:47 +02:00
Mathieu Duponchelle
9a345f9c6f webrtcsink: don't hold settings lock while negotiating 2022-10-07 21:08:00 +02:00
Mathieu Duponchelle
f82a731b3a webrtcsink: fix deadlock on encoder setup
Refactor connect_input_stream in order to avoid an ABBA deadlock
altogether: where in other spots we lock settings then state, here we
were emitting encoder-setup with state held, then locking settings in
the default handler.

We could have changed the locking order in the other spots, but instead
we can also just release the state lock when emitting the signal, which
is good practice.

Fixes #108
2022-10-07 21:08:00 +02:00
Thibault Saunier
c4f771dbbc Fix payloaders MTU to 1200
Higher value might be too big (in particular with many VPNs `webrtcsink`
won't work with the default 1400 MTU).

1200 is the default value in libwebrtc and it is references in several
places there.
2022-10-03 13:15:20 +02:00
Mathieu Duponchelle
ef7cf4dd98 signalling: track consumer and producer sessions in dedicated HashMaps
This avoids full traversals of the sessions HashMap.

Also fixes accidental session teardown when a producer is stopped while
also in a session as a consumer.
2022-09-30 23:51:41 +02:00
Mathieu Duponchelle
61c0fdcb5d webrtcsink: re-indent 2022-09-30 23:51:16 +02:00
Thibault Saunier
c5c92d0467 signalling: Do not stop consuming sessions when a peer stops being a producer 2022-09-30 23:51:07 +02:00
faldez
df4bf3214e change ser_de to serde
because gstreamer-rs rename ser_de feature to serde
2022-09-27 11:45:24 +02:00
mariana
60ad532ece added support for memory nvmm
Made modifications according to comments in PR 97
2022-09-19 13:49:12 +02:00
nazar
ef9c818522 Fix fec ratio, max-bitrate and consider encoders 2022-09-16 14:54:27 +02:00
Mathieu Duponchelle
5ebf9913a1 signalling: add and fix test for consumer disconnection
Fixes #92
2022-09-05 22:28:37 +02:00
Mathieu Duponchelle
08b79ab8f1 signalling tests: fix typo in test name 2022-09-05 22:28:37 +02:00
Thibault Saunier
c3a1536849 gcc: Fix deadlock on shutdown
We were holding the element .state lock while trying to shutdown leading
to a deadlock.

Fixes: https://github.com/centricular/webrtcsink/issues/90
2022-08-31 18:11:30 +02:00
Mathieu Duponchelle
8605df4b16 webrtcsink: vp8/9: don't hardcode threads property
and keep it at its default of 0 (automatic).

Hardcoding that value triggered abnormally excessive CPU usage when
connecting multiple consumers.
2022-08-31 01:20:14 +02:00
Mathieu Duponchelle
5b694988d1 Update dependencies 2022-08-31 01:16:39 +02:00
Thibault Saunier
a4f036499e protocol: Rework the way peers set their status
- Remove registration messages
- Add a setPeerStatus method which lets other peers know about their roles
2022-08-30 22:28:55 +02:00
Thibault Saunier
7e59bb519e protocol: Add a welcoming message, removing registering as consumer requirement
Since clients know from the start their Peer ID it is fine to go ahead
and connect as a consumer without prior registration.
2022-08-30 22:28:55 +02:00
Thibault Saunier
dbcbfef8c7 Refactor signalling protocol around a Session ID
This allows for more use cases to be handled like having several session
between 2 peers, and it simplifies the code a bit and makes the protocol
sensibly cleaner

Webrtcsink has been refactored a bit to take the new concept into
account
2022-08-30 22:28:55 +02:00
Thibault Saunier
f243f5fe5c protocol: Add an "Unregister" message type
This way we can use the same WebSocket where several peerTypes being
communicated and some those type can be unregistered, re registered
without ever closing the Socket connection.

This also introduces sensible symmetry between different message types.
2022-08-30 22:28:55 +02:00
Thibault Saunier
2dc42ba0db webrtcsink: Fix the way we handle max-bitrate
Computation of actual max bitrate was broken and in the end it is simpler
to keep the value set by the user and take into account the fec only
when required.
2022-08-20 00:27:23 +02:00
Thibault Saunier
e0ad7e4c16 Update dependencies using the new Signall::builder API 2022-08-18 22:58:15 +02:00
Thibault Saunier
c0c0d42d9a webrtcsink: Make GCC default 2022-08-17 17:56:00 +02:00
Thibault Saunier
b8767fa18f sink: Move the homegrown congestion controller in it own file 2022-08-05 03:13:05 +02:00
Thibault Saunier
c399b1f0c6 Use rtprtxsend stuffing when available and congestion control is enabled
Depends on https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2273/
2022-08-05 03:13:05 +02:00
Thibault Saunier
64f664c859 plugin: Implement bandwidth estimator based on the Google Congestion Control algorithm
See https://datatracker.ietf.org/doc/html/draft-ietf-rmcat-gcc-02

This commit implements the bandwidth estimation as a GStreamer element
that is then used in webrtcbin through the new `request-bandwidth-estimator`
signal.

This keeps our Homegrown congestion controller but removes the possibility
to switch CC algorithm at runtime.
2022-08-05 03:13:05 +02:00
Thibault Saunier
287e76847a plugin: Fix some clippy issues
And minor reformat
2022-08-05 03:13:05 +02:00
Thibault Saunier
c53e5b8bb2 Allow passing free form metadatas about consumers/producers/listenners
In some applications people might need to be able to pass more metadata
than the only "display-name" this commit allow that by adding a field in
all signalling structure where it is free form json and removing the
"display-name" as the free form `meta` field allows application to pass
this kind of information without any problem.

On the "webrtcsink" side this commit adds a `meta` property as a
gst::Structure which will be passed as a json string to the signalling
server so we enforce data to be structured.
2022-07-27 16:57:20 +02:00
Mathieu Duponchelle
ec46b706e9 webrtcsink: don't use framerate halving as mitigation when 0/1
Fixes #65
2022-06-08 01:35:21 +02:00
Mathieu Duponchelle
d40b804952 webrtcsink: implement per-transceiver navigation support 2022-06-03 00:14:41 +02:00
Mathieu Duponchelle
29ed333b97 input: simplify by calling Stringify in the same place 2022-06-03 00:14:41 +02:00
Mathieu Duponchelle
f2f71024b6 input: simplify processing of keyboard events
Simply let all keyboard events be consumed when the video element
is in focus, and go through otherwise
2022-06-03 00:14:41 +02:00
Mathieu Duponchelle
3beb712e16 input.js: fix button index on mouse events
The buttonMask variable was useless and using it as the button index
in the navigation events was nonsensical.

In addition, the button index must be increased by one to map it to
the X domain.
2022-06-03 00:14:41 +02:00
Mathieu Duponchelle
42f2ae7c2b vpxenc: don't set resize-allowed to true
It wasn't clear what the purpose of setting it was in the first
place, and it was causing libvpx to print warnings at runtime ..
2022-06-02 23:22:24 +02:00
Mathieu Duponchelle
2c855b9cfe signalling: send pings at 30-second intervals
Some routers might otherwise time out websocket connections

Fixes #58
2022-05-25 19:13:23 +03:00
Thibault Saunier
f6f079f3a8 Use StreamConsumer from gstreamer itself
Merged in https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1022
2022-05-23 13:52:39 +02:00
Jimmi Holst Christensen
c02a0d8757 vp9enc takes target-bitrate as a i32 and not u32 2022-05-10 12:02:31 +03:00
Vivienne Watermeier
eca3fa9308 Add touch events and modifier states 2022-05-09 22:49:24 +02:00
Vivienne Watermeier
f091e90b24 Depend on gstreamer-rs main to add a feature for v1_22 2022-05-09 22:49:24 +02:00
machenmusik
ee950499d5 start_bitrate property, to allow specifying initial (video) bitrate 2022-05-05 22:28:23 +02:00
Thibault Saunier
075a625305 Make our "loss based control" algorithm closer to what is defined in [GCC]
As specified in Google Congestion Control we should run the packet loss
estimation algorithm "every time feedback from the receiver is
received".

And, also as defined by GCC, we now have 2 different estimated bitrates,
one for the delay-based controller value and one for the loss-based one,
and we use the minimum value between those 2 as our current estimation.

[GCC]: https://datatracker.ietf.org/doc/html/draft-ietf-rmcat-gcc-02
2022-05-03 15:21:20 +02:00
Nils Kattenbeck
3c81afa7b2 Set constant bitrate rate-control for VAAPI encoder 2022-04-28 18:55:41 +02:00
Nils Kattenbeck
e4846d0d53 Add support for VAAPI VP8 encoder 2022-04-28 18:55:41 +02:00
Nils Kattenbeck
843875e95d Add support for VAAPI h264 encoder 2022-04-28 18:55:41 +02:00
Nils K
f104ffd251 Remove cd in usage instructions 2022-04-28 16:12:10 +02:00
Nils Kattenbeck
3b04a3c06d Remove is_video field from Codec struct
Instead add it as a function and get the value from the encoder type.
This removes the necessity for any manual bookkeeping.
2022-04-28 16:02:09 +02:00
Mathieu Duponchelle
b51cdb9de0 webrtcsink: call recalculate_latency on LATENCY messages 2022-04-23 02:03:42 +02:00
Raphael Dürscheid
ee200326ef Implemente clippy suggestions 2022-04-22 20:01:56 +03:00
Raphael Dürscheid
b66db922d8 Remove erranous unwrap() on use_clock 2022-04-22 20:01:56 +03:00
Raphael Dürscheid
3e5fa04379 Consumer pipeline should use_clock 2022-04-22 18:37:46 +03:00
Thibault Saunier
f11260aeb5 webrtcsink: Fix a race starting the signaller
1. Working scenario:

T1 -> Caps event (all caps have been received)
T1     -> Start discovering
T2 -> Change state to Playing
T2        -> The signaller is not started as:
                - Sink current_state() == Paused as it will be set to
                  playing after the change_state vmethod returns
                - Discovery is not done anyway
T1 -> Discovery is done
        => The signaller is started, and **everything works well**.

2. Failing scenario:

T1 -> Caps event (all caps have been received)
T1     -> Start discovering
T1 -> Discovery is done
T1        -> The signaller is not started as:
                - Current state == Paused (it will be set to playing
                  after the change_state vmethod returns)
                - Discovery is not done anyway
T2 -> Change state to Playing
T2        -> The signaller is not started as:
                - Sink current_state == Paused  as it will be set to
                  playing after the we return from the change_state
                  vmethod

In that case the signaller never starts.
2022-04-20 18:47:24 +02:00