Commit ebefb77d authored by Matthew Waters's avatar Matthew Waters 🐨

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
parent cf6d7301
......@@ -1404,6 +1404,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);
......@@ -4265,7 +4268,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);
}
......@@ -4595,7 +4598,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);
}
......
......@@ -218,7 +218,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment