From 79f478a30d990ce50a94e52b2182ad749f05a308 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk Date: Wed, 23 Dec 2020 13:12:44 +0000 Subject: [PATCH] For RTCPMUX streams we need to filter out RTCP packets selectively from the stream. Original implementation just stops processing packets in JitterBuffer when the first RTCP packet is received in RTCPMUX stream --- daemon/jitter_buffer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/daemon/jitter_buffer.c b/daemon/jitter_buffer.c index ed8c2782d..6faeba0d5 100644 --- a/daemon/jitter_buffer.c +++ b/daemon/jitter_buffer.c @@ -4,6 +4,7 @@ #include "call.h" #include "codec.h" #include "main.h" +#include "rtcplib.h" #include #include @@ -233,7 +234,7 @@ int buffer_packet(struct media_packet *mp, const str *s) { rwlock_lock_r(&call->master_lock); struct jitter_buffer *jb = mp->stream->jb; - if (!jb || jb->disabled) + if (!jb || jb->disabled || !PS_ISSET(mp->sfd->stream, RTP)) goto end; if(jb->initial_pkts < INITIAL_PACKETS) { //Ignore initial Payload Type 126 if any @@ -245,10 +246,10 @@ int buffer_packet(struct media_packet *mp, const str *s) { if (!p) goto end; - if ((p->mp.rtp->m_pt & 0x7f) >=72 && (p->mp.rtp->m_pt & 0x7f) <= 76){ - ilog(LOG_DEBUG, "Discard from JB. This is RTCP packet. SSRC %u Payload %d", ntohl(p->mp.rtp->ssrc), (p->mp.rtp->m_pt & 0x7f)); - goto end; - } + if (PS_ISSET(mp->sfd->stream, RTCP) && rtcp_demux_is_rtcp((void *) &p->mp.raw)){ + ilog(LOG_DEBUG, "Discarding from JB. This is RTCP packet. SSRC %u Payload %d", ntohl(p->mp.rtp->ssrc), (p->mp.rtp->m_pt & 0x7f)); + goto end; + } ilog(LOG_DEBUG, "Handling JB packet on: %s:%d (RTP SSRC %u Payload: %d)", sockaddr_print_buf(&mp->stream->endpoint.address), mp->stream->endpoint.port, ntohl(p->mp.rtp->ssrc), (p->mp.rtp->m_pt & 0x7f));