[farsight2/master] Add test for partial-sending mode in multicast transmitter
Olivier Crête
olivier.crete at collabora.co.uk
Thu Feb 5 06:32:07 PST 2009
---
tests/check/transmitter/multicast.c | 45 ++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/tests/check/transmitter/multicast.c b/tests/check/transmitter/multicast.c
index 9b81bbe..8793d54 100644
--- a/tests/check/transmitter/multicast.c
+++ b/tests/check/transmitter/multicast.c
@@ -42,6 +42,9 @@ gint candidates[2] = {0, 0};
GstElement *pipeline = NULL;
gboolean src_setup[2] = {FALSE, FALSE};
+#define FLAG_NOT_SENDING 1
+
+
GST_START_TEST (test_multicasttransmitter_new)
{
test_transmitter_creation ("multicast");
@@ -107,8 +110,19 @@ _start_pipeline (gpointer user_data)
return FALSE;
}
+
+static GstElement *
+_get_recvonly_filter (FsTransmitter *trans, guint component, gpointer user_data)
+{
+ if (component == 1)
+ return NULL;
+
+ return gst_element_factory_make ("identity", NULL);
+}
+
static void
-run_multicast_transmitter_test (gint n_parameters, GParameter *params)
+run_multicast_transmitter_test (gint n_parameters, GParameter *params,
+ gint flags)
{
GError *error = NULL;
FsTransmitter *trans;
@@ -117,6 +131,12 @@ run_multicast_transmitter_test (gint n_parameters, GParameter *params)
GList *candidates = NULL;
GstBus *bus = NULL;
+ buffer_count[0] = 0;
+ buffer_count[1] = 0;
+
+ if (flags & FLAG_NOT_SENDING)
+ buffer_count[0] = 20;
+
loop = g_main_loop_new (NULL, FALSE);
trans = fs_transmitter_new ("multicast", 2, &error);
@@ -127,6 +147,11 @@ run_multicast_transmitter_test (gint n_parameters, GParameter *params)
ts_fail_if (trans == NULL, "No transmitter create, yet error is still NULL");
+ if (flags & FLAG_NOT_SENDING)
+ ts_fail_unless (g_signal_connect (trans, "get-recvonly-filter",
+ G_CALLBACK (_get_recvonly_filter), NULL));
+
+
pipeline = setup_pipeline (trans, G_CALLBACK (_handoff_handler));
st = fs_transmitter_new_stream_transmitter (trans, NULL, n_parameters, params,
@@ -139,6 +164,8 @@ run_multicast_transmitter_test (gint n_parameters, GParameter *params)
ts_fail_if (st == NULL, "No stream transmitter created, yet error is NULL");
+ g_object_set (st, "sending", !(flags & FLAG_NOT_SENDING), NULL);
+
bus = gst_element_get_bus (pipeline);
gst_bus_add_watch (bus, bus_error_callback, NULL);
gst_object_unref (bus);
@@ -189,7 +216,7 @@ run_multicast_transmitter_test (gint n_parameters, GParameter *params)
GST_START_TEST (test_multicasttransmitter_run)
{
- run_multicast_transmitter_test (0, NULL);
+ run_multicast_transmitter_test (0, NULL, 0);
}
GST_END_TEST;
@@ -267,7 +294,7 @@ GST_START_TEST (test_multicasttransmitter_run_local_candidates)
g_value_init (¶ms[0].value, FS_TYPE_CANDIDATE_LIST);
g_value_set_boxed (¶ms[0].value, list);
- run_multicast_transmitter_test (1, params);
+ run_multicast_transmitter_test (1, params, 0);
g_value_reset (¶ms[0].value);
@@ -276,6 +303,14 @@ GST_START_TEST (test_multicasttransmitter_run_local_candidates)
}
GST_END_TEST;
+GST_START_TEST (test_multicasttransmitter_sending_half)
+{
+ run_multicast_transmitter_test (0, NULL, FLAG_NOT_SENDING);
+}
+GST_END_TEST;
+
+
+
static Suite *
multicasttransmitter_suite (void)
{
@@ -305,6 +340,10 @@ multicasttransmitter_suite (void)
tcase_add_test (tc_chain, test_multicasttransmitter_run_local_candidates);
suite_add_tcase (s, tc_chain);
+ tc_chain = tcase_create ("multicast_transmitter_sending_half");
+ tcase_add_test (tc_chain, test_multicasttransmitter_sending_half);
+ suite_add_tcase (s, tc_chain);
+
return s;
}
--
1.5.6.5
More information about the farsight-commits
mailing list