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;
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);
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);
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);
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);
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);
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) {
/* 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);
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;
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;