rtsp-stream: fix checking of TCP backpressure

The internal index of our appsinks, while it can be used to
determine whether a message is RTP or RTCP, is not necessarily
the same as the interleaved channel. Let the stream-transport
determine the channel to check backpressure for, the same way
it determines the channel according to whether it is sending
RTP or RTCP.
This commit is contained in:
Mathieu Duponchelle 2020-01-09 14:10:44 +01:00
parent 73b4929803
commit e0a4355d6b
3 changed files with 13 additions and 7 deletions

View file

@ -48,7 +48,7 @@ void gst_rtsp_stream_transport_set_back_pressure_callback (G
GDestroyNotify notify);
gboolean gst_rtsp_stream_transport_check_back_pressure (GstRTSPStreamTransport *trans,
guint8 channel);
gboolean is_rtp);
G_END_DECLS

View file

@ -296,13 +296,19 @@ gst_rtsp_stream_transport_set_back_pressure_callback (GstRTSPStreamTransport *
gboolean
gst_rtsp_stream_transport_check_back_pressure (GstRTSPStreamTransport * trans,
guint8 channel)
gboolean is_rtp)
{
GstRTSPStreamTransportPrivate *priv;
gboolean ret = FALSE;
guint8 channel;
priv = trans->priv;
if (is_rtp)
channel = priv->transport->interleaved.min;
else
channel = priv->transport->interleaved.max;
if (priv->back_pressure_func)
ret = priv->back_pressure_func (channel, priv->back_pressure_func_data);

View file

@ -2468,7 +2468,7 @@ clear_tr_cache (GstRTSPStreamPrivate * priv)
/* With lock taken */
static gboolean
any_transport_ready (GstRTSPStream * stream, guint8 channel)
any_transport_ready (GstRTSPStream * stream, gboolean is_rtp)
{
gboolean ret = TRUE;
GstRTSPStreamPrivate *priv = stream->priv;
@ -2482,7 +2482,7 @@ any_transport_ready (GstRTSPStream * stream, guint8 channel)
for (index = 0; index < transports->len; index++) {
GstRTSPStreamTransport *tr = g_ptr_array_index (transports, index);
if (!gst_rtsp_stream_transport_check_back_pressure (tr, channel)) {
if (!gst_rtsp_stream_transport_check_back_pressure (tr, is_rtp)) {
ret = TRUE;
break;
} else {
@ -2565,7 +2565,9 @@ send_tcp_message (GstRTSPStream * stream, gint idx)
ensure_cached_transports (stream);
if (!any_transport_ready (stream, idx))
is_rtp = (idx == 0);
if (!any_transport_ready (stream, is_rtp))
return;
priv->have_buffer[idx] = FALSE;
@ -2591,8 +2593,6 @@ send_tcp_message (GstRTSPStream * stream, gint idx)
if (buffer_list)
n_messages += 1;
is_rtp = (idx == 0);
transports = priv->tr_cache;
g_ptr_array_ref (transports);