Commit graph

204 commits

Author SHA1 Message Date
Olivier Crête
09c65fe534 webrtcbin: Associate the stream with a new transceiver
Otherwise, this newly created transceiver has no stream and it
aborts later when it tries to connect the input pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
83e546f935 webrtcbin: Match unassociated transceiver by kind too
When a new m-line comes in that doesn't have a transceiver, only match
existing transceivers of the same kind.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
7db5848376 webrtcbin: Fix typoe in name of error GstStructure
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
7f29486ba4 webrtcbin: Enforce direction on request sink pad with a specific name
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
5971a96109 webrtcbin: Try to match an existing transceiver on pad request
This should avoid creating extra transceivers that are duplicated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
2ca4cea538 webrtcbin: Validate locked m-lines in set*Description
Verify that the remote description match the locked m-lines, otherwise
just reject the SDP.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
be84cc2c54 webrtcbin: Remove unused session_mid_map
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
08dd305a20 webrtcbin: Enforce m-line restrictions when creating offer
First fail the offer creation if the mid of an existing offer doesn't
match a forced m-mline.

Then, for all newly added mlines, first look for a transceiver that
forces this m-line, then add a "floating" one, then the data channel.
And repeat this until we're out of transceivers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
ed1f0f33a2 webrtcbin: Remember if a transceiver had a forced m-line
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
92d356d4b0 webrtcbin: Enforce same-kind on request sink pad with a specific name
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
249b2d54d7 webrtcbin: Enforce compatible caps on pad request
If a pad is requested with certain caps and there is already a
transceiver, reject the pad request if the caps don't match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
902e40cae2 webrtcbin: Reject pad request for a specific m-line if it already exists
This way, the app developer is in control.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
0e2d128bec webrtcbin: Make request-pad validation an early return
This reduces the indendation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
0f758a1730 webrtcbin: Add document for webrtcbin itself to generated doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
3be72a6c86 webrtc: Reset received_caps when releasing pad
This is to work around a race where the pad is accessed in the
webrtc main thread while being released.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:07 -04:00
Olivier Crête
b6114a7fed webrtcbin: Split pad name from mline
The simple case where this breaks is if you add a
datachannel and want to add a new pad (a new media) after). Another
case where this is broken is if the order of the media is forced to
something different by the peer.

It's more simple to just split both things completely. In practice, the
pads will be named in the order in which they are allocated, so it
shouldn't change the current behaviour, just enable new ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 17:55:06 -04:00
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
Ilya Kreymer
92626535c7 webrtc ice: Add 'min/max-rtp-port' props for setting RTP port range
default min port == 0, max port == 65535 -- if min port == 0, uses existing random port selection (range ignored)
add 'gathering_started' flag to avoid changing ports after gathering has started
validity checks: min port <= max port enforced, error thrown otherwise
include tests to ensure port range is being utilized (by @hhardy)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/119>
2021-03-01 14:42:17 +00:00
Olivier Crête
3a3965e5cf webrtc ice: Only ever request one component, it's always rtcpmux
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/119>
2021-03-01 14:42:16 +00:00
Matthew Waters
b6038523c1 webrtcbin: use regular ice nomination by default
1. We don't currently deal with an a=ice-options in the SDP which means
   we currently violate https://tools.ietf.org/html/rfc5245#section-8.1.1
   which states: "If its peer is using ICE options (present in
   an ice-options attribute from the peer) that the agent does not
   understand, the agent MUST use a regular nomination algorithm."
2. The recommendation is default to regular nomination in both RFC5245
   and RFC8445.  libnice change for this is
   https://gitlab.freedesktop.org/libnice/libnice/-/merge_requests/125
   which requires an API break in libnice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2031>
2021-03-01 10:00:06 +00:00
Mathieu Duponchelle
86c009e7aa webrtc: expose transport property on sender and receiver
As advised by !1366#note_629558 , the nice transport should be
accessed through:

> transceiver->sender/receiver->transport/rtcp_transport->icetransport

All the objects on the path can be accessed through properties
except sender/receiver->transport. This patch addresses that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1952>
2021-01-13 19:22:42 +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
51ef4557b5 webrtcstats: PLI/FIR/NACK direction are the opposite of the media
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1924>
2020-12-29 15:07:03 -05: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
1deb034e3d webrtcstats: Get the remote-inbound stats from the right RTPSource
This also means that we need to get the clock-rate from the codec instead
of from the RTPSource, as the remote one doesn't include a clock rate.

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
23ea950351 webrtcstats: Also return the raw rtpsource stats for more information
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
b895240241 webrtcstats: Avoid copy of GstStructure
Instead transfer the ownership to the new structure

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
a46c6e3a97 webrtcstats: Remove receiver side when sending
Those are just invalid and just reflect what we sent. We'd need to parse the
RTCP XR packets from the other side to know more about those.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
ba0dfa52d2 webrtcstats: Extract statistics from the rtpjitterbuffer
And expose them as standardised webrtc statistics

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
d9d7814182 webrtcstats: Document all RTP missing fields according to the latest spec
Just document all the missing fields and document which ones will never
be implemented because they depend on the codec or depayloader

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
895ea210c2 webrtcstats: RTCP computed RTT is only available at sender
The receiver doesn't have the information to compute it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
2020-11-24 04:27:52 +00:00
Olivier Crête
a5c3331197 webrtcstats: Remove redundant lines
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
Raul Tambre
6d300ce785 webrtc: Update libnice version requirement to 0.1.17
Since !1366 nice_agent_get_sockets() is used, which requires 0.1.17.
Update the version requirement accordingly.

Fixes #1459.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1792>
2020-11-11 13:41:59 +02:00
Olivier Crête
da2bd55177 webrtc: Add properties to change the socket buffer sizes to ice object
libnice doesn't touch the kernel buffer sizes. When dealing with RTP data,
it's generally advisable to increase them to avoid dropping packets locally.
This is especially important when running multiple higher bitrate streams at
the same time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1366>
2020-11-03 22:07:53 +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