static gboolean set_the_candidates (gpointer user_data) { FsStreamTransmitter *st = FS_STREAM_TRANSMITTER (user_data); GList *candidates = g_object_get_data (G_OBJECT (st), "candidates-set"); gboolean ret; GError *error = NULL; if (!candidates) { g_debug ("Skipping libnice check because it found NO local candidates"); g_atomic_int_set(&running, FALSE); g_main_loop_quit (loop); return FALSE; } if (force_candidates) { GList *item = NULL; GList *next = NULL; GList *new_list = NULL; for (item = candidates; item; item = next) { FsCandidate *cand = item->data; GList *item2 = NULL; next = g_list_next (item); for (item2 = new_list; item2; item2 = g_list_next (item2)) { FsCandidate *cand2 = item2->data; if (cand2->component_id == cand->component_id) break; } if (!item2) { candidates = g_list_remove (candidates, cand); new_list = g_list_append (new_list, cand); } } ret = fs_stream_transmitter_force_remote_candidates (st, new_list, &error); fs_candidate_list_destroy (new_list); } else { ret = fs_stream_transmitter_add_remote_candidates (st, candidates, &error); } if (error) ts_fail ("Error while adding candidate: (%s:%d) %s", g_quark_to_string (error->domain), error->code, error->message); ts_fail_unless (ret == TRUE, "No detailed error setting remote_candidate"); fs_candidate_list_destroy (candidates); return FALSE; }
/** * fs_rtp_stream_add_remote_candidate: */ static gboolean fs_rtp_stream_add_remote_candidates (FsStream *stream, GList *candidates, GError **error) { FsRtpStream *self = FS_RTP_STREAM (stream); FsStreamTransmitter *st = fs_rtp_stream_get_stream_transmitter (self, error); gboolean ret = FALSE; if (!st) return FALSE; ret = fs_stream_transmitter_add_remote_candidates (st, candidates, error); g_object_unref (st); return ret; }
static gboolean set_the_candidates (gpointer user_data) { FsStreamTransmitter *st = FS_STREAM_TRANSMITTER (user_data); GList *candidates = g_object_get_data (G_OBJECT (st), "candidates-set"); gboolean ret; GError *error = NULL; if (!candidates) { g_debug ("Skipping libnice check because it found NO local candidates"); g_atomic_int_set(&running, FALSE); g_main_loop_quit (loop); return FALSE; } if (force_candidates) { GList *item = NULL; GList *next = NULL; GList *new_list = NULL; for (item = candidates; item; item = next) { FsCandidate *cand = item->data; GList *item2 = NULL; next = g_list_next (item); if (cand->type != FS_CANDIDATE_TYPE_HOST) continue; if (cand->component_id != 1) continue; for (item2 = candidates; item2; item2 = g_list_next (item2)) { FsCandidate *cand2 = item2->data; if (cand2->component_id == 2 && !strcmp (cand->foundation, cand2->foundation)) { new_list = g_list_append (new_list, cand); new_list = g_list_append (new_list, cand2); goto got_candidates; } } } ts_fail ("Could not find two matching host candidates???"); got_candidates: ts_fail_unless (g_list_length (new_list) == 2); ret = fs_stream_transmitter_force_remote_candidates (st, new_list, &error); } else { ret = fs_stream_transmitter_add_remote_candidates (st, candidates, &error); } if (error) ts_fail ("Error while adding candidate: (%s:%d) %s", g_quark_to_string (error->domain), error->code, error->message); ts_fail_unless (ret == TRUE, "No detailed error setting remote_candidate"); fs_candidate_list_destroy (candidates); return FALSE; }