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);
* 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",
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)
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);
_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);
'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'])