Commit graph

148 commits

Author SHA1 Message Date
Matthew Waters
a78c907597 webrtc: only add nack pli by default if kind is video
Sending/receiving PLI's (Picture Loss Indication) for non-video doesn't
really make sense.  This also matches what the browsers do.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2220>
2021-05-06 12:19:51 +00:00
Matthew Waters
1470660976 webrtc: move webrtc_kind_from_caps() to utils
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2220>
2021-05-06 12:19:51 +00:00
François Laignel
ad3d7d34cc Use gst_element_request_pad_simple...
Instead of the deprecated gst_element_get_request_pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2180>
2021-05-05 06:17:14 +00:00
Matthew Waters
5835f2aa8d webrtc: advertise support for transport-cc rtcp-fb by default
Still requires explicit enabling by the application through the header
extension on all the relevant payloaders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2207>
2021-04-29 22:01:54 +10:00
Nazar Mokrynskyi
fe190fb5eb webrtcbin: downgrade "dropping ICE candidates from SDP" from warning to debug level
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2187>
2021-04-23 00:15:26 +00:00
Olivier Crête
c690be3e03 webrtcbin: Attach rtpbin even for data channels
This is required because the same transport may later be used for RTP.
In which case the RTCP needs to flow bi-directionnally already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2172>
2021-04-22 22:15:31 +00:00
Olivier Crête
813a320c06 webrtcbin: Filter caps isn't fixed
Fix an assertion because the filter paramter passed to
gst_caps_is_equal_fixed() wasn't fixed. So use the regular
gst_caps_is_equal() instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2175>
2021-04-19 19:06:50 -04:00
Olivier Crête
d67dcb2227 webrtcbin: Simplify answer_caps intersection code a little
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
12ab469ad3 webrtcbin: Move GstPromise reply to operation framework
This makes it possible to reply to all promises in a consistent way
without having to do a unlock/relock that is always risky.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
38ef12063d webrtcbin: Make sure PC_LOCK is release when replying to promise
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
913383166b webrtcbin: Take PC lock around all entry points
All of those action signals change the internal state, so
protect it by using the PC_LOCK

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
572c2b6783 webrtcbin: Take PC_LOCK when requesting new pad
This is needed to avoid having the state change under us.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
Olivier Crête
c7107fd940 webrtcbin: Ensure that query caps method returns valid caps
This means rejecting any caps that aren't fixed. Also, use a filter
that will create unfixed caps if the other side just returns ANY.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
2021-04-12 18:37:27 -04:00
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
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