rtsp-stream: clear sockets when leaving bin

Since commit 4d86f994, when setting an RTSP media both shared and
reusable, streaming cannot be restarted after the first time all the
clients disconnect. That happens because the sockets (unlike
addresses) of GstRTSPStream are not cleared in
gst_rtsp_stream_leave_bin, and on restart sockets and addresses are
not allocated in gst_rtsp_stream_allocate_udp_sockets, and then the
check in create_sender_part fails. Fix this by clearing sockets in
gst_rtsp_stream_leave_bin.

Fixes gstreamer/gst-rtsp-server#113

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6334>
This commit is contained in:
Mikhail Rudenko 2024-02-08 01:36:43 +03:00 committed by GStreamer Marge Bot
parent d89da0f5c4
commit 92c0f7ddb5

View file

@ -4235,6 +4235,13 @@ gst_rtsp_stream_leave_bin (GstRTSPStream * stream, GstBin * bin,
gst_rtsp_address_free (priv->server_addr_v6);
priv->server_addr_v6 = NULL;
for (i = 0; i < 2; i++) {
g_clear_object (&priv->socket_v4[i]);
g_clear_object (&priv->socket_v6[i]);
g_clear_object (&priv->mcast_socket_v4[i]);
g_clear_object (&priv->mcast_socket_v6[i]);
}
g_mutex_unlock (&priv->lock);
return TRUE;