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>
This commit is contained in:
Olivier Crête 2020-03-25 20:50:01 -04:00
parent 671d9fed3a
commit 825a79f01f
3 changed files with 18 additions and 9 deletions

View file

@ -4869,10 +4869,12 @@ gst_webrtc_bin_add_ice_candidate (GstWebRTCBin * webrtc, guint mline,
item = g_new0 (IceCandidateItem, 1);
item->mlineindex = mline;
if (!g_ascii_strncasecmp (attr, "a=candidate:", 12))
item->candidate = g_strdup (attr);
else if (!g_ascii_strncasecmp (attr, "candidate:", 10))
item->candidate = g_strdup_printf ("a=%s", attr);
if (attr && attr[0] != 0) {
if (!g_ascii_strncasecmp (attr, "a=candidate:", 12))
item->candidate = g_strdup (attr);
else if (!g_ascii_strncasecmp (attr, "candidate:", 10))
item->candidate = g_strdup_printf ("a=%s", attr);
}
gst_webrtc_bin_enqueue_task (webrtc,
(GstWebRTCBinFunc) _add_ice_candidate_task, item,
(GDestroyNotify) _free_ice_candidate_item, NULL);
@ -6410,7 +6412,8 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass)
* GstWebRTCBin::add-ice-candidate:
* @object: the #webrtcbin
* @mline_index: the index of the media description in the SDP
* @ice-candidate: an ice candidate
* @ice-candidate: an ice candidate or NULL/"" to mark that no more candidates
* will arrive
*/
gst_webrtc_bin_signals[ADD_ICE_CANDIDATE_SIGNAL] =
g_signal_new_class_handler ("add-ice-candidate",

View file

@ -652,7 +652,7 @@ failure:
return FALSE;
}
/* must start with "a=candidate:" */
/* candidate must start with "a=candidate:" or be NULL*/
void
gst_webrtc_ice_add_candidate (GstWebRTCICE * ice, GstWebRTCICEStream * stream,
const gchar * candidate)
@ -664,6 +664,12 @@ gst_webrtc_ice_add_candidate (GstWebRTCICE * ice, GstWebRTCICEStream * stream,
item = _find_item (ice, -1, -1, stream);
g_return_if_fail (item != NULL);
if (candidate == NULL) {
nice_agent_peer_candidate_gathering_done (ice->priv->nice_agent,
item->nice_stream_id);
return;
}
cand =
nice_agent_parse_remote_candidate_sdp (ice->priv->nice_agent,
item->nice_stream_id, candidate);
@ -1080,8 +1086,8 @@ gst_webrtc_ice_constructed (GObject * object)
_start_thread (ice);
ice->priv->nice_agent = nice_agent_new (ice->priv->main_context,
NICE_COMPATIBILITY_RFC5245);
ice->priv->nice_agent = nice_agent_new_full (ice->priv->main_context,
NICE_COMPATIBILITY_RFC5245, NICE_AGENT_OPTION_ICE_TRICKLE);
g_signal_connect (ice->priv->nice_agent, "new-candidate-full",
G_CALLBACK (_on_new_candidate), ice);

View file

@ -15,7 +15,7 @@ webrtc_sources = [
'webrtcdatachannel.c',
]
libnice_dep = dependency('nice', version : '>=0.1.14', required : get_option('webrtc'),
libnice_dep = dependency('nice', version : '>=0.1.16', required : get_option('webrtc'),
fallback : ['libnice', 'libnice_dep'],
default_options: ['tests=disabled'])