]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11549: RTCP: fix report block stats
authorDragos Oancea <dragos@signalwire.com>
Thu, 7 Feb 2019 23:18:02 +0000 (23:18 +0000)
committerAndrey Volk <andywolk@gmail.com>
Thu, 18 Jul 2019 21:50:23 +0000 (01:50 +0400)
(thanks Sergey Hripchenko)

src/switch_rtp.c

index 288d697595e7eb43fb9123e5a1783e70109d0341..8e544dbfe50e851e1b13e47800f047dca6ee6d1d 100644 (file)
@@ -2176,6 +2176,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                                rtcp_bytes += sizeof(struct switch_rtcp_report_block);
                                rtcp_generate_report_block(rtp_session, rtcp_report_block, nack_dup);
                                rtp_session->rtcp_send_msg.header.count = 1; /* reception report block count */
+                               stats->sent_pkt_count = 0;
                        }
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, "Sending RTCP SR (ssrc=%u)\n", rtp_session->ssrc);
                }
@@ -2355,12 +2356,12 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                rtcp_bytes += sdes_bytes;
 
                /* Prepare next report */
-
-               stats->last_rpt_cycle = stats->cycle;
-               stats->last_rpt_ext_seq = stats->high_ext_seq_recv;
-               stats->last_rpt_ts = rtp_session->write_timer.samplecount;
-               stats->period_pkt_count = 0;
-               stats->sent_pkt_count = 0;
+               if (rtp_session->rtcp_send_msg.header.count) {
+                       stats->last_rpt_cycle = stats->cycle;
+                       stats->last_rpt_ext_seq = stats->high_ext_seq_recv;
+                       stats->last_rpt_ts = rtp_session->write_timer.samplecount;
+                       stats->period_pkt_count = 0;
+               }