diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index e1e5338cc1..deb2ab3403 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -416,6 +416,11 @@ client_unwatch_session (GstRTSPClient * client, GstRTSPSession * session, priv->session_removed_id = 0; } + if (!priv->drop_backlog) { + /* unlink all media managed in this session */ + gst_rtsp_session_filter (session, filter_session_media, client); + } + /* remove the session */ g_object_unref (session); } @@ -425,10 +430,13 @@ cleanup_session (GstRTSPClient * client, GstRTSPSession * sess, gpointer user_data) { gboolean *closed = user_data; + GstRTSPClientPrivate *priv = client->priv; - /* unlink all media managed in this session. This needs to happen - * without the client lock, so we really want to do it here. */ - gst_rtsp_session_filter (sess, filter_session_media, user_data); + if (priv->drop_backlog) { + /* unlink all media managed in this session. This needs to happen + * without the client lock, so we really want to do it here. */ + gst_rtsp_session_filter (sess, filter_session_media, user_data); + } if (*closed) return GST_RTSP_FILTER_REMOVE;