Commit graph

77 commits

Author SHA1 Message Date
Ali Yousuf 69e06ced7d webrtc: Fix log when adding stun server 2019-06-04 07:54:25 +00:00
Matthew Waters 95488812b2 webrtc: fix the location of signalling-state change notification
1. The spec indicates that the notification should occur near the end of
   'setting the description' processing
2. The current location with the drop of the lock could cause the 'check
   if negotiation is needed' logic to execute and become confused about
   the state of the webrtcbin's current local descriptions.
   In the bad case, the following assertions could be hit:
   g_assert (trans->mline < gst_sdp_message_medias_len (webrtc->current_local_description->sdp));
   g_assert (trans->mline < gst_sdp_message_medias_len (webrtc->current_remote_description->sdp));

Moving the signalling state change later in the set description task
means that checking for a renegotiation will early abort as the
signalling state is not STABLE before the session description and
transceivers have been updated.
2019-06-04 05:43:43 +00:00
Matthew Waters f8911deccf webrtc: only set sctp ports if they are different
SCTPassociation will complain if we do that while running and resetting
is not something we support at the moment
2019-05-30 21:33:09 +10:00
Matthew Waters 979daea7f2 tests/webrtc: fix racy test with a prenegotiated data channel
If both data channels become ready simultaneously, then the two integer
read-add-update cycles can execute concurrently and only ever increment
once instead of the required twice.  Use an atomic add instead.
2019-05-30 21:33:09 +10:00
Matthew Waters be011d2086 webrtc/dc: move some code from webrtcbin into the datachannel 2019-05-30 21:33:09 +10:00
Matthew Waters a51db86ac4 webrtc: hold onto any unknown ICE candidates until the next SDP set
It is very possible for badly behaving signalling or peers to send
us ICE candidates before we receive an SDP.  While we had consideration
for that on the first set SDP, subsequent SDP's could result in
misconfigured ICE transports.  Expand the previous code to also take
into account reconfigurations.
2019-05-30 21:33:09 +10:00
Matthew Waters 177aa22bcd webrtc: Initial support for stream addition/removal
Limitations:
- No transport changes at all (ICE, DTLS)
- Codec changes are untested and probably don't work
- Stream removal doesn't remove transports (i.e. non-bundled transports
  will stay around until webrtcbin is shutdown)
- Unified Plan SDP only. No Plan-B support.
2019-05-30 21:33:09 +10:00
Matthew Waters 033e55695f webrtcbin: expose the transceiver as a pad property 2019-05-30 21:33:09 +10:00
Matthew Waters c3c4b07ad3 webrtc/transceiver: add a set_direction function
Matches the setDirection() from the W3C spec and allows changing the
transceiver direction at the next negotiation cycle.
2019-05-30 21:33:09 +10:00
Matthew Waters 6ad0edbe92 webrtc: track and log more rtpbin state
like bye's timeouts, validation, activation, etc
2019-05-30 21:33:09 +10:00
Matthew Waters 2df7da85fe webrtc: add support for intersecting inactive transceiver directions 2019-05-30 21:33:09 +10:00
Matthew Waters 5ea7031bd0 webrtc: mark remote/local-description as readonly 2019-05-30 21:32:06 +10:00
Matthew Waters 19b3d744d8 webrtc: don't reuse stopped transceivers at all 2019-05-30 21:26:46 +10:00
Matthew Waters 4d34fe7617 webrtc: also check for a null mid to signify an unassociated transceiver
We always give our transceivers an mline on creation so that check is
not useful by itself
2019-05-30 21:26:46 +10:00
Matthew Waters 00977f263a webrtc: only check sink pads for a 'sink pads have caps' check 2019-05-30 21:26:46 +10:00
Matthew Waters bd92b2f7c4 webrtc: fix answer creation with multiple streams and similar caps 2019-05-30 21:26:46 +10:00
Philippe Normand 9595a7a721 webrtcbin: Expose current and pending local/remote description properties
They are already handled in the property getter and setter functions but were
not formally declared in the GObject class.
2019-05-30 10:35:58 +01:00
Niels De Graef 7cd4064425 webrtc: Fix some signals' GIR annotations
This will lead to wrong bindings otherwise (and creates more correct
expectations for developers).
2019-05-17 15:28:54 +02:00
Thibault Saunier 47a49f3381 docs: Build documentation with hotdoc 2019-05-13 17:00:00 -04:00
Thibault Saunier 7fe3f36ac8 Minor documentation fixes 2019-05-13 11:36:27 -04:00
Niels De Graef ce92cb81a0 webrtc: Fix signals documentation
Some GIR annotations were incorrect or even missing. The former isn't
good for bindings, while the latter is especially annoying for signal
handlers, as that means your arguments will get the wrong names in the
rendered documentation.
2019-05-09 14:19:01 +02:00
Mathieu Duponchelle a2779ef366 webrtcbin: fix pt selection for FEC and RTX when BUNDLE
When we offer bundled media, payload types must be unique
across all bundled media, as they will be multiplexed in the
same session.
2019-03-15 18:37:51 +01:00
Mathieu Duponchelle 08858d753c webrtcbin: add get-transceiver signal
get-transceivers is not introspectable, and a method to get a
transceiver by index is convenient.
2019-03-12 21:04:48 +00:00
Jan Alexander Steffens (heftig) dc0e95acab webrtcbin: Filter transport stream stats by ssrc
Since the addition of BUNDLE support, the pads and the transceivers
share a single transport stream. When getting stats from the stream,
filter by the ssrc of the current pad to avoid merging the stats for
different pads.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/889
2019-03-12 01:40:59 +00:00
Jan Alexander Steffens (heftig) 926ff109b9 webrtcbin: Syntax cleanup 2019-03-12 01:40:59 +00:00
Matthew Waters 2a1176973a webrtc: fix rtx + bundle
If bundle was used in combination with rtx, only the bundled transport
stream would have correctly configured rtx parameters.

Iterate over the payloads upfront in the bundled case to ensure the
correct payload mapping is set for the RTX elements.
2019-02-15 08:19:51 +00:00
Mathieu Duponchelle 85c75bb23b webrtc: expose ice-transport-policy property
This is the equivalent of iceTransportPolicy in the RTCConfiguration
dictionary.

Only two values are implemented:

* all: default behaviour
* relay: only gather relay candidates

The third member of the iceTransportPolicy enum, "public", is
obsolete.
2019-01-23 22:47:51 +00:00
Tim-Philipp Müller 9eb7f7cbc7 webrtc: include stdlib.h for atoi()
Fixes #857
2018-12-31 12:09:42 +00:00
Matthew Waters b4bdcf15b7 webrtc/receive-bin: block pads before dtlssrtpdec:
Fixes SSL errors in fast-start scenarios and whenever media stream may
be received before an answer is set.
2018-12-19 00:44:06 +00:00
Matthew Waters 26a5cbddbb webrtcbin: only change the receive state after setting the dtls-client
Doing so before will cause SSL errors with fast-start implementations
like Chrome or if media data arrives before an answer.
2018-12-19 00:44:06 +00:00
Matthew Waters 0a3f662ed6 webrtc: A couple of documentation fixes
set-*-description only takes the combined GstWebRTCSessionDescription
object
2018-12-19 00:44:06 +00:00
Nirbheek Chauhan 9504fc7174 meson: Add missing gio dep to webrtcbin plugin
It's usually pulled in implicitly through gstsdp_dep, but it's
actually a private dependency there. Fixes a build failure on Windows
with newer Meson.
2018-12-05 19:58:44 +05:30
Jordan Petridis 1f562870ee Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 14:18:26 +00:00
Matthew Waters 57a006d8a5 tests/webrtc: use the existing functions in the plugin
Instead of redefining our own, use the function implementations in
webrtcsdp.c and utils.c
2018-11-26 17:13:08 +11:00
Matthew Waters 14ee6f9d35 webrtc: fix typo in RTCRemoteOutboundRTPStreamStats 2018-11-26 16:21:58 +11:00
Matthew Waters a42fdbb012 webrtc: add a few comments on bundle and src pad exposure 2018-11-26 16:21:19 +11:00
Matthew Waters 6f91a191de webrtcbin: factor out dtls fingerprint setting 2018-11-26 16:20:02 +11:00
Matthew Waters 3a2566c61f webrtc: remove extra 'pad' from log line 2018-11-26 16:12:03 +11:00
Matthew Waters 5ecca0bb22 webrtc: move some functions to the appropriate files 2018-11-26 16:07:57 +11:00
Harshad Khedkar 9ad618e487 Webrtcbin : Need to use 'host' from gst_uri_get_host s libnice agent expects it
Currently master code of gst1-plugins-bad use plain-string host name while passing it to
libnice agent: nice_agent_set_relay_info() in gstwebrtcice.c while adding turn_server(_add_turn_server).

It is observered that if we don't convert the host parameter by using gst_uri_get_host, it fails in libnice agent(0.1.14-1).

Code does, actually, set the host correctly but while passing params to nice_agent_set_relay_info, it uses incorrect one.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/823
2018-11-22 18:47:13 +05:30
Tim-Philipp Müller 247cd2113e webrtc: update default libnice options
Uses feature options now.
2018-11-02 20:16:56 +00:00
Luis de Bethencourt 16c1eee36f webrtcbin: options is a placeholder argument
Make it clear this unused argument is there for planned future use.
2018-10-26 15:15:57 +01:00
Luis de Bethencourt 83b29b813e webrtcbin: ws-semantic is not supported
Don't offer something that isn't supported.
2018-10-26 14:36:47 +01:00
Mathieu Duponchelle 9f684a2f81 webrtcbin: implement support for group: BUNDLE 2018-10-15 14:17:35 +02:00
Matthew Waters 21bf3a35ac webrtc/datachannel: fix support for prenegotiated channels
With prenegotiated channels, the data-channel protocol is not used and
instead the channel's negotiation is intended to be performed out of band in
some application-specific manner.

Comes with test!
2018-10-09 02:38:14 +11:00
Matthew Waters 7bf18ad258 webrtc: start in the closed state
This means that we will reject all operations before we've transitioned
into READY.

This also fixes the tests using the default GMainContext in the NULL
state instead of the webrtcbin internal GMainContext and thread.  Also
removes a potential ordering race where on the element transitioning to
READY, an operations could have been queued on two different threads and
removing a guarentee on operation ordering.
2018-10-08 21:56:31 +11:00
Aleix Conchillo Flaqué c4fe52395b webrtcbin: start and stop thread when changing state
It might be possible that if we set webrtcbin to the NULL state some
tasks (idle sources) are still executed and they might even freeze. The freeze
is caused because the webrtcbin tasks don't hold a reference to webrtcbin and
if it's last unref inside the idle source itself this will not allow the main
loop to finish because the main loop is waiting on the idle source to finish.

We now start and stop webrtcbin thread when changing states. This will allow
the idle sources to finish properly.

https://bugzilla.gnome.org/show_bug.cgi?id=797251
2018-10-08 13:46:55 +11:00
Matthew Waters 8e8eb41ddf webrtcdatachannel: take ref of data so it doesn't disappear 2018-09-26 16:01:57 +10:00
Matthew Waters 07e9374eff webrtcbin: add support for data channels based on SCTP
Mostly follows the W3C specification
https://www.w3.org/TR/webrtc/#peer-to-peer-data-api

With contributions from:
Mathieu Duponchelle <mathieu@centricular.com>

https://bugzilla.gnome.org/show_bug.cgi?id=794351
2018-09-21 19:45:12 +10:00
Matthew Waters cf46d49b1e webrtcbin: functionify dependent element checks 2018-09-21 19:36:52 +10:00