From a48711fa9d277a8e50ea6be7fb53a1808bb7ef72 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 29 Jan 2019 14:42:35 +0100 Subject: [PATCH] rtsp-stream: Use cached address when allocating sockets 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index 33eeb50..8484ef9 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -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; -- 2.7.4