rtsp-server: stream: Don't loop forever if binding to the multicast address fails

The address/port is pre-defined by the caller of the function, so
retrying is only going to loop forever.

Ideally the multicast address should be checked after allocating but
this doesn't happen currently, so it's better to error out cleanly then
to loop forever trying the same address.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2975>
This commit is contained in:
Sebastian Dröge 2022-09-02 16:31:54 +03:00 committed by GStreamer Marge Bot
parent a1b60be22b
commit 57a6e48ed1

View file

@ -1507,8 +1507,10 @@ again:
|| multicast) {
GstRTSPAddressFlags flags;
if (addr)
if (addr) {
g_assert (*server_addr_out == NULL);
rejected_addresses = g_list_prepend (rejected_addresses, addr);
}
if (!pool)
goto no_pool;
@ -1558,10 +1560,16 @@ again:
if (!g_socket_bind (rtp_socket, rtp_sockaddr, FALSE, NULL)) {
GST_DEBUG_OBJECT (stream, "rtp bind() failed, will try again");
g_object_unref (rtp_sockaddr);
if (transport_settings_defined)
if (transport_settings_defined) {
goto transport_settings_error;
} else if (*server_addr_out && ((pool
&& gst_rtsp_address_pool_has_unicast_addresses (pool))
|| multicast)) {
goto no_address;
} else {
goto again;
}
}
g_object_unref (rtp_sockaddr);
rtp_sockaddr = g_socket_get_local_address (rtp_socket, NULL);