rtsp-stream: Use cached address when allocating sockets
authorEdward Hervey <edward@centricular.com>
Tue, 29 Jan 2019 13:42:35 +0000 (14:42 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 29 Jan 2019 13:42:35 +0000 (14:42 +0100)
If an address/port was previously decided upon (ex: multicast in the
SDP), then use that instead of re-creating another one

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/57

gst/rtsp-server/rtsp-stream.c

index 33eeb50..8484ef9 100644 (file)
@@ -1076,7 +1076,8 @@ no_address:
  * won't release the address from the pool.
  *
  * Returns: (nullable): the #GstRTSPAddress of @stream or %NULL when
- * the address could be reserved. gst_rtsp_address_free() after usage.
+ * the address could not be reserved. gst_rtsp_address_free() after
+ * usage.
  */
 GstRTSPAddress *
 gst_rtsp_stream_reserve_address (GstRTSPStream * stream,
@@ -1448,7 +1449,10 @@ again:
       else
         flags |= GST_RTSP_ADDRESS_FLAG_IPV4;
 
-      addr = gst_rtsp_address_pool_acquire_address (pool, flags, 2);
+      if (*server_addr_out)
+        addr = *server_addr_out;
+      else
+        addr = gst_rtsp_address_pool_acquire_address (pool, flags, 2);
 
       if (addr == NULL)
         goto no_address;