From 40982338a0ab921e3cd0f8739ac4bf5eee2e801a Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 25 Jul 2019 22:48:17 +0000 Subject: [PATCH] FS-11965: RTCP: fix on rtcp_report_block->fraction - "if X packets were expected and X was lost, we want 0xff to be reported, not 0" (patch by Piotr Gregor ) --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c2e7e0f6fb..142b107469 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1840,7 +1840,7 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ pkt_lost = expected_pkt - stats->period_pkt_count; stats->cum_lost=stats->cum_lost+pkt_lost; if (expected_pkt > 0 && pkt_lost > 0) { - rtcp_report_block->fraction = (uint8_t) (pkt_lost * 256 / expected_pkt); + rtcp_report_block->fraction = (pkt_lost == expected_pkt ? 255 : (uint8_t) (pkt_lost * 256 / expected_pkt)); /* if X packets were expected and X was lost, we want 0xff to be reported, not 0 */ } else { rtcp_report_block->fraction = 0; }