rtsp-client: No flush during Teardown.
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-client.c
index 1d9610a..c41d019 100644 (file)
@@ -839,17 +839,8 @@ 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 */
-  if (priv->watch != NULL)
-    gst_rtsp_watch_set_flushing (priv->watch, TRUE);
-
   gst_rtsp_session_media_set_state (sessmedia, GST_STATE_NULL);
 
-  /* allow messages again so that we can send the reply */
-  if (priv->watch != NULL)
-    gst_rtsp_watch_set_flushing (priv->watch, FALSE);
-
   /* unmanage the media in the session, returns false if all media session
    * are torn down. */
   keep_session = gst_rtsp_session_release_media (session, sessmedia);
@@ -1163,10 +1154,16 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
   res = gst_rtsp_message_get_header (ctx->request, GST_RTSP_HDR_RANGE, &str, 0);
   if (res == GST_RTSP_OK) {
     if (gst_rtsp_range_parse (str, &range) == GST_RTSP_OK) {
+      GstRTSPMediaStatus media_status;
+
       /* we have a range, seek to the position */
       unit = range->unit;
       gst_rtsp_media_seek (media, range);
       gst_rtsp_range_free (range);
+
+      media_status = gst_rtsp_media_get_status (media);
+      if (media_status == GST_RTSP_MEDIA_STATUS_ERROR)
+        goto seek_failed;
     }
   }
 
@@ -1239,6 +1236,12 @@ unsuspend_failed:
     send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
     return FALSE;
   }
+seek_failed:
+  {
+    GST_ERROR ("client %p: seek failed", client);
+    send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+    return FALSE;
+  }
 unsupported_mode:
   {
     GST_ERROR ("client %p: media does not support PLAY", client);