From a7ced98346c6d49c4569d1b609a773a042c46796 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 3 Mar 2016 10:41:51 +0200 Subject: [PATCH] rtsp-stream: Only use the address pool for unicast UDP if it contains unicast addresses Otherwise we fail to allocate UDP ports if the pool only contains multicast addresses, which is something that used to work before. For unicast addresses if the pool contains none, we just allocate them as if there is no pool at all. https://bugzilla.gnome.org/show_bug.cgi?id=757488 --- gst/rtsp-server/rtsp-stream.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index 70abb99..272fbc9 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -1229,16 +1229,15 @@ again: goto no_udp_protocol; } - if (pool) { - GstRTSPAddressFlags flags; - - if (transport == GST_RTSP_LOWER_TRANS_UDP && - gst_rtsp_address_pool_has_unicast_addresses (pool)) - flags = GST_RTSP_ADDRESS_FLAG_EVEN_PORT | GST_RTSP_ADDRESS_FLAG_UNICAST; - else if (transport == GST_RTSP_LOWER_TRANS_UDP_MCAST) - flags = GST_RTSP_ADDRESS_FLAG_EVEN_PORT | GST_RTSP_ADDRESS_FLAG_MULTICAST; + if (pool && ((transport == GST_RTSP_LOWER_TRANS_UDP && + gst_rtsp_address_pool_has_unicast_addresses (pool)) + || transport == GST_RTSP_LOWER_TRANS_UDP_MCAST)) { + GstRTSPAddressFlags flags = GST_RTSP_ADDRESS_FLAG_EVEN_PORT; + + if (transport == GST_RTSP_LOWER_TRANS_UDP) + flags |= GST_RTSP_ADDRESS_FLAG_UNICAST; else - goto no_ports; + flags |= GST_RTSP_ADDRESS_FLAG_MULTICAST; if (addr) rejected_addresses = g_list_prepend (rejected_addresses, addr); -- 2.7.4