static void _new_local_candidate (FsStream *stream, FsCandidate *candidate) { struct SimpleTestStream *st = g_object_get_data (G_OBJECT (stream), "SimpleTestStream"); gboolean ret; GError *error = NULL; struct SimpleTestStream *other_st = find_pointback_stream (st->target, st->dat); GList *candidates = NULL; g_debug ("%d:%d: Setting remote candidate for component %d", other_st->dat->id, other_st->target->id, candidate->component_id); candidates = g_list_prepend (NULL, candidate); ret = fs_stream_set_remote_candidates (other_st->stream, candidates, &error); g_list_free (candidates); 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 from add_remote_candidate"); }
static void skipped_cb (GObject *istream, GAsyncResult *result, gpointer user_data) { TestSession *ses = user_data; FsCandidate *cand; GList *cands = NULL; GError *error = NULL; gboolean res; cand = fs_candidate_new ("", FS_COMPONENT_RTP, FS_CANDIDATE_TYPE_HOST, FS_NETWORK_PROTOCOL_UDP, ses->send_socket, 0); cand->username = g_strdup (ses->recv_socket); cands = g_list_prepend (NULL, cand); res = fs_stream_set_remote_candidates (ses->stream, cands, &error); print_error (error); g_assert (res); fs_candidate_list_destroy (cands); }
static void one_way (GCallback havedata_handler, gpointer data) { FsParticipant *participant = NULL; GError *error = NULL; gint port = 0; GstElement *recv_pipeline; GList *candidates = NULL; GstBus *bus = NULL; dtmf_id = 105; digit = 0; sending = FALSE; received = FALSE; ready_to_send = FALSE; loop = g_main_loop_new (NULL, FALSE); dat = setup_simple_conference (1, "fsrtpconference", "tester@123445"); bus = gst_element_get_bus (dat->pipeline); gst_bus_add_watch (bus, _bus_callback, dat); gst_object_unref (bus); g_idle_add (_start_pipeline, dat); participant = fs_conference_new_participant ( FS_CONFERENCE (dat->conference), "*****@*****.**", &error); if (error) ts_fail ("Error while creating new participant (%d): %s", error->code, error->message); ts_fail_if (dat->session == NULL, "Could not make participant, but no GError!"); stream = fs_session_new_stream (dat->session, participant, FS_DIRECTION_SEND, "rawudp", 0, NULL, &error); if (error) ts_fail ("Error while creating new stream (%d): %s", error->code, error->message); ts_fail_if (stream == NULL, "Could not make stream, but no GError!"); recv_pipeline = build_recv_pipeline (havedata_handler, NULL, &port); GST_DEBUG ("port is %d", port); candidates = g_list_prepend (NULL, fs_candidate_new ("1", FS_COMPONENT_RTP, FS_CANDIDATE_TYPE_HOST, FS_NETWORK_PROTOCOL_UDP, "127.0.0.1", port)); ts_fail_unless (fs_stream_set_remote_candidates (stream, candidates, &error), "Could not set remote candidate"); fs_candidate_list_destroy (candidates); set_codecs (dat, stream); setup_fakesrc (dat); g_main_loop_run (loop); gst_element_set_state (dat->pipeline, GST_STATE_NULL); gst_element_set_state (recv_pipeline, GST_STATE_NULL); cleanup_simple_conference (dat); gst_object_unref (recv_pipeline); g_main_loop_unref (loop); }
static TestSession* add_audio_session (GstElement *pipeline, FsConference *conf, guint id, FsParticipant *part, guint localport, const gchar *remoteip, guint remoteport) { TestSession *ses = g_slice_new0 (TestSession); GError *error = NULL; GstPad *pad = NULL, *pad2 = NULL; GstElement *src = NULL; GList *cands = NULL; GList *codecs = NULL; GParameter param = {0}; gboolean res; ses->session = fs_conference_new_session (conf, FS_MEDIA_TYPE_AUDIO, &error); print_error (error); g_assert (ses->session); g_object_get (ses->session, "sink-pad", &pad, NULL); if (g_getenv ("AUDIOSRC")) src = gst_parse_bin_from_description (g_getenv ("AUDIOSRC"), TRUE, &error); else src = gst_parse_bin_from_description (DEFAULT_AUDIOSRC, TRUE, &error); print_error (error); g_assert (src); g_assert (gst_bin_add (GST_BIN (pipeline), src)); pad2 = gst_element_get_static_pad (src, "src"); g_assert (pad2); g_assert (GST_PAD_LINK_SUCCESSFUL (gst_pad_link (pad2, pad))); gst_object_unref (pad2); gst_object_unref (pad); cands = g_list_prepend (NULL, fs_candidate_new ("", FS_COMPONENT_RTP, FS_CANDIDATE_TYPE_HOST, FS_NETWORK_PROTOCOL_UDP, NULL, localport)); param.name = "preferred-local-candidates"; g_value_init (¶m.value, FS_TYPE_CANDIDATE_LIST); g_value_take_boxed (¶m.value, cands); ses->stream = fs_session_new_stream (ses->session, part, FS_DIRECTION_BOTH, "rawudp", 1, ¶m, &error); print_error (error); g_assert (ses->stream); g_value_unset (¶m.value); g_signal_connect (ses->stream, "src-pad-added", G_CALLBACK (src_pad_added_cb), pipeline); cands = g_list_prepend (NULL, fs_candidate_new ("", FS_COMPONENT_RTP, FS_CANDIDATE_TYPE_HOST, FS_NETWORK_PROTOCOL_UDP, remoteip, remoteport)); res = fs_stream_set_remote_candidates (ses->stream, cands, &error); print_error (error); g_assert (res); fs_candidate_list_destroy (cands); codecs = g_list_prepend (NULL, fs_codec_new (FS_CODEC_ID_ANY, "PCMA", FS_MEDIA_TYPE_AUDIO, 0)); codecs = g_list_prepend (codecs, fs_codec_new (FS_CODEC_ID_ANY, "PCMU", FS_MEDIA_TYPE_AUDIO, 0)); res = fs_session_set_codec_preferences (ses->session, codecs, &error); print_error (error); fs_codec_list_destroy (codecs); g_object_get (ses->session, "codecs", &codecs, NULL); res = fs_stream_set_remote_codecs (ses->stream, codecs, &error); print_error (error); g_assert (res); return ses; }