rtsp-media: If seeking fails, don't wait forever for the media to preroll again
authorSebastian Dröge <sebastian@centricular.com>
Thu, 12 Feb 2015 14:48:46 +0000 (16:48 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 12 Feb 2015 14:53:27 +0000 (16:53 +0200)
Instead error out properly the same way as if the SEEKING query already
failed.

gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-media.c

index 1d9610a..8e8f73a 100644 (file)
@@ -1165,7 +1165,10 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
     if (gst_rtsp_range_parse (str, &range) == GST_RTSP_OK) {
       /* we have a range, seek to the position */
       unit = range->unit;
-      gst_rtsp_media_seek (media, range);
+      if (!gst_rtsp_media_seek (media, range)) {
+        gst_rtsp_range_free (range);
+        goto seek_failed;
+      }
       gst_rtsp_range_free (range);
     }
   }
@@ -1239,6 +1242,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);
index 0e94e52..f97490b 100644 (file)
@@ -1952,6 +1952,9 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
 
     /* and block for the seek to complete */
     GST_INFO ("done seeking %d", res);
+    if (!res)
+      goto seek_failed;
+
     g_rec_mutex_unlock (&priv->state_lock);
 
     /* wait until pipeline is prerolled again, this will also collect stats */
@@ -1987,6 +1990,12 @@ not_supported:
     GST_WARNING ("conversion to npt not supported");
     return FALSE;
   }
+seek_failed:
+  {
+    g_rec_mutex_unlock (&priv->state_lock);
+    GST_INFO ("seeking failed");
+    return FALSE;
+  }
 preroll_failed:
   {
     GST_WARNING ("failed to preroll after seek");