mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 23:48:53 +00:00
rtsp-stream: Slightly simplify locking
This commit is contained in:
parent
12169f1e84
commit
37e75cb8ea
1 changed files with 11 additions and 11 deletions
|
@ -2122,6 +2122,7 @@ clear_tr_cache (GstRTSPStreamPrivate * priv, gboolean is_rtp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Must be called with priv->lock */
|
||||||
static void
|
static void
|
||||||
send_tcp_message (GstRTSPStream * stream, gint idx)
|
send_tcp_message (GstRTSPStream * stream, gint idx)
|
||||||
{
|
{
|
||||||
|
@ -2132,10 +2133,7 @@ send_tcp_message (GstRTSPStream * stream, gint idx)
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
gboolean is_rtp;
|
gboolean is_rtp;
|
||||||
|
|
||||||
g_mutex_lock (&priv->lock);
|
|
||||||
|
|
||||||
if (priv->n_outstanding > 0 || !priv->have_buffer[idx]) {
|
if (priv->n_outstanding > 0 || !priv->have_buffer[idx]) {
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2143,14 +2141,12 @@ send_tcp_message (GstRTSPStream * stream, gint idx)
|
||||||
|
|
||||||
if (priv->appsink[idx] == NULL) {
|
if (priv->appsink[idx] == NULL) {
|
||||||
/* session expired */
|
/* session expired */
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sink = GST_APP_SINK (priv->appsink[idx]);
|
sink = GST_APP_SINK (priv->appsink[idx]);
|
||||||
sample = gst_app_sink_pull_sample (sink);
|
sample = gst_app_sink_pull_sample (sink);
|
||||||
if (!sample) {
|
if (!sample) {
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2163,7 +2159,8 @@ send_tcp_message (GstRTSPStream * stream, gint idx)
|
||||||
clear_tr_cache (priv, is_rtp);
|
clear_tr_cache (priv, is_rtp);
|
||||||
for (walk = priv->transports; walk; walk = g_list_next (walk)) {
|
for (walk = priv->transports; walk; walk = g_list_next (walk)) {
|
||||||
GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data;
|
GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data;
|
||||||
const GstRTSPTransport *t = gst_rtsp_stream_transport_get_transport (tr);
|
const GstRTSPTransport *t =
|
||||||
|
gst_rtsp_stream_transport_get_transport (tr);
|
||||||
|
|
||||||
if (t->lower_transport != GST_RTSP_LOWER_TRANS_TCP)
|
if (t->lower_transport != GST_RTSP_LOWER_TRANS_TCP)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2178,7 +2175,8 @@ send_tcp_message (GstRTSPStream * stream, gint idx)
|
||||||
clear_tr_cache (priv, is_rtp);
|
clear_tr_cache (priv, is_rtp);
|
||||||
for (walk = priv->transports; walk; walk = g_list_next (walk)) {
|
for (walk = priv->transports; walk; walk = g_list_next (walk)) {
|
||||||
GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data;
|
GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data;
|
||||||
const GstRTSPTransport *t = gst_rtsp_stream_transport_get_transport (tr);
|
const GstRTSPTransport *t =
|
||||||
|
gst_rtsp_stream_transport_get_transport (tr);
|
||||||
|
|
||||||
if (t->lower_transport != GST_RTSP_LOWER_TRANS_TCP)
|
if (t->lower_transport != GST_RTSP_LOWER_TRANS_TCP)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2218,6 +2216,8 @@ send_tcp_message (GstRTSPStream * stream, gint idx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gst_sample_unref (sample);
|
gst_sample_unref (sample);
|
||||||
|
|
||||||
|
g_mutex_lock (&priv->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -2240,11 +2240,11 @@ handle_new_sample (GstAppSink * sink, gpointer user_data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
|
|
||||||
if (idx != -1)
|
if (idx != -1)
|
||||||
send_tcp_message (stream, idx);
|
send_tcp_message (stream, idx);
|
||||||
|
|
||||||
|
g_mutex_unlock (&priv->lock);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4042,11 +4042,11 @@ on_message_sent (gpointer user_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
|
|
||||||
if (idx != -1)
|
if (idx != -1)
|
||||||
send_tcp_message (stream, idx);
|
send_tcp_message (stream, idx);
|
||||||
|
|
||||||
|
g_mutex_unlock (&priv->lock);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
|
Loading…
Reference in a new issue