diff --git a/tests/check/gst/media.c b/tests/check/gst/media.c index c8cdf30b46..b0ddb19967 100644 --- a/tests/check/gst/media.c +++ b/tests/check/gst/media.c @@ -298,45 +298,6 @@ GST_START_TEST (test_media_dyn_prepare) GST_END_TEST; -GST_START_TEST (test_media_prepare_port_alloc_fail) -{ - GstRTSPMediaFactory *factory; - GstRTSPMedia *media; - GstRTSPUrl *url; - GstRTSPThreadPool *pool; - GstRTSPThread *thread; - GstRTSPAddressPool *addrpool; - - pool = gst_rtsp_thread_pool_new (); - - factory = gst_rtsp_media_factory_new (); - fail_unless (gst_rtsp_url_parse ("rtsp://localhost:8554/test", - &url) == GST_RTSP_OK); - - gst_rtsp_media_factory_set_launch (factory, - "( fakesrc is-live=true ! text/plain ! rtpgstpay name=pay0 )"); - - media = gst_rtsp_media_factory_construct (factory, url); - fail_unless (GST_IS_RTSP_MEDIA (media)); - - addrpool = gst_rtsp_address_pool_new (); - fail_unless (gst_rtsp_address_pool_add_range (addrpool, "192.168.1.1", - "192.168.1.1", 6000, 6001, 0)); - gst_rtsp_media_set_address_pool (media, addrpool); - - thread = gst_rtsp_thread_pool_get_thread (pool, - GST_RTSP_THREAD_TYPE_MEDIA, NULL); - fail_if (gst_rtsp_media_prepare (media, thread)); - - g_object_unref (media); - g_object_unref (addrpool); - gst_rtsp_url_free (url); - g_object_unref (factory); - g_object_unref (pool); -} - -GST_END_TEST; - GST_START_TEST (test_media_take_pipeline) { GstRTSPMediaFactory *factory; @@ -497,7 +458,6 @@ rtspmedia_suite (void) tcase_add_test (tc, test_media); tcase_add_test (tc, test_media_prepare); tcase_add_test (tc, test_media_dyn_prepare); - tcase_add_test (tc, test_media_prepare_port_alloc_fail); tcase_add_test (tc, test_media_take_pipeline); tcase_add_test (tc, test_media_reset); tcase_add_test (tc, test_media_multidyn_prepare); diff --git a/tests/check/gst/rtspclientsink.c b/tests/check/gst/rtspclientsink.c index 584422bb43..dd7f90f154 100644 --- a/tests/check/gst/rtspclientsink.c +++ b/tests/check/gst/rtspclientsink.c @@ -155,7 +155,7 @@ GST_START_TEST (test_record) gint i; mfactory = - start_record_server ("( rtppcmadepay name=depay0 ! appsink name=sink )"); + start_record_server ("( rtppcmadepay name=depay0 ! appsink name=sink async=false )"); g_signal_connect (mfactory, "media-constructed", G_CALLBACK (media_constructed_cb), &server_sink); diff --git a/tests/check/gst/rtspserver.c b/tests/check/gst/rtspserver.c index ec66f99f70..d21bf040db 100644 --- a/tests/check/gst/rtspserver.c +++ b/tests/check/gst/rtspserver.c @@ -169,6 +169,8 @@ start_server (void) pool = gst_rtsp_address_pool_new (); gst_rtsp_address_pool_add_range (pool, "224.3.0.0", "224.3.0.10", 5000, 5010, 16); + gst_rtsp_address_pool_add_range (pool, GST_RTSP_ADDRESS_POOL_ANY_IPV4, + GST_RTSP_ADDRESS_POOL_ANY_IPV4, 6000, 6010, 0); gst_rtsp_media_factory_set_address_pool (factory, pool); gst_object_unref (pool); @@ -1511,6 +1513,9 @@ GST_START_TEST (test_play_specific_server_port) mounts = gst_rtsp_server_get_mount_points (server); factory = gst_rtsp_media_factory_new (); + /* we have to suspend media after SDP in order to make sure that + * we can reconfigure UDP sink with new UDP ports */ + gst_rtsp_media_factory_set_suspend_mode (factory, GST_RTSP_SUSPEND_MODE_RESET); pool = gst_rtsp_address_pool_new (); gst_rtsp_address_pool_add_range (pool, GST_RTSP_ADDRESS_POOL_ANY_IPV4, GST_RTSP_ADDRESS_POOL_ANY_IPV4, 7770, 7780, 0); @@ -1744,7 +1749,7 @@ GST_START_TEST (test_record_tcp) gint i; mfactory = - start_record_server ("( rtppcmadepay name=depay0 ! appsink name=sink )"); + start_record_server ("( rtppcmadepay name=depay0 ! appsink name=sink async=false )"); g_signal_connect (mfactory, "media-constructed", G_CALLBACK (media_constructed_cb), &server_sink); diff --git a/tests/check/gst/stream.c b/tests/check/gst/stream.c index 582e67408f..26353b1f36 100644 --- a/tests/check/gst/stream.c +++ b/tests/check/gst/stream.c @@ -29,9 +29,11 @@ GST_START_TEST (test_get_sockets) GstRTSPStream *stream; GstBin *bin; GstElement *rtpbin; + GstRTSPAddressPool *pool; GSocket *socket; gboolean have_ipv4; gboolean have_ipv6; + GstRTSPTransport *tr; srcpad = gst_pad_new ("testsrcpad", GST_PAD_SRC); fail_unless (srcpad != NULL); @@ -48,8 +50,21 @@ GST_START_TEST (test_get_sockets) fail_unless (bin != NULL); fail_unless (gst_bin_add (bin, rtpbin)); + /* configure address pool for IPv4 and IPv6 unicast addresses */ + pool = gst_rtsp_address_pool_new (); + fail_unless (gst_rtsp_address_pool_add_range (pool, GST_RTSP_ADDRESS_POOL_ANY_IPV4, + GST_RTSP_ADDRESS_POOL_ANY_IPV4, 50000, 60000, 0)); + fail_unless (gst_rtsp_address_pool_add_range (pool, GST_RTSP_ADDRESS_POOL_ANY_IPV6, + GST_RTSP_ADDRESS_POOL_ANY_IPV6, 50000, 60000, 0)); + gst_rtsp_stream_set_address_pool (stream, pool); + fail_unless (gst_rtsp_stream_join_bin (stream, bin, rtpbin, GST_STATE_NULL)); + gst_rtsp_transport_new (&tr); + tr->lower_transport = GST_RTSP_LOWER_TRANS_UDP; + fail_unless (gst_rtsp_stream_allocate_udp_sockets (stream, G_SOCKET_FAMILY_IPV4, + tr, FALSE)); + socket = gst_rtsp_stream_get_rtp_socket (stream, G_SOCKET_FAMILY_IPV4); have_ipv4 = (socket != NULL); if (have_ipv4) { @@ -85,6 +100,9 @@ GST_START_TEST (test_get_sockets) /* check that at least one family is available */ fail_unless (have_ipv4 || have_ipv6); + gst_rtsp_transport_free (tr); + g_object_unref (pool); + fail_unless (gst_rtsp_stream_leave_bin (stream, bin, rtpbin)); gst_object_unref (bin); @@ -93,6 +111,52 @@ GST_START_TEST (test_get_sockets) GST_END_TEST; +GST_START_TEST (test_allocate_udp_ports_fail) +{ + GstPad *srcpad; + GstElement *pay; + GstRTSPStream *stream; + GstBin *bin; + GstElement *rtpbin; + GstRTSPAddressPool *pool; + GstRTSPTransport *tr; + + srcpad = gst_pad_new ("testsrcpad", GST_PAD_SRC); + fail_unless (srcpad != NULL); + gst_pad_set_active (srcpad, TRUE); + pay = gst_element_factory_make ("rtpgstpay", "testpayloader"); + fail_unless (pay != NULL); + stream = gst_rtsp_stream_new (0, pay, srcpad); + fail_unless (stream != NULL); + gst_object_unref (pay); + gst_object_unref (srcpad); + rtpbin = gst_element_factory_make ("rtpbin", "testrtpbin"); + fail_unless (rtpbin != NULL); + bin = GST_BIN (gst_bin_new ("testbin")); + fail_unless (bin != NULL); + fail_unless (gst_bin_add (bin, rtpbin)); + + pool = gst_rtsp_address_pool_new (); + fail_unless (gst_rtsp_address_pool_add_range (pool, "192.168.1.1", + "192.168.1.1", 6000, 6001, 0)); + gst_rtsp_stream_set_address_pool (stream, pool); + + fail_unless (gst_rtsp_stream_join_bin (stream, bin, rtpbin, GST_STATE_NULL)); + + gst_rtsp_transport_new (&tr); + tr->lower_transport = GST_RTSP_LOWER_TRANS_UDP; + fail_if (gst_rtsp_stream_allocate_udp_sockets (stream, G_SOCKET_FAMILY_IPV4, + tr, FALSE)); + + gst_rtsp_transport_free (tr); + g_object_unref (pool); + fail_unless (gst_rtsp_stream_leave_bin (stream, bin, rtpbin)); + gst_object_unref (bin); + gst_object_unref (stream); +} + +GST_END_TEST; + GST_START_TEST (test_get_multicast_address) { GstPad *srcpad; @@ -164,6 +228,7 @@ rtspstream_suite (void) suite_add_tcase (s, tc); tcase_add_test (tc, test_get_sockets); + tcase_add_test (tc, test_allocate_udp_ports_fail); tcase_add_test (tc, test_get_multicast_address); return s;