summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>2015-01-13 17:36:01 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.com>2015-01-27 16:38:39 -0500
commitf2c04851e27dc428153cb1520cb412fd8db2a144 (patch)
tree955e1cf0799ab43e4b983611bce1275eaf3c0953 /tests
parenteda61c44c79956eaa5723725d31d606a9df67c92 (diff)
downloadfarstream-f2c04851e27dc428153cb1520cb412fd8db2a144.tar.gz
transmitter: Add a unit test for send-component-mux property on nice transmitter
Diffstat (limited to 'tests')
-rw-r--r--tests/check/transmitter/nice.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/check/transmitter/nice.c b/tests/check/transmitter/nice.c
index 4b5c67e9..88a46395 100644
--- a/tests/check/transmitter/nice.c
+++ b/tests/check/transmitter/nice.c
@@ -37,6 +37,7 @@ enum {
FLAG_IS_LOCAL = 1 << 1,
FLAG_FORCE_CANDIDATES = 1 << 2,
FLAG_NOT_SENDING = 1 << 3,
+ FLAG_MUXED = 1 << 4,
};
@@ -47,6 +48,7 @@ volatile gint running = TRUE;
gboolean associate_on_source = TRUE;
gboolean is_address_local = FALSE;
gboolean force_candidates = FALSE;
+gboolean is_muxed = FALSE;
GMutex count_mutex;
@@ -200,7 +202,7 @@ _new_active_candidate_pair (FsStreamTransmitter *st, FsCandidate *local,
}
static void
-_handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
+_handoff_handler_internal (GstElement *element, GstBuffer *buffer, GstPad *pad,
guint stream, gint component_id)
{
ts_fail_unless (gst_buffer_get_size (buffer) == component_id * 10,
@@ -255,6 +257,25 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
}
static void
+_handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
+ guint stream, gint component_id)
+{
+ if (is_muxed) {
+ ts_fail_if (component_id != 1,
+ "Received data on component %d while the stream is muxed",
+ component_id);
+
+ if (gst_buffer_get_size (buffer) == 20) {
+ received_known[stream][component_id-1]--;
+ component_id = 2;
+ received_known[stream][component_id-1]++;
+ }
+ }
+
+ _handoff_handler_internal (element, buffer, pad, stream, component_id);
+}
+
+static void
_handoff_handler1 (GstElement *element, GstBuffer *buffer, GstPad *pad,
gpointer user_data)
{
@@ -390,6 +411,7 @@ run_nice_transmitter_test (gint n_parameters, GParameter *params,
associate_on_source = !(flags & FLAG_NO_SOURCE);
is_address_local = (flags & FLAG_IS_LOCAL);
force_candidates = (flags & FLAG_FORCE_CANDIDATES);
+ is_muxed = (flags & FLAG_MUXED);
if (flags & FLAG_NOT_SENDING)
{
@@ -828,6 +850,17 @@ GST_START_TEST (test_nicetransmitter_sending_half)
}
GST_END_TEST;
+GST_START_TEST (test_nicetransmitter_send_component_mux)
+{
+ GParameter param = {NULL, {0}};
+
+ param.name = "send-component-mux";
+ g_value_init (&param.value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&param.value, TRUE);
+
+ run_nice_transmitter_test (1, &param, FLAG_MUXED);
+}
+GST_END_TEST;
static Suite *
nicetransmitter_suite (void)
@@ -876,6 +909,10 @@ nicetransmitter_suite (void)
tcase_add_test (tc_chain, test_nicetransmitter_sending_half);
suite_add_tcase (s, tc_chain);
+ tc_chain = tcase_create ("nicetransmitter-send-component-mux");
+ tcase_add_test (tc_chain, test_nicetransmitter_send_component_mux);
+ suite_add_tcase (s, tc_chain);
+
return s;
}