gboolean blocked;
GstRTSPTransportMode transport_mode;
gboolean stop_on_disconnect;
+ guint blocking_msg_received;
GstElement *element;
GRecMutex state_lock; /* locking order: state lock, lock */
priv->do_rate_control = DEFAULT_DO_RATE_CONTROL;
priv->dscp_qos = DEFAULT_DSCP_QOS;
priv->expected_async_done = FALSE;
+ priv->blocking_msg_received = 0;
}
static void
GST_DEBUG ("media %p set blocked %d", media, blocked);
priv->blocked = blocked;
g_ptr_array_foreach (priv->streams, (GFunc) stream_update_blocked, media);
+
+ if (!blocked)
+ priv->blocking_msg_received = 0;
}
static void
* streams that are complete */
priv->blocked = FALSE;
g_ptr_array_foreach (priv->streams, (GFunc) stream_unblock, media);
+ priv->blocking_msg_received = 0;
}
static void
return ret;
}
+static void
+stream_collect_active (GstRTSPStream * stream, guint * active_streams)
+{
+ if (gst_rtsp_stream_is_complete (stream))
+ (*active_streams)++;
+}
+
+static guint
+nbr_active_streams (GstRTSPMedia * media)
+{
+ guint ret = 0;
+
+ g_ptr_array_foreach (media->priv->streams, (GFunc) stream_collect_active,
+ &ret);
+
+ return ret;
+}
+
+ /* called with state-lock */
/* called with state-lock */
static gboolean
default_handle_message (GstRTSPMedia * media, GstMessage * message)
s = gst_message_get_structure (message);
if (gst_structure_has_name (s, "GstRTSPStreamBlocking")) {
GST_DEBUG ("media received blocking message");
+ priv->blocking_msg_received++;
if (priv->blocked && media_streams_blocking (media) &&
- priv->no_more_pads_pending == 0) {
+ priv->no_more_pads_pending == 0 &&
+ (priv->blocking_msg_received == nbr_active_streams (media) ||
+ priv->blocking_msg_received == priv->streams->len)) {
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message), "media is blocking");
g_mutex_lock (&priv->lock);
collect_media_stats (media);
if (priv->status == GST_RTSP_MEDIA_STATUS_PREPARING)
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED);
+
+ priv->blocking_msg_received = 0;
}
}
break;