rtsp-media: Unblock all streams
authorDavid Svensson Fors <davidsf@axis.com>
Mon, 29 Oct 2018 16:02:41 +0000 (17:02 +0100)
committerSebastian Dröge <slomo@coaxion.net>
Thu, 3 Oct 2019 11:54:15 +0000 (11:54 +0000)
When unsuspending and going to PLAYING, unblock all streams instead of
only those that are linked (the linked streams are the ones for which
SETUP has been called). GST_FLOW_NOT_LINKED will be returned when
pushing buffers on unlinked streams.

This change is because playback using single-threaded demuxers like
matroska-demux could be blocked if SETUP was not called for all media.
Demuxers that use GstFlowCombiner (including gstoggdemux, gstavidemux,
gstflvdemux, qtdemux, and matroska-demux) will handle
GST_FLOW_NOT_LINKED automatically.

Fixes #39

gst/rtsp-server/rtsp-media.c
tests/check/gst/rtspserver.c

index 45463f6..345559d 100644 (file)
@@ -2635,15 +2635,15 @@ media_streams_set_blocked (GstRTSPMedia * media, gboolean blocked)
 static void
 stream_unblock (GstRTSPStream * stream, GstRTSPMedia * media)
 {
-  gst_rtsp_stream_unblock_linked (stream);
+  gst_rtsp_stream_set_blocked (stream, FALSE);
 }
 
 static void
-media_unblock_linked (GstRTSPMedia * media)
+media_unblock (GstRTSPMedia * media)
 {
   GstRTSPMediaPrivate *priv = media->priv;
 
-  GST_DEBUG ("media %p unblocking linked streams", media);
+  GST_DEBUG ("media %p unblocking streams", media);
   /* media is not blocked any longer, as it contains active streams,
    * streams that are complete */
   priv->blocked = FALSE;
@@ -4393,8 +4393,8 @@ default_unsuspend (GstRTSPMedia * media)
         gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARING);
         /* at this point the media pipeline has been updated and contain all
          * specific transport parts: all active streams contain at least one sink
-         * element and it's safe to unblock any blocked streams that are active */
-        media_unblock_linked (media);
+         * element and it's safe to unblock all blocked streams */
+        media_unblock (media);
       } else {
         /* streams are not blocked and media is suspended from PAUSED */
         gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED);
@@ -4414,8 +4414,8 @@ default_unsuspend (GstRTSPMedia * media)
       gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARING);
       /* at this point the media pipeline has been updated and contain all
        * specific transport parts: all active streams contain at least one sink
-       * element and it's safe to unblock any blocked streams that are active */
-      media_unblock_linked (media);
+       * element and it's safe to unblock all blocked streams */
+      media_unblock (media);
       if (!start_preroll (media))
         goto start_failed;
 
@@ -4507,7 +4507,7 @@ media_set_pipeline_state_locked (GstRTSPMedia * media, GstState state)
     } else {
       if (state == GST_STATE_PLAYING)
         /* make sure pads are not blocking anymore when going to PLAYING */
-        media_unblock_linked (media);
+        media_unblock (media);
 
       if (state == GST_STATE_PAUSED) {
         set_state_ret = set_state (media, state);
index da6df2d..0a0eec4 100644 (file)
 
 #include "rtsp-server.h"
 
+#define ERRORIGNORE "errorignore ignore-error=false ignore-notlinked=true " \
+  "ignore-notnegotiated=false convert-to=ok"
 #define VIDEO_PIPELINE "videotestsrc ! " \
+  ERRORIGNORE " ! " \
   "video/x-raw,width=352,height=288 ! " \
   "rtpgstpay name=pay0 pt=96"
 #define AUDIO_PIPELINE "audiotestsrc ! " \
+  ERRORIGNORE " ! " \
   "audio/x-raw,rate=8000 ! " \
   "rtpgstpay name=pay1 pt=97"