client: set session media to NULL without the lock
authorAleix Conchillo FlaquƩ <aleix@oblong.com>
Tue, 30 Sep 2014 23:36:51 +0000 (16:36 -0700)
committerLuis de Bethencourt <luis.bg@samsung.com>
Wed, 1 Oct 2014 09:31:04 +0000 (10:31 +0100)
We need to set session medias to NULL without the client lock otherwise
we can end up in a deadlock if another thread is waiting for the lock
and media unprepare is also waiting for that thread to end.

https://bugzilla.gnome.org/show_bug.cgi?id=737690

gst/rtsp-server/rtsp-client.c

index aa0ab98..b00993a 100644 (file)
@@ -346,9 +346,6 @@ client_unwatch_session (GstRTSPClient * client, GstRTSPSession * session,
     priv->session_removed_id = 0;
   }
 
-  /* unlink all media managed in this session */
-  gst_rtsp_session_filter (session, filter_session_media, client);
-
   /* remove the session */
   g_object_unref (session);
 }
@@ -357,6 +354,10 @@ static GstRTSPFilterResult
 cleanup_session (GstRTSPClient * client, GstRTSPSession * sess,
     gpointer user_data)
 {
+  /* 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, client);
+
   return GST_RTSP_FILTER_REMOVE;
 }