Commit 8951408e authored by Mathieu Duponchelle's avatar Mathieu Duponchelle 🐸 Committed by Mathieu Duponchelle

tests: make rtpaux parallel-runnable

By removing global variables, and dehardcoding udp ports. The
latter was probably the cause for random CI issues, as while
the tests aren't run in parallel there, the hardcoded ports may
not always be free.

Fixes #533
parent 6525abfc
Pipeline #12708 passed with stages
in 35 minutes and 19 seconds
......@@ -24,26 +24,18 @@
#include <gst/check/gsttestclock.h>
#include <gst/rtp/gstrtpbuffer.h>
static gboolean send_pipeline_eos = FALSE;
static gboolean receive_pipeline_eos = FALSE;
static void
message_received (GstBus * bus, GstMessage * message, GstPipeline * bin)
message_received (GstBus * bus, GstMessage * message, gboolean * pipeline_eos)
{
GST_INFO ("bus message from \"%" GST_PTR_FORMAT "\": %" GST_PTR_FORMAT,
GST_MESSAGE_SRC (message), message);
switch (message->type) {
case GST_MESSAGE_EOS:
if (!strcmp ("pipeline_send",
GST_OBJECT_NAME (GST_MESSAGE_SRC (message))))
send_pipeline_eos = TRUE;
else if (!strcmp ("pipeline_receive",
GST_OBJECT_NAME (GST_MESSAGE_SRC (message))))
receive_pipeline_eos = TRUE;
else
fail ("Unknown pipeline: %s",
GST_OBJECT_NAME (GST_MESSAGE_SRC (message)));
if (GST_IS_PIPELINE (GST_MESSAGE_SRC (message))) {
g_assert (pipeline_eos);
*pipeline_eos = TRUE;
}
break;
case GST_MESSAGE_WARNING:{
GError *gerror;
......@@ -200,6 +192,10 @@ GST_START_TEST (test_simple_rtpbin_aux)
guint nb_rtx_send_packets = 0;
guint nb_rtx_recv_packets = 0;
RTXSendData send_rtxdata;
gboolean send_pipeline_eos = FALSE;
gboolean receive_pipeline_eos = FALSE;
int port = 0;
send_rtxdata.count = 1;
send_rtxdata.nb_packets = 0;
send_rtxdata.drop_every_n_packets = 25;
......@@ -221,33 +217,45 @@ GST_START_TEST (test_simple_rtpbin_aux)
encoder = gst_element_factory_make ("alawenc", "encoder");
rtppayloader = gst_element_factory_make ("rtppcmapay", "rtppayloader");
rtprtxsend = gst_element_factory_make ("rtprtxsend", "rtprtxsend");
sendrtp_udpsink = gst_element_factory_make ("udpsink", "sendrtp_udpsink");
g_object_set (sendrtp_udpsink, "host", "127.0.0.1", NULL);
g_object_set (sendrtp_udpsink, "port", 5006, NULL);
sendrtcp_udpsink = gst_element_factory_make ("udpsink", "sendrtcp_udpsink");
g_object_set (sendrtcp_udpsink, "host", "127.0.0.1", NULL);
g_object_set (sendrtcp_udpsink, "port", 5007, NULL);
g_object_set (sendrtcp_udpsink, "sync", FALSE, NULL);
g_object_set (sendrtcp_udpsink, "async", FALSE, NULL);
sendrtcp_udpsrc = gst_element_factory_make ("udpsrc", "sendrtcp_udpsrc");
g_object_set (sendrtcp_udpsrc, "port", 5009, NULL);
rtpbinreceive = gst_element_factory_make ("rtpbin", "rtpbinreceive");
g_object_set (rtpbinreceive, "latency", 200, "do-retransmission", TRUE, NULL);
recvrtp_udpsrc = gst_element_factory_make ("udpsrc", "recvrtp_udpsrc");
g_object_set (recvrtp_udpsrc, "port", 5006, NULL);
g_object_set (recvrtp_udpsrc, "port", 0, NULL);
gst_element_set_state (recvrtp_udpsrc, GST_STATE_READY);
g_object_get (recvrtp_udpsrc, "port", &port, NULL);
rtpcaps =
gst_caps_from_string
("application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA,payload=(int)96");
g_object_set (recvrtp_udpsrc, "caps", rtpcaps, NULL);
gst_caps_unref (rtpcaps);
sendrtp_udpsink = gst_element_factory_make ("udpsink", "sendrtp_udpsink");
g_object_set (sendrtp_udpsink, "host", "127.0.0.1", NULL);
g_object_set (sendrtp_udpsink, "port", port, NULL);
recvrtcp_udpsrc = gst_element_factory_make ("udpsrc", "recvrtcp_udpsrc");
g_object_set (recvrtcp_udpsrc, "port", 5007, NULL);
g_object_set (recvrtcp_udpsrc, "port", 0, NULL);
gst_element_set_state (recvrtcp_udpsrc, GST_STATE_READY);
g_object_get (recvrtcp_udpsrc, "port", &port, NULL);
sendrtcp_udpsink = gst_element_factory_make ("udpsink", "sendrtcp_udpsink");
g_object_set (sendrtcp_udpsink, "host", "127.0.0.1", NULL);
g_object_set (sendrtcp_udpsink, "port", port, NULL);
g_object_set (sendrtcp_udpsink, "sync", FALSE, NULL);
g_object_set (sendrtcp_udpsink, "async", FALSE, NULL);
sendrtcp_udpsrc = gst_element_factory_make ("udpsrc", "sendrtcp_udpsrc");
g_object_set (sendrtcp_udpsrc, "port", 0, NULL);
gst_element_set_state (sendrtcp_udpsrc, GST_STATE_READY);
g_object_get (sendrtcp_udpsrc, "port", &port, NULL);
recvrtcp_udpsink = gst_element_factory_make ("udpsink", "recvrtcp_udpsink");
g_object_set (recvrtcp_udpsink, "host", "127.0.0.1", NULL);
g_object_set (recvrtcp_udpsink, "port", 5009, NULL);
g_object_set (recvrtcp_udpsink, "port", port, NULL);
g_object_set (recvrtcp_udpsink, "sync", FALSE, NULL);
g_object_set (recvrtcp_udpsink, "async", FALSE, NULL);
rtpbinreceive = gst_element_factory_make ("rtpbin", "rtpbinreceive");
g_object_set (rtpbinreceive, "latency", 200, "do-retransmission", TRUE, NULL);
rtprtxreceive = gst_element_factory_make ("rtprtxreceive", "rtprtxreceive");
rtpdepayloader = gst_element_factory_make ("rtppcmadepay", "rtpdepayloader");
decoder = gst_element_factory_make ("alawdec", "decoder");
......@@ -344,18 +352,18 @@ GST_START_TEST (test_simple_rtpbin_aux)
fail_unless (res == TRUE, NULL);
g_signal_connect (bussend, "message::error", (GCallback) message_received,
binsend);
NULL);
g_signal_connect (bussend, "message::warning", (GCallback) message_received,
binsend);
NULL);
g_signal_connect (bussend, "message::eos", (GCallback) message_received,
binsend);
&send_pipeline_eos);
g_signal_connect (busreceive, "message::error", (GCallback) message_received,
binreceive);
NULL);
g_signal_connect (busreceive, "message::warning",
(GCallback) message_received, binreceive);
(GCallback) message_received, NULL);
g_signal_connect (busreceive, "message::eos", (GCallback) message_received,
binreceive);
&receive_pipeline_eos);
state_res = gst_element_set_state (binreceive, GST_STATE_PLAYING);
ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment