From: Mike Jerris Date: Thu, 25 Jul 2019 23:17:11 +0000 (-0500) Subject: Merge pull request #1771 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:FS... X-Git-Tag: v1.10.0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4abe5905e08b4ecf17e30148939bc495a2ecc5cd;p=thirdparty%2Ffreeswitch.git Merge pull request #1771 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:FS-11965 to master * commit '9e006869e47bf60706da14c54f81c38ccaf790ca': FS-11965: RTC: prevent overflow on percent_fraction (patch by Sergey Khripchenko ) FS-11965: NACK log debug when we get a request 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 ) --- 4abe5905e08b4ecf17e30148939bc495a2ecc5cd diff --cc src/switch_rtp.c index a7ae604d24,795f41207d..97e2b6866c --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@@ -1838,11 -1838,9 +1838,11 @@@ static void rtcp_generate_report_block( } pkt_lost = expected_pkt - stats->period_pkt_count; + if (pkt_lost < 0) pkt_lost = 0; + 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; }