Commit graph

119 commits

Author SHA1 Message Date
Matthew Waters
2bed220771 webrtc: don't generate duplicate rtx payloads when bundle-policy is set
It was possible to generate a SDP that had an RTX payload type
that matched one of the media payload types when providing caps via
codec_preferences without any sink pads.

Fixes

m=video 9 UDP/TLS/RTP/SAVPF 96
...
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 nack pli
a=fmtp:96 apt=96

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2046>
2021-03-09 02:22:35 +00:00
Mathieu Duponchelle
88e007fb21 webrtcbin: try harder not to pick duplicate media ids
On renegotiation, or when the user has specified a mid for
a transceiver, we need to avoid picking a duplicate mid for
a transceiver that doesn't yet have one.

Also assign the mid we created to the transceiver, that doesn't
fix a specific bug but seems to make sense to me.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1902>
2021-01-08 20:22:57 +00:00
Olivier Crête
df8d29e9c3 webrtcbin: Remove remnant of non-rtcp-mux mode
There was some code left that wasn't used anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1930>
2021-01-06 23:02:37 +00:00
Olivier Crête
a801018ef1 webrtc: Make ssrc map into separate data structures
They now contain a weak reference and that could be freed later
causing strange crashes as GWeakRef are not movable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
1c1661b54f webrtcbin: Implement getting stats for a specific pad
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
fc0f6db856 webrtcbin: Store the rtpjitterbuffer instances to extract stats from them
Store them as web refs to avoid having to worry about freeing later and because
the new-jitterbuffer is on a different thread

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
5d5417f271 webrtc: Remove non rtcp-mux code
RTCP mux is now always required by the WebRTC spec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1765>
2020-11-24 01:59:55 +00:00
Jan Schmidt
af90778314 webrtc: Fix a race on shutdown.
The main context can disappear in gst_webrtc_bin_enqueue_task()
between checking the is_closed flag and enqueueing a source on the
main context. Protect the main context with the object lock instead
of the PC lock, and hold a ref briefly to make sure it stays alive.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1741>
2020-10-31 01:47:06 +00:00
Olivier Crête
80a56c25a6 webrtc: Set the DSCP markings based on the priority
This matches how the WebRTC javascript API works and the Chrome implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
2020-10-30 16:24:40 -04:00
Olivier Crête
0fbbdc5734 rtptransceiver: Store the SSRC of the current stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
2020-10-30 16:23:10 -04:00
Olivier Crête
7be09a5f22 webrtc: Save the media kind in the transceiver
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
2020-10-30 16:23:10 -04:00
Olivier Crête
e172ca5be1 webrtcbin: Remove unused function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
2020-10-30 16:23:10 -04:00
Sebastian Dröge
cc7e98816f Revert "webrtc: Save the media kind in the transceiver"
This reverts commit f54d8e9945.

It breaks the CI until the C# bindings are fixed.
2020-10-08 18:53:12 +03:00
Sebastian Dröge
849839ba97 Revert "rtptransceiver: Store the SSRC of the current stream"
This reverts commit d1da271f25.

It breaks the CI until the C# bindings are fixed.
2020-10-08 18:53:07 +03:00
Sebastian Dröge
e65a8cbcf1 Revert "webrtcbin: Remove unused function"
This reverts commit 39723dbe93.

It breaks the CI until the C# bindings are fixed.
2020-10-08 18:53:04 +03:00
Sebastian Dröge
b565a7ef66 Revert "webrtc: Set the DSCP markings based on the priority"
This reverts commit 8ba08598bb.

It breaks the CI until the C# bindings are fixed.
2020-10-08 18:53:00 +03:00
Olivier Crête
8ba08598bb webrtc: Set the DSCP markings based on the priority
This matches how the WebRTC javascript API works and the Chrome implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1425>
2020-10-06 16:49:08 -04:00
Olivier Crête
39723dbe93 webrtcbin: Remove unused function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1425>
2020-10-06 16:49:08 -04:00
Olivier Crête
d1da271f25 rtptransceiver: Store the SSRC of the current stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1425>
2020-10-06 16:49:08 -04:00
Olivier Crête
f54d8e9945 webrtc: Save the media kind in the transceiver
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1425>
2020-10-06 16:49:08 -04:00
Olivier Crête
825a79f01f webrtcbin: Accept end-of-candidate pass it to libnice
libnice now supports the concept of end-of-candidate, so use the API
for it. This also means that if you don't do that, the webrtcbin will
never declared the connection as failed.

This requires bumping the dependency to libnice 0.1.16

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1139>
2020-09-18 18:40:58 -04:00
Olivier Crête
63f06d16db webrtcbin: Merge the RTX SSRCs from all transceivers when bundling
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1545>
2020-09-18 14:20:03 +00:00
Matthew Waters
e2d88f0569 webrtc: propagate more errors through the promise
Return errors on promises when things fail where available.

Things like parsing errors, invalid states, missing fields, unsupported
transitions, etc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1565>
2020-09-14 04:04:29 +00:00
Matthew Waters
597c1b4ec6 webrtc: remove private properties/signals from the now public ice object
We don't want to expose all of the webrtcbin internals to the world.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1444>
2020-07-20 15:56:20 +10:00
Olivier Crête
cceca1ffe8 webrtcbin: Expose "latency" property
This property sets the latency both on the rtpbin/rtpjittbuffer, but
also on the RTPStorage elements currently used by the FEC decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1367>
2020-06-29 22:45:31 -04:00
Sebastian Dröge
aa01e6ba22 webrtcbin: Don't call gst_ghost_pad_construct() anymore
It's deprecated, unneeded and doesn't do anything anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1360>
2020-06-22 17:01:34 +00:00
Matthew Waters
0f41c0f000 webrtc: fix ice control mode when we offer initially
An initial offer means we have a local description not a remote
description.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1332

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1358>
2020-06-22 12:17:09 +00:00
Mathieu Duponchelle
a048ce81d4 plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:40:42 +02:00
Sebastian Dröge
74f2f733be plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 13:33:16 -04:00
Sebastian Dröge
b25d153c34 webrtc: Add GstWebRTCDataChannel to the library API
This makes it more discoverable for bindings and allows bindings to
generate static API for the signals and functions.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1168

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1313>
2020-06-02 21:04:37 +00:00
Matthew Waters
67ae885d4c webrtc: handle an ice-lite remote offer
When the remote peer offers an ice-lite SDP, we need to configure our
ICE negotiation to be in controlling mode as the peer will not be.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1304>
2020-05-28 19:57:45 +10:00
Chris Ayoup
9937101e51 webrtc: move filtering properties to webrtcice
We want webrtcbin to only expose properties that are defined in JSEP, so
these additional properties should be moved out.  In order to access
them, the webrtcice instance is exposed from webrtcbin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1223>
2020-05-11 05:30:59 +00:00
Chris Ayoup
ca754245e9 webrtc: allow setting local IP addresses
If a local IP address is specified, ICE gathering can be much faster
in environments where there are multiple IP addreses but only some are
usable (for example, if you are running docker on the machine).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1223>
2020-05-11 05:30:59 +00:00
Chris Ayoup
3fc8818824 webrtc: Allow toggling TCP and UDP candidates
Add some properties to allow TCP and UDP candidates to be toggled.  This
is useful in cases where someone is using this element in an environment
where it is known in advance whether a given transport will work or not
and will prevent wasting time generating and checking candidate pairs
that will not succeed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1223>
2020-05-11 05:30:59 +00:00
Matthew Waters
18de5f8f04 webrtc: remove debugging leftover
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1247>
2020-05-06 15:49:58 +10:00
Matthew Waters
50644f5718 webrtc: always reply to a promise
Otherwise, we defeat the purpose of a promise.

We were not replying when the state was closed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1240>
2020-05-06 02:53:27 +00:00
Matthew Waters
1f395e3ddb webrtc: name threads based on the element name
Makes debugging a busy loop possibly easier

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1240>
2020-05-06 02:53:27 +00:00
Matthew Waters
d552c6556c webrtc: correctly use the pad template
GstHarness uses this for releasing request pads correctly. Fixes
numerous leaks in the webrtc unit tests.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1240>
2020-05-06 02:53:27 +00:00
Matthew Waters
46176fbcc7 webrtc: Fix a couple of renegotiation races
When negotiating the SDP we should only connect the streams that are
actually mentioned in the SDP.  All other streams are not relevant at
this time and would likely be part of a future SDP update.  Fixes a
couple of the renegotiation webrtc unit tests.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1240>
2020-05-06 02:53:27 +00:00
Matthew Waters
b266652043 webrtcbin: also mark data channel transports as active
Fixes negotiation of a bundled sdp with only a data channel.

Without marking the transport as active, we would never unblock the
transportreceivebin and thus no data would ever reach us.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1231>
2020-05-01 03:13:46 +00:00
Matthew Waters
ce9b41f5d4 webrtcbin: fix bundle none case with remote offer bundling
If the remote is bundling, but we are not and remote is offering.
we cannot put the remote media sections into a bundled transport as that
is not how we are going to respond.

This specific failure case was that the remote ICE credentials were
never set on the ice stream and so ice connectivity would fail.

Technically, this whole bunde-policy=none handling should be removed
eventually when we implement bundle-policy=balanced.  Until such time,
we have this workaround.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1231>
2020-05-01 03:13:46 +00:00
Matthew Waters
80ede09193 webrtcbin: only start gathering on local descriptions
If we are in a state where we are answering, we would start gathering
when the offer is set which is incorrect for at least two reasons.

1. Sending ICE candidates before sending an answer is a hard error in
   all of the major browsers and will fail the negotiation.
2. If libnice ever adds the username fragment to the candidate for
   ice-restart hardening, the ice username and fragment would be
   incorrect.

JSEP also hints that the right call flow is to only start gathering when
a local description is set in 4.1.9 setLocalDescription

"This API indirectly controls the candidate gathering process."

as well as hints throughout other sections.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1226>
2020-04-30 14:47:55 +00:00
Matthew Waters
319a5e5779 webrtc: mark streams as active on renegotiation as well.
Otherwise when bundling, only the changed streams would be considered as
to whether the bundled transport needs to be blocked as all streams are
inactive.

Scenario is one transceiver changes direction to inactive and as that is
the only change in transciever direction, the entire bundled transport would
be blocked even if there are other active transceivers inside the same bundled
transport that are still active.

Fix by always checking the activeness of a stream regardless of if the
transceiverr has changed direction.
2020-03-25 14:46:15 +11:00
Sebastian Dröge
5a2053e0af webrtcbin: Use GPtrArrays or store items inline instead of using GArrays of pointers 2020-03-09 21:38:42 +02:00
Jan Schmidt
8274fcd311 webrtcbin: Prevent ICE gathering state reaching complete early
The ICE gathering state can transition to complete prematurely if the
underlying ICE components complete their gathering while the initial
ICE gathering state task is queued and still pending.

In that situation, the ice gathering state task will report complete
while there are still ICE candidates queued for emission.

Prevent that by storing ICE candidates in an array and checking if
there are any pending before reporting a completed ICE gathering
state.
2020-03-10 05:47:40 +11:00
Jan Schmidt
9410ef56b8 webrtc: Protect the pending ICE candidates array
ICE candidates can be added to the array directly from the application
or from the webrtc main loop. Rename it to make it clear that it's
holding remote ICE candidates from the peer, and protect it with a
new mutex
2020-03-10 05:25:40 +11:00
Jan Schmidt
ad53de1da1 webrtc: Don't crash in ICE gathering
Fix a crash collating ICE gathering states if there are
unassociated transceivers in the list with no TransportStream
2020-03-04 23:06:52 +00:00
Jan Schmidt
905988c63f webrtc: Unblock transportreceivebin for send-only bundled streams
If there is any active mline in a bundle, we need to unblock
the transportreceivebin for DTLS setup and RTCP reception,
otherwise no data can ever start flowing.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1206
2020-03-04 10:15:19 +00:00
Jan Schmidt
cb48733ff3 webrtc: Remove RECEIVE_STATE_DROP from transportreceivebin
As per discussion in the bug, remove the drop state from transportreceivebin.
Dropping data is necessary, but for bundled config, needs to happen
further downstream after mixed flows have been separated.

Also support switching back to BLOCK from PASS state.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1206
2020-03-04 10:15:19 +00:00
Jan Schmidt
96a407334d webrtc: Merge ICE candidates to local descriptions
When emitting ICE candidates, also merge them to the local and
pending description so they show up in the SDP if those are
retrieved from the current-local-description and
pending-local-description properties.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/676
2020-02-17 14:23:56 +00:00