diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2019-01-17 15:06:06 +0100 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2019-01-23 22:47:51 +0000 |
commit | 85c75bb23b100a5d4f01cfac0dc8fbb9bcb2780c (patch) | |
tree | 698f206d5faa13fe38648e0f7f8d66970b9729f1 /ext | |
parent | 73c6530d400e8758fa30215b1a17b62d92cd3703 (diff) | |
download | gstreamer-plugins-bad-85c75bb23b100a5d4f01cfac0dc8fbb9bcb2780c.tar.gz |
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.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/webrtc/gstwebrtcbin.c | 21 | ||||
-rw-r--r-- | ext/webrtc/gstwebrtcbin.h | 1 | ||||
-rw-r--r-- | ext/webrtc/gstwebrtcice.c | 19 |
3 files changed, 37 insertions, 4 deletions
diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index 9f8ac670c..472f779a5 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -273,8 +273,7 @@ gst_webrtc_bin_pad_new (const gchar * name, GstPadDirection direction) G_DEFINE_TYPE_WITH_CODE (GstWebRTCBin, gst_webrtc_bin, GST_TYPE_BIN, G_ADD_PRIVATE (GstWebRTCBin) GST_DEBUG_CATEGORY_INIT (gst_webrtc_bin_debug, "webrtcbin", 0, - "webrtcbin element"); - ); + "webrtcbin element");); static GstPad *_connect_input_stream (GstWebRTCBin * webrtc, GstWebRTCBinPad * pad); @@ -325,6 +324,7 @@ enum PROP_STUN_SERVER, PROP_TURN_SERVER, PROP_BUNDLE_POLICY, + PROP_ICE_TRANSPORT_POLICY, }; static guint gst_webrtc_bin_signals[LAST_SIGNAL] = { 0 }; @@ -4712,6 +4712,12 @@ gst_webrtc_bin_set_property (GObject * object, guint prop_id, webrtc->bundle_policy = g_value_get_enum (value); } break; + case PROP_ICE_TRANSPORT_POLICY: + webrtc->ice_transport_policy = g_value_get_enum (value); + g_object_set (webrtc->priv->ice, "force-relay", + webrtc->ice_transport_policy == + GST_WEBRTC_ICE_TRANSPORT_POLICY_RELAY ? TRUE : FALSE, NULL); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -4773,6 +4779,9 @@ gst_webrtc_bin_get_property (GObject * object, guint prop_id, case PROP_BUNDLE_POLICY: g_value_set_enum (value, webrtc->bundle_policy); break; + case PROP_ICE_TRANSPORT_POLICY: + g_value_set_enum (value, webrtc->ice_transport_policy); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -4958,6 +4967,14 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass) GST_WEBRTC_BUNDLE_POLICY_NONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, + PROP_ICE_TRANSPORT_POLICY, + g_param_spec_enum ("ice-transport-policy", "ICE Transport Policy", + "The policy to apply for ICE transport", + GST_TYPE_WEBRTC_ICE_TRANSPORT_POLICY, + GST_WEBRTC_ICE_TRANSPORT_POLICY_ALL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstWebRTCBin::create-offer: * @object: the #GstWebRtcBin diff --git a/ext/webrtc/gstwebrtcbin.h b/ext/webrtc/gstwebrtcbin.h index 732ac386c..84158e887 100644 --- a/ext/webrtc/gstwebrtcbin.h +++ b/ext/webrtc/gstwebrtcbin.h @@ -81,6 +81,7 @@ struct _GstWebRTCBin GstWebRTCSessionDescription *pending_remote_description; GstWebRTCBundlePolicy bundle_policy; + GstWebRTCICETransportPolicy ice_transport_policy; GstWebRTCBinPrivate *priv; }; diff --git a/ext/webrtc/gstwebrtcice.c b/ext/webrtc/gstwebrtcice.c index 595d90e55..e3da7836b 100644 --- a/ext/webrtc/gstwebrtcice.c +++ b/ext/webrtc/gstwebrtcice.c @@ -59,6 +59,7 @@ enum PROP_TURN_SERVER, PROP_CONTROLLER, PROP_AGENT, + PROP_FORCE_RELAY, }; static guint gst_webrtc_ice_signals[LAST_SIGNAL] = { 0 }; @@ -79,8 +80,8 @@ struct _GstWebRTCICEPrivate #define gst_webrtc_ice_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstWebRTCICE, gst_webrtc_ice, GST_TYPE_OBJECT, G_ADD_PRIVATE (GstWebRTCICE) - GST_DEBUG_CATEGORY_INIT (gst_webrtc_ice_debug, "webrtcice", 0, "webrtcice"); - ); + GST_DEBUG_CATEGORY_INIT (gst_webrtc_ice_debug, "webrtcice", 0, + "webrtcice");); static gboolean _unlock_pc_thread (GMutex * lock) @@ -826,6 +827,10 @@ gst_webrtc_ice_set_property (GObject * object, guint prop_id, g_object_set_property (G_OBJECT (ice->priv->nice_agent), "controlling-mode", value); break; + case PROP_FORCE_RELAY: + g_object_set_property (G_OBJECT (ice->priv->nice_agent), + "force-relay", value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -858,6 +863,10 @@ gst_webrtc_ice_get_property (GObject * object, guint prop_id, case PROP_AGENT: g_value_set_object (value, ice->priv->nice_agent); break; + case PROP_FORCE_RELAY: + g_object_get_property (G_OBJECT (ice->priv->nice_agent), + "force-relay", value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -924,6 +933,12 @@ gst_webrtc_ice_class_init (GstWebRTCICEClass * klass) "ICE agent in use by this object", NICE_TYPE_AGENT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, + PROP_FORCE_RELAY, + g_param_spec_boolean ("force-relay", "Force Relay", + "Force all traffic to go through a relay.", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstWebRTCICE::on-ice-candidate: * @object: the #GstWebRtcBin |