static void nway_test (int in_count, extra_init extrainit) { int i, j; count = in_count; loop = g_main_loop_new (NULL, FALSE); dats = g_new0 (struct SimpleTestConference *, count); for (i = 0; i < count; i++) { gchar *tmp = g_strdup_printf ("tester%d@hostname", i); dats[i] = setup_simple_conference (i, "fsrtpconference", tmp); g_free (tmp); rtpconference_connect_signals (dats[i]); g_idle_add (_start_pipeline, dats[i]); setup_fakesrc (dats[i]); if (i != 0) g_signal_connect (dats[i]->session, "notify::codecs", G_CALLBACK (_negotiated_codecs_notify), dats[i]); } for (i = 0; i < count; i++) for (j = 0; j < count; j++) if (i != j) { struct SimpleTestStream *st = NULL; st = simple_conference_add_stream (dats[i], dats[j]); st->handoff_handler = G_CALLBACK (_handoff_handler); g_signal_connect (st->stream, "src-pad-added", G_CALLBACK (_src_pad_added), st); } for (i = 1; i < count; i++) { struct SimpleTestStream *st = find_pointback_stream (dats[i], dats[0]); set_initial_codecs (dats[0], st); } if (extrainit) extrainit (); g_main_loop_run (loop); for (i = 0; i < count; i++) gst_element_set_state (dats[i]->pipeline, GST_STATE_NULL); for (i = 0; i < count; i++) cleanup_simple_conference (dats[i]); g_free (dats); g_main_loop_unref (loop); }
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 void nway_test (int in_count, extra_conf_init extra_conf_init, extra_stream_init extra_stream_init, const gchar *transmitter, guint st_param_count, GParameter *st_params) { int i, j; GParameter *params = NULL; if (!strcmp ("rawudp", transmitter)) { params = g_new0 (GParameter, st_param_count+2); memcpy (params, st_params, st_param_count * sizeof (GParameter)); params[st_param_count].name = "upnp-discovery"; g_value_init (¶ms[st_param_count].value, G_TYPE_BOOLEAN); g_value_set_boolean (¶ms[st_param_count].value, FALSE); params[st_param_count+1].name = "upnp-mapping"; g_value_init (¶ms[st_param_count+1].value, G_TYPE_BOOLEAN); g_value_set_boolean (¶ms[st_param_count+1].value, FALSE); st_param_count += 2; st_params = params; } count = in_count; loop = g_main_loop_new (NULL, FALSE); dats = g_new0 (struct SimpleTestConference *, count); for (i = 0; i < count; i++) { gchar *tmp = g_strdup_printf ("tester%d@hostname", i); dats[i] = setup_simple_conference (i, "fsrtpconference", tmp); g_free (tmp); g_object_set (G_OBJECT (dats[i]->session), "no-rtcp-timeout", -1, NULL); if (extra_conf_init) extra_conf_init (dats[i], i); rtpconference_connect_signals (dats[i]); g_idle_add (_start_pipeline, dats[i]); setup_fakesrc (dats[i]); if (i != 0) g_signal_connect (dats[i]->session, "notify::codecs", G_CALLBACK (_negotiated_codecs_notify), dats[i]); } TEST_LOCK (); for (i = 0; i < count; i++) for (j = 0; j < count; j++) if (i != j) { struct SimpleTestStream *st = NULL; st = simple_conference_add_stream (dats[i], dats[j], transmitter, st_param_count, st_params); st->handoff_handler = G_CALLBACK (_handoff_handler); g_signal_connect (st->stream, "src-pad-added", G_CALLBACK (_src_pad_added), st); if (extra_stream_init) extra_stream_init (st, i, j); } for (i = 1; i < count; i++) { struct SimpleTestStream *st = find_pointback_stream (dats[i], dats[0]); set_initial_codecs (dats[0], st); } TEST_UNLOCK (); g_main_loop_run (loop); for (i = 0; i < count; i++) gst_element_set_state (dats[i]->pipeline, GST_STATE_NULL); for (i = 0; i < count; i++) cleanup_simple_conference (dats[i]); g_free (dats); g_main_loop_unref (loop); g_free (params); }