mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
gst-rtsp-server: Fix pushing backlog to client
Check back pressure of a stream transport before popping buffer from its backlog. If the stream transport is not experiencing back pressure, the buffer can be popped from backlog and pushed to client. Fixes:#1298 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2936>
This commit is contained in:
parent
ef6f157205
commit
657cc3e6d6
3 changed files with 32 additions and 7 deletions
|
@ -40,6 +40,8 @@ gboolean gst_rtsp_stream_transport_backlog_pop (GstRTSPStreamT
|
|||
GstBufferList **buffer_list,
|
||||
gboolean *is_rtp);
|
||||
|
||||
gboolean gst_rtsp_stream_transport_backlog_peek_is_rtp (GstRTSPStreamTransport * trans);
|
||||
|
||||
gboolean gst_rtsp_stream_transport_backlog_is_empty (GstRTSPStreamTransport *trans);
|
||||
|
||||
void gst_rtsp_stream_transport_clear_backlog (GstRTSPStreamTransport * trans);
|
||||
|
|
|
@ -950,6 +950,25 @@ gst_rtsp_stream_transport_backlog_pop (GstRTSPStreamTransport * trans,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Not MT-safe, caller should ensure consistent locking.
|
||||
* See gst_rtsp_stream_transport_lock_backlog() */
|
||||
gboolean
|
||||
gst_rtsp_stream_transport_backlog_peek_is_rtp (GstRTSPStreamTransport * trans)
|
||||
{
|
||||
BackLogItem *item;
|
||||
GstRTSPStreamTransportPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (!gst_rtsp_stream_transport_backlog_is_empty (trans),
|
||||
FALSE);
|
||||
|
||||
priv = trans->priv;
|
||||
|
||||
item = (BackLogItem *) gst_queue_array_peek_head_struct (priv->items);
|
||||
|
||||
return item->is_rtp;
|
||||
}
|
||||
|
||||
|
||||
/* Not MT-safe, caller should ensure consistent locking.
|
||||
* See gst_rtsp_stream_transport_lock_backlog() */
|
||||
gboolean
|
||||
|
|
|
@ -2644,16 +2644,20 @@ check_transport_backlog (GstRTSPStream * stream, GstRTSPStreamTransport * trans)
|
|||
gboolean is_rtp;
|
||||
gboolean popped;
|
||||
|
||||
popped =
|
||||
gst_rtsp_stream_transport_backlog_pop (trans, &buffer, &buffer_list,
|
||||
&is_rtp);
|
||||
is_rtp = gst_rtsp_stream_transport_backlog_peek_is_rtp (trans);
|
||||
|
||||
g_assert (popped == TRUE);
|
||||
if (!gst_rtsp_stream_transport_check_back_pressure (trans, is_rtp)) {
|
||||
popped =
|
||||
gst_rtsp_stream_transport_backlog_pop (trans, &buffer, &buffer_list,
|
||||
&is_rtp);
|
||||
|
||||
send_ret = push_data (stream, trans, buffer, buffer_list, is_rtp);
|
||||
g_assert (popped == TRUE);
|
||||
|
||||
gst_clear_buffer (&buffer);
|
||||
gst_clear_buffer_list (&buffer_list);
|
||||
send_ret = push_data (stream, trans, buffer, buffer_list, is_rtp);
|
||||
|
||||
gst_clear_buffer (&buffer);
|
||||
gst_clear_buffer_list (&buffer_list);
|
||||
}
|
||||
}
|
||||
|
||||
gst_rtsp_stream_transport_unlock_backlog (trans);
|
||||
|
|
Loading…
Reference in a new issue