From b5a61f488dba3d558bc53c592fd845c7d0236b41 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 19 Jun 2018 14:53:02 +1000 Subject: [PATCH] rtspclientsink: fix waiting for multiple streams 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 | 7 +++++-- gst/rtsp-sink/gstrtspclientsink.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/rtsp-sink/gstrtspclientsink.c b/gst/rtsp-sink/gstrtspclientsink.c index 297016cb9c..175b4ea705 100644 --- a/gst/rtsp-sink/gstrtspclientsink.c +++ b/gst/rtsp-sink/gstrtspclientsink.c @@ -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); } diff --git a/gst/rtsp-sink/gstrtspclientsink.h b/gst/rtsp-sink/gstrtspclientsink.h index 38230fa305..f7845c03fa 100644 --- a/gst/rtsp-sink/gstrtspclientsink.h +++ b/gst/rtsp-sink/gstrtspclientsink.h @@ -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;