Commit graph

90 commits

Author SHA1 Message Date
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
Matthew Waters
f0a4713932 webrtc/stats: rename debug category not to be ice related 2018-09-21 19:36:52 +10:00
Mathieu Duponchelle
45fe050286 webrtcice: do not run host resolution from applictation thread
g_resolver_lookup_by_name is a blocking call, and should not
be run when the user sets or adds a turn-server.

https://bugzilla.gnome.org/show_bug.cgi?id=797012
2018-09-19 16:17:24 +02:00
Mathieu Duponchelle
1d6160d59c webrtcbin: New add-turn-server API
It is possible and often desirable to pass multiple ICE relays
to libnice agents, the "turn-server" property, while convenient
to use from the command line, does not allow that.

This adds a new action signal, "add-turn-server" to address that.

https://bugzilla.gnome.org/show_bug.cgi?id=797012
2018-09-19 16:17:24 +02:00
Matthew Waters
515e2d765a meson: add pkg-config file for the webrtc plugin 2018-08-31 18:08:55 +10:00
Nirbheek Chauhan
b55dfb5313 Add feature options for almost all plugins
The only plugins remaining are those that haven't been ported to Meson
yet, and msdk. Also, the tests are still automagic.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 19:04:38 +05:30
Sam Gigliotti
1b095e9609 webrtc: fix memory leak
When it parses SDP, it doesn't free the error object.

https://bugzilla.gnome.org/show_bug.cgi?id=796830
2018-07-19 14:30:55 +01:00
Jan Schmidt
e6a564216d webrtc: Add a warning in sdp_media_from_transceiver()
When generating caps with no ssrc, at least throw a
warning instead of using an uninitialised stack variable

https://bugzilla.gnome.org/show_bug.cgi?id=796810
2018-07-15 23:07:21 +10:00
Jan Schmidt
76a93da2a7 webrtc: Fix memory leak
Fix a leaked string when building RTX info.
2018-07-14 23:20:13 +10:00
Jan Schmidt
15d3bc9870 webrtc: Clean up and fix transportsendbin
Refactor transportsendbin, and change the way
pads are blocked on dtlssrtpenc so that they
don't interfere with state changes.

As well as being easier to read, this fixes
spurious failures shutting down webrtcbin
if DTLS negotiation hasn't completed yet.
2018-07-14 23:20:13 +10:00
Jan Schmidt
cb750efd6c webrtc: Move dtlssrtpenc state management
Move the errant piece of dtlssrtpenc state change
management from dtlstransport in the Webrtc libs,
into the transportsendbin that does the rest of
the element management so it's all in one place.
2018-07-14 23:18:50 +10:00
Mathieu Duponchelle
6fd3e2a400 find_codec_preferences: use received caps
When negotiation is triggered by receiving caps on our sink pad
probes, we could encounter a race condition where need-negotiation
is emitted and the application requires the creation of an offer
before the current caps were actually updated.

This led to retrieving incomplete caps when creating the offer,
using find_codec_preferences -> pad_get_current_caps.

Instead, as we save the caps in the probe callback anyway, it is better
and thread safe to use these if they were set.

https://bugzilla.gnome.org/show_bug.cgi?id=796801
2018-07-12 21:39:41 +02:00
Jan Schmidt
27b28f3aec webrtc: Explicitly initialise mutex and condition
Fixes random crashes when an allocated webrtcbin isn't
given fresh 0-filled memory in its allocation. It works
mostly because GMutex and GCond are automatically initialised
in that case.
2018-07-01 10:44:45 +10:00
Jan Schmidt
0fca02bb5e webrtc: Move the transportsendbin pad block removal
Move freeing of the pad blocks back to before we call the
GstBin state change function, as there's something racy
going on on the build server otherwise, where the pads don't
unblock during downward state changes.

This is a bit of a stab in the dark, since I can't recreate
the build server failure locally.
2018-06-30 01:07:32 +10:00
Jan Schmidt
bc128d6100 webrtc: Clean up pad block allocs on dispose.
Release references in pad blocks and release the memory in the
dispose function too, in case the state change doesn't get
run (because calling the parent state change fails).
2018-06-27 22:44:26 +10:00
Jan Schmidt
ed90d3b2ec webrtc: Don't deadlock on block pads on shutdown
When changing state downward, we can't set pads
to inactive if they are blocked, it will deadlock
trying to acquire the streaming lock.

Just calling the parent state change function
will do the correct things to unblock probes and
set the pad inactive, so let it do that and
remove the probes after the parent state change
function has run

https://bugzilla.gnome.org/show_bug.cgi?id=796682
2018-06-27 22:44:26 +10:00
Tim-Philipp Müller
6f46792f0f webrtc: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 00:17:26 +02:00
Mathieu Duponchelle
33c7af8845 webrtcbin: copy sticky events on our ghostpads
This lets users call gst_pad_get_current_caps on newly-added
pads to easily determine what to plug them into.

We cannot copy sticky events unconditionally in core,
see #719437

https://bugzilla.gnome.org/show_bug.cgi?id=796387
2018-05-29 13:07:30 +02:00
Tim-Philipp Müller
ed7a98d45b webrtcbin: rtpstorage takes a 64-bit integer for "size-time" property
https://bugzilla.gnome.org/show_bug.cgi?id=796429
2018-05-28 10:43:37 +01:00
Tim-Philipp Müller
2227ef1304 meson: fix libnice fallback options 2018-05-21 14:42:56 +01:00
Tim-Philipp Müller
69fcd6391a webrtc: add some default options for libnice fallback
The tests are not very reliable, so disable for now.
2018-05-19 12:25:02 +01:00
Mathieu Duponchelle
5c450c5992 webrtcbin: implement support for FEC and RTX
https://bugzilla.gnome.org/show_bug.cgi?id=795044
2018-05-09 14:46:14 +02:00
Nirbheek Chauhan
7f7324b3e6 meson: Add a subproject fallback for libnice in webrtc 2018-05-05 18:48:13 +05:30
Sebastian Dröge
8375e33965 webrtcbin: Remove parameter from gst_webrtc_rtp_sender_new() 2018-03-16 11:07:01 +02:00
Matthew Waters
6f50d35246 webrtc: Fix ffeb09e4 conditional
Fixes ffeb09e4ab

if (sscanf(...)) {  // != 0
  error;
}

Is not correct where != 0 indicates some kind of success.

Check instead that the correct number of elements were slurped.
2018-02-08 15:51:35 +11:00
Matthew Waters
7e6b4dcb49 webrtc: change dead code to an assert
CID #1429140
2018-02-08 15:47:33 +11:00
Matthew Waters
ffeb09e4ab webrtc: bail on invalid rtpbin names
If we fail parsing rtpbin pad names, someone has screwed up so critical
and return.

CID #1429142
2018-02-08 15:29:56 +11:00
Matthew Waters
1894293d63 webrtcbin: an element that handles the transport aspects of webrtc connections
SDP's are generated and consumed according to the W3C PeerConnection API
available from https://www.w3.org/TR/webrtc/

The SDP is either created initially from the connected
sink pads/attached transceivers as in the case of generating an offer or
intersected with the connected sink pads/attached transceivers as in
the case for creating an answer.  In both cases, the rtp payloaded streams
sent by the peer are exposed as separate src pads.

The implementation supports trickle ICE, RTCP muxing, reduced size RTCP.

With contributions from:
Nirbheek Chauhan <nirbheek@centricular.com>
Mathieu Duponchelle <mathieu@centricular.com>
Edward Hervey <edward@centricular.com>

https://bugzilla.gnome.org/show_bug.cgi?id=792523
2018-02-02 15:02:21 +11:00