mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
rtpsource: properly prune RTCP packets out of feedback_retention_window
Closes #522
This commit is contained in:
parent
53f03d4cc1
commit
458741e4b2
3 changed files with 26 additions and 6 deletions
|
@ -3644,8 +3644,8 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data)
|
|||
/* check for outdated collisions */
|
||||
if (source->internal) {
|
||||
GST_DEBUG ("Timing out collisions for %x", source->ssrc);
|
||||
rtp_source_timeout (source, data->current_time,
|
||||
data->running_time - sess->rtcp_feedback_retention_window);
|
||||
rtp_source_timeout (source, data->current_time, data->running_time,
|
||||
sess->rtcp_feedback_retention_window);
|
||||
}
|
||||
|
||||
/* nothing else to do when without RTCP */
|
||||
|
|
|
@ -1831,17 +1831,33 @@ rtp_source_add_conflicting_address (RTPSource * src,
|
|||
*/
|
||||
void
|
||||
rtp_source_timeout (RTPSource * src, GstClockTime current_time,
|
||||
GstClockTime feedback_retention_window)
|
||||
GstClockTime running_time, GstClockTime feedback_retention_window)
|
||||
{
|
||||
GstRTCPPacket *pkt;
|
||||
GstClockTime max_pts_window;
|
||||
guint pruned = 0;
|
||||
|
||||
src->conflicting_addresses =
|
||||
timeout_conflicting_addresses (src->conflicting_addresses, current_time);
|
||||
|
||||
if (feedback_retention_window == GST_CLOCK_TIME_NONE ||
|
||||
running_time < feedback_retention_window) {
|
||||
return;
|
||||
}
|
||||
|
||||
max_pts_window = running_time - feedback_retention_window;
|
||||
|
||||
/* Time out AVPF packets that are older than the desired length */
|
||||
while ((pkt = g_queue_peek_tail (src->retained_feedback)) &&
|
||||
GST_BUFFER_PTS (pkt) < feedback_retention_window)
|
||||
gst_buffer_unref (g_queue_pop_tail (src->retained_feedback));
|
||||
while ((pkt = g_queue_peek_head (src->retained_feedback)) &&
|
||||
GST_BUFFER_PTS (pkt) < max_pts_window) {
|
||||
gst_buffer_unref (g_queue_pop_head (src->retained_feedback));
|
||||
pruned++;
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (src,
|
||||
"%u RTCP packets pruned with PTS less than %" GST_TIME_FORMAT
|
||||
", queue len: %u", pruned, GST_TIME_ARGS (max_pts_window),
|
||||
g_queue_get_length (src->retained_feedback));
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -1876,6 +1892,9 @@ rtp_source_retain_rtcp_packet (RTPSource * src, GstRTCPPacket * packet,
|
|||
GST_BUFFER_PTS (buffer) = running_time;
|
||||
|
||||
g_queue_insert_sorted (src->retained_feedback, buffer, compare_buffers, NULL);
|
||||
|
||||
GST_LOG_OBJECT (src, "RTCP packet retained with PTS: %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (running_time));
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -288,6 +288,7 @@ void rtp_conflicting_address_free (RTPConflictingAddress * addr);
|
|||
|
||||
void rtp_source_timeout (RTPSource * src,
|
||||
GstClockTime current_time,
|
||||
GstClockTime running_time,
|
||||
GstClockTime feedback_retention_window);
|
||||
|
||||
void rtp_source_retain_rtcp_packet (RTPSource * src,
|
||||
|
|
Loading…
Reference in a new issue