rtspclientsink: fix waiting for multiple streams
authorMatthew Waters <matthew@centricular.com>
Tue, 19 Jun 2018 04:53:02 +0000 (14:53 +1000)
committerMatthew Waters <matthew@centricular.com>
Thu, 21 Jun 2018 10:56:46 +0000 (20:56 +1000)
We were previously only ever waiting for a single stream to notify it's
blocked status through GstRTSPStreamBlocking.  Actually count streams to
wait for.

Fixes rtspclientsink sending SDP's without out some of the input
streams.

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

gst/rtsp-sink/gstrtspclientsink.c
gst/rtsp-sink/gstrtspclientsink.h

index 297016c..175b4ea 100644 (file)
@@ -1434,6 +1434,9 @@ gst_rtsp_client_sink_release_pad (GstElement * element, GstPad * pad)
 
   context = gst_pad_get_element_private (pad);
 
+  /* FIXME: we may need to change our blocking state waiting for
+   * GstRTSPStreamBlocking messages */
+
   GST_RTSP_STATE_LOCK (sink);
   sink->contexts = g_list_remove (sink->contexts, context);
   GST_RTSP_STATE_UNLOCK (sink);
@@ -4331,7 +4334,7 @@ gst_rtsp_client_sink_record (GstRTSPClientSink * sink, gboolean async)
 
   g_mutex_lock (&sink->block_streams_lock);
   /* Wait for streams to be blocked */
-  while (!sink->streams_blocked) {
+  while (sink->n_streams_blocked < g_list_length (sink->contexts)) {
     GST_DEBUG_OBJECT (sink, "waiting for streams to be blocked");
     g_cond_wait (&sink->block_streams_cond, &sink->block_streams_lock);
   }
@@ -4677,7 +4680,7 @@ gst_rtsp_client_sink_handle_message (GstBin * bin, GstMessage * message)
         /* An RTSPStream has prerolled */
         GST_DEBUG_OBJECT (rtsp_client_sink, "received GstRTSPStreamBlocking");
         g_mutex_lock (&rtsp_client_sink->block_streams_lock);
-        rtsp_client_sink->streams_blocked = TRUE;
+        rtsp_client_sink->n_streams_blocked++;
         g_cond_broadcast (&rtsp_client_sink->block_streams_cond);
         g_mutex_unlock (&rtsp_client_sink->block_streams_lock);
       }
index 38230fa..f7845c0 100644 (file)
@@ -220,7 +220,7 @@ struct _GstRTSPClientSink {
   gboolean         streams_collected;
 
   /* TRUE when streams have been blocked */
-  gboolean         streams_blocked;
+  guint            n_streams_blocked;
   GMutex           block_streams_lock;
   GCond            block_streams_cond;