diff --git a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-server-internal.h b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-server-internal.h index b5aaefffc7..6015d6840e 100644 --- a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-server-internal.h +++ b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-server-internal.h @@ -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); diff --git a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream-transport.c b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream-transport.c index d293a95138..4502ec1fd5 100644 --- a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream-transport.c +++ b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream-transport.c @@ -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 diff --git a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream.c b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream.c index fed62d8c82..99d87e9d97 100644 --- a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream.c +++ b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-stream.c @@ -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);