client: set the watch to flushing before going to NULL
authorWim Taymans <wtaymans@redhat.com>
Tue, 15 Apr 2014 14:51:17 +0000 (16:51 +0200)
committerWim Taymans <wtaymans@redhat.com>
Tue, 15 Apr 2014 14:51:17 +0000 (16:51 +0200)
First set the watch to flushing so that we unblock any current and
future attempt to send data on the watch, Then set the pipeline to
NULL.

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

gst/rtsp-server/rtsp-client.c

index 7158c12..8ff51d1 100644 (file)
@@ -819,6 +819,10 @@ handle_teardown_request (GstRTSPClient * client, GstRTSPContext * ctx)
   g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_TEARDOWN_REQUEST],
       0, ctx);
 
+  /* make sure we unblock the backlog and don't accept new messages
+   * on the watch */
+  gst_rtsp_watch_set_flushing (priv->watch, TRUE);
+
   /* unlink the all TCP callbacks */
   unlink_session_transports (client, session, sessmedia);
 
@@ -827,6 +831,9 @@ handle_teardown_request (GstRTSPClient * client, GstRTSPContext * ctx)
 
   gst_rtsp_session_media_set_state (sessmedia, GST_STATE_NULL);
 
+  /* allow messages again so that we can send the reply */
+  gst_rtsp_watch_set_flushing (priv->watch, FALSE);
+
   /* unmanage the media in the session, returns false if all media session
    * are torn down. */
   if (!gst_rtsp_session_release_media (session, sessmedia)) {