]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Merge pull request #1771 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:FS...
authorMike Jerris <mike@jerris.com>
Thu, 25 Jul 2019 23:17:11 +0000 (18:17 -0500)
committerMike Jerris <mike@jerris.com>
Thu, 25 Jul 2019 23:17:11 +0000 (18:17 -0500)
* commit '9e006869e47bf60706da14c54f81c38ccaf790ca':
  FS-11965: RTC: prevent overflow on percent_fraction (patch by Sergey Khripchenko <shripchenko@intermedia.net>)
  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 <piotr@dataandsignal.com>)

1  2 
src/switch_rtp.c

index a7ae604d2457e88aab4f23bd43c0370eac26c1e7,795f41207d46c2c024c61850cd7b0596d14baf68..97e2b6866c86ef6950039cdbd4956821fa8a0710
@@@ -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;
        }