From 9937101e5141489bf10d9b5a6b6cf004705e527e Mon Sep 17 00:00:00 2001 From: Chris Ayoup Date: Thu, 30 Apr 2020 16:01:13 +0000 Subject: [PATCH] webrtc: move filtering properties to webrtcice We want webrtcbin to only expose properties that are defined in JSEP, so these additional properties should be moved out. In order to access them, the webrtcice instance is exposed from webrtcbin. Part-of: --- ext/webrtc/gstwebrtcbin.c | 51 ++++++--------------------------------- ext/webrtc/gstwebrtcice.c | 18 +++++++++++++- ext/webrtc/gstwebrtcice.h | 2 -- 3 files changed, 25 insertions(+), 46 deletions(-) diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index 02606baa1d..f51ebae30c 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -348,7 +348,6 @@ enum ADD_TURN_SERVER_SIGNAL, CREATE_DATA_CHANNEL_SIGNAL, ON_DATA_CHANNEL_SIGNAL, - ADD_LOCAL_IP_ADDRESS_SIGNAL, LAST_SIGNAL, }; @@ -369,8 +368,7 @@ enum PROP_TURN_SERVER, PROP_BUNDLE_POLICY, PROP_ICE_TRANSPORT_POLICY, - PROP_ICE_TCP, - PROP_ICE_UDP, + PROP_ICE_AGENT, }; static guint gst_webrtc_bin_signals[LAST_SIGNAL] = { 0 }; @@ -5025,18 +5023,6 @@ gst_webrtc_bin_add_turn_server (GstWebRTCBin * webrtc, const gchar * uri) return gst_webrtc_ice_add_turn_server (webrtc->priv->ice, uri); } -static gboolean -gst_webrtc_bin_add_local_ip_address (GstWebRTCBin * webrtc, - const gchar * address) -{ - g_return_val_if_fail (GST_IS_WEBRTC_BIN (webrtc), FALSE); - g_return_val_if_fail (address != NULL, FALSE); - - GST_DEBUG_OBJECT (webrtc, "Adding local IP address: %s", address); - - return gst_webrtc_ice_add_local_ip_address (webrtc->priv->ice, address); -} - static gboolean copy_sticky_events (GstPad * pad, GstEvent ** event, gpointer user_data) { @@ -5852,8 +5838,6 @@ gst_webrtc_bin_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_STUN_SERVER: case PROP_TURN_SERVER: - case PROP_ICE_TCP: - case PROP_ICE_UDP: g_object_set_property (G_OBJECT (webrtc->priv->ice), pspec->name, value); break; case PROP_BUNDLE_POLICY: @@ -5925,8 +5909,6 @@ gst_webrtc_bin_get_property (GObject * object, guint prop_id, break; case PROP_STUN_SERVER: case PROP_TURN_SERVER: - case PROP_ICE_TCP: - case PROP_ICE_UDP: g_object_get_property (G_OBJECT (webrtc->priv->ice), pspec->name, value); break; case PROP_BUNDLE_POLICY: @@ -5935,6 +5917,9 @@ gst_webrtc_bin_get_property (GObject * object, guint prop_id, case PROP_ICE_TRANSPORT_POLICY: g_value_set_enum (value, webrtc->ice_transport_policy); break; + case PROP_ICE_AGENT: + g_value_set_object (value, webrtc->priv->ice); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -6198,16 +6183,10 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, - PROP_ICE_TCP, - g_param_spec_boolean ("ice-tcp", "ICE TCP", - "Whether the agent should use ICE-TCP when gathering candidates", - TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, - PROP_ICE_UDP, - g_param_spec_boolean ("ice-udp", "ICE UDP", - "Whether the agent should use ICE-UDP when gathering candidates", - TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + PROP_ICE_AGENT, + g_param_spec_object ("ice-agent", "WebRTC ICE agent", + "The WebRTC ICE agent", + GST_TYPE_WEBRTC_ICE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** * GstWebRTCBin::create-offer: @@ -6438,20 +6417,6 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass) G_CALLBACK (gst_webrtc_bin_add_turn_server), NULL, NULL, NULL, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); - /** - * GstWebRTCBin::add-local-ip-address: - * @object: the #GstWebRtcBin - * @address: The local IP address - * - * Add a local IP address to use for ICE candidate gathering. If none - * are supplied, they will be discovered automatically - */ - gst_webrtc_bin_signals[ADD_LOCAL_IP_ADDRESS_SIGNAL] = - g_signal_new_class_handler ("add-local-ip-address", - G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_CALLBACK (gst_webrtc_bin_add_local_ip_address), NULL, NULL, - g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); - /* * GstWebRTCBin::create-data-channel: * @object: the #GstWebRTCBin diff --git a/ext/webrtc/gstwebrtcice.c b/ext/webrtc/gstwebrtcice.c index 0b6da0d919..da9a07ecb0 100644 --- a/ext/webrtc/gstwebrtcice.c +++ b/ext/webrtc/gstwebrtcice.c @@ -48,6 +48,7 @@ enum SIGNAL_0, ON_ICE_CANDIDATE_SIGNAL, ON_ICE_GATHERING_STATE_CHANGE_SIGNAL, + ADD_LOCAL_IP_ADDRESS_SIGNAL, LAST_SIGNAL, }; @@ -670,7 +671,7 @@ done: return ret; } -gboolean +static gboolean gst_webrtc_ice_add_local_ip_address (GstWebRTCICE * ice, const gchar * address) { gboolean ret = FALSE; @@ -1018,6 +1019,21 @@ gst_webrtc_ice_class_init (GstWebRTCICEClass * klass) g_signal_new ("on-ice-candidate", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); + + /** + * GstWebRTCICE::add-local-ip-address: + * @object: the #GstWebRtcICE + * @address: The local IP address + * + * Add a local IP address to use for ICE candidate gathering. If none + * are supplied, they will be discovered automatically. Calling this signal + * stops automatic ICE gathering. + */ + gst_webrtc_ice_signals[ADD_LOCAL_IP_ADDRESS_SIGNAL] = + g_signal_new_class_handler ("add-local-ip-address", + G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_CALLBACK (gst_webrtc_ice_add_local_ip_address), NULL, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); } static void diff --git a/ext/webrtc/gstwebrtcice.h b/ext/webrtc/gstwebrtcice.h index 4146b41c43..f690d1cc97 100644 --- a/ext/webrtc/gstwebrtcice.h +++ b/ext/webrtc/gstwebrtcice.h @@ -81,8 +81,6 @@ gboolean gst_webrtc_ice_set_remote_credentials (GstWebRTCIC gchar * pwd); gboolean gst_webrtc_ice_add_turn_server (GstWebRTCICE * ice, const gchar * uri); -gboolean gst_webrtc_ice_add_local_ip_address (GstWebRTCICE * ice, - const gchar * address); G_END_DECLS #endif /* __GST_WEBRTC_ICE_H__ */