rtsp-stream: Only use the address pool for unicast UDP if it contains unicast addresses
authorSebastian Dröge <sebastian@centricular.com>
Thu, 3 Mar 2016 08:41:51 +0000 (10:41 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 3 Mar 2016 08:43:13 +0000 (10:43 +0200)
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

index 70abb99..272fbc9 100644 (file)
@@ -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);