From 929c34577819db4a20101bbea5b3b768fb867192 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk Date: Wed, 23 Dec 2020 14:17:08 -0500 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 Closes #1127 Squashed commit of: commit 23dfb952e794fe8b80afcf39e1cade7f35788b76 Author: jakubkarolczyk <51345687+jakubkarolczyk@users.noreply.github.com> Date: Fri Dec 4 16:17:00 2020 +0000 Update jitter_buffer.c Changed the way of excluding RTCP from being processed by JB commit 79f478a30d990ce50a94e52b2182ad749f05a308 Author: Jakub Karolczyk Date: Wed Dec 23 13:12:44 2020 +0000 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 Change-Id: Iad30001a6554630a63474dc069d81aefa93a0bbb --- daemon/jitter_buffer.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/daemon/jitter_buffer.c b/daemon/jitter_buffer.c index d3b1b56d6..ac25a4f16 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 || PS_ISSET(mp->sfd->stream, RTCP)) + 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,8 +246,13 @@ int buffer_packet(struct media_packet *mp, const str *s) { if (!p) goto end; - ilog(LOG_DEBUG, "Handling JB packet on: %s:%d", sockaddr_print_buf(&mp->stream->endpoint.address), - mp->stream->endpoint.port); + 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)); mp = &p->mp;