<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15674">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_rtp_asterisk: Fix standard deviation calculation<br><br>For some input to the standard deviation algorithm extremely large,<br>and wrong numbers were being calculated.<br><br>This patch uses a new formula for correctly calculating both the<br>running mean and standard deviation for the given inputs.<br><br>ASTERISK-29364 #close<br><br>Change-Id: Ibc6e18be41c28bed3fde06d612607acc3fbd621f<br>---<br>M res/res_rtp_asterisk.c<br>1 file changed, 67 insertions(+), 99 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c</span><br><span>index 4fd803b..607fd91 100644</span><br><span>--- a/res/res_rtp_asterisk.c</span><br><span>+++ b/res/res_rtp_asterisk.c</span><br><span>@@ -384,7 +384,7 @@</span><br><span> unsigned int txcount; /*!< How many packets have we sent? */</span><br><span> unsigned int txoctetcount; /*!< How many octets have we sent? (txcount*160)*/</span><br><span> unsigned int cycles; /*!< Shifted count of sequence number cycles */</span><br><span style="color: hsl(0, 100%, 40%);">- double rxjitter; /*!< Interarrival jitter at the moment in seconds */</span><br><span style="color: hsl(120, 100%, 40%);">+ double rxjitter; /*!< Interarrival jitter at the moment in seconds to be reported */</span><br><span> double rxtransit; /*!< Relative transit time for previous packet */</span><br><span> struct ast_format *lasttxformat;</span><br><span> struct ast_format *lastrxformat;</span><br><span>@@ -511,34 +511,36 @@</span><br><span> unsigned int reported_jitter; /*!< The contents of their last jitter entry in the RR */</span><br><span> unsigned int reported_lost; /*!< Reported lost packets in their RR */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- double reported_maxjitter;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_minjitter;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_normdev_jitter;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_stdev_jitter;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int reported_jitter_count;</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_maxjitter; /*!< Maximum reported interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_minjitter; /*!< Minimum reported interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_normdev_jitter; /*!< Mean of reported interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_stdev_jitter; /*!< Standard deviation of reported interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int reported_jitter_count; /*!< Reported interarrival jitter count */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- double reported_maxlost;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_minlost;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_normdev_lost;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_stdev_lost;</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_maxlost; /*!< Maximum reported packets lost */</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_minlost; /*!< Minimum reported packets lost */</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_normdev_lost; /*!< Mean of reported packets lost */</span><br><span style="color: hsl(120, 100%, 40%);">+ double reported_stdev_lost; /*!< Standard deviation of reported packets lost */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int reported_lost_count; /*!< Reported packets lost count */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- double rxlost;</span><br><span style="color: hsl(0, 100%, 40%);">- double maxrxlost;</span><br><span style="color: hsl(0, 100%, 40%);">- double minrxlost;</span><br><span style="color: hsl(0, 100%, 40%);">- double normdev_rxlost;</span><br><span style="color: hsl(0, 100%, 40%);">- double stdev_rxlost;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int rxlost_count;</span><br><span style="color: hsl(120, 100%, 40%);">+ double rxlost; /*!< Calculated number of lost packets since last report */</span><br><span style="color: hsl(120, 100%, 40%);">+ double maxrxlost; /*!< Maximum calculated lost number of packets between reports */</span><br><span style="color: hsl(120, 100%, 40%);">+ double minrxlost; /*!< Minimum calculated lost number of packets between reports */</span><br><span style="color: hsl(120, 100%, 40%);">+ double normdev_rxlost; /*!< Mean of calculated lost packets between reports */</span><br><span style="color: hsl(120, 100%, 40%);">+ double stdev_rxlost; /*!< Standard deviation of calculated lost packets between reports */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int rxlost_count; /*!< Calculated lost packets sample count */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- double maxrxjitter;</span><br><span style="color: hsl(0, 100%, 40%);">- double minrxjitter;</span><br><span style="color: hsl(0, 100%, 40%);">- double normdev_rxjitter;</span><br><span style="color: hsl(0, 100%, 40%);">- double stdev_rxjitter;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int rxjitter_count;</span><br><span style="color: hsl(0, 100%, 40%);">- double maxrtt;</span><br><span style="color: hsl(0, 100%, 40%);">- double minrtt;</span><br><span style="color: hsl(0, 100%, 40%);">- double normdevrtt;</span><br><span style="color: hsl(0, 100%, 40%);">- double stdevrtt;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int rtt_count;</span><br><span style="color: hsl(120, 100%, 40%);">+ double maxrxjitter; /*!< Maximum of calculated interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ double minrxjitter; /*!< Minimum of calculated interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ double normdev_rxjitter; /*!< Mean of calculated interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ double stdev_rxjitter; /*!< Standard deviation of calculated interarrival jitter */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int rxjitter_count; /*!< Calculated interarrival jitter count */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ double maxrtt; /*!< Maximum of calculated round trip time */</span><br><span style="color: hsl(120, 100%, 40%);">+ double minrtt; /*!< Minimum of calculated round trip time */</span><br><span style="color: hsl(120, 100%, 40%);">+ double normdevrtt; /*!< Mean of calculated round trip time */</span><br><span style="color: hsl(120, 100%, 40%);">+ double stdevrtt; /*!< Standard deviation of calculated round trip time */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int rtt_count; /*!< Calculated round trip time count */</span><br><span> </span><br><span> /* VP8: sequence number for the RTCP FIR FCI */</span><br><span> int firseq;</span><br><span>@@ -3317,49 +3319,32 @@</span><br><span> return interval;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/*! \brief Calculate normal deviation */</span><br><span style="color: hsl(0, 100%, 40%);">-static double normdev_compute(double normdev, double sample, unsigned int sample_count)</span><br><span style="color: hsl(120, 100%, 40%);">+static void calc_mean_and_standard_deviation(double new_sample, double *mean, double *std_dev, unsigned int *count)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- normdev = normdev * sample_count + sample;</span><br><span style="color: hsl(0, 100%, 40%);">- sample_count++;</span><br><span style="color: hsl(120, 100%, 40%);">+ double delta1;</span><br><span style="color: hsl(120, 100%, 40%);">+ double delta2;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- It's possible the sample_count hits the maximum value and back to 0.</span><br><span style="color: hsl(0, 100%, 40%);">- Set to 1 to prevent the divide by zero crash if the sample_count is 0.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (sample_count == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- sample_count = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* First convert the standard deviation back into a sum of squares. */</span><br><span style="color: hsl(120, 100%, 40%);">+ double last_sum_of_squares = (*std_dev) * (*std_dev) * (*count ?: 1);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (++(*count) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Avoid potential divide by zero on an overflow */</span><br><span style="color: hsl(120, 100%, 40%);">+ *count = 1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return normdev / sample_count;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static double stddev_compute(double stddev, double sample, double normdev, double normdev_curent, unsigned int sample_count)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- for the formula check http://www.cs.umd.edu/~austinjp/constSD.pdf</span><br><span style="color: hsl(0, 100%, 40%);">- return sqrt( (sample_count*pow(stddev,2) + sample_count*pow((sample-normdev)/(sample_count+1),2) + pow(sample-normdev_curent,2)) / (sample_count+1));</span><br><span style="color: hsl(0, 100%, 40%);">- we can compute the sigma^2 and that way we would have to do the sqrt only 1 time at the end and would save another pow 2 compute</span><br><span style="color: hsl(0, 100%, 40%);">- optimized formula</span><br><span style="color: hsl(0, 100%, 40%);">-*/</span><br><span style="color: hsl(0, 100%, 40%);">-#define SQUARE(x) ((x) * (x))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- stddev = sample_count * stddev;</span><br><span style="color: hsl(0, 100%, 40%);">- sample_count++;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*</span><br><span style="color: hsl(0, 100%, 40%);">- It's possible the sample_count hits the maximum value and back to 0.</span><br><span style="color: hsl(0, 100%, 40%);">- Set to 1 to prevent the divide by zero crash if the sample_count is 0.</span><br><span style="color: hsl(120, 100%, 40%);">+ * Below is an implementation of Welford's online algorithm [1] for calculating</span><br><span style="color: hsl(120, 100%, 40%);">+ * mean and variance in a single pass.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * [1] https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">- if (sample_count == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- sample_count = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return stddev +</span><br><span style="color: hsl(0, 100%, 40%);">- ( sample_count * SQUARE( (sample - normdev) / sample_count ) ) +</span><br><span style="color: hsl(0, 100%, 40%);">- ( SQUARE(sample - normdev_curent) / sample_count );</span><br><span style="color: hsl(120, 100%, 40%);">+ delta1 = new_sample - *mean;</span><br><span style="color: hsl(120, 100%, 40%);">+ *mean += (delta1 / *count);</span><br><span style="color: hsl(120, 100%, 40%);">+ delta2 = new_sample - *mean;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#undef SQUARE</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Now calculate the new variance, and subsequent standard deviation */</span><br><span style="color: hsl(120, 100%, 40%);">+ *std_dev = sqrt((last_sum_of_squares + (delta1 * delta2)) / *count);</span><br><span> }</span><br><span> </span><br><span> static int create_new_socket(const char *type, int af)</span><br><span>@@ -4434,7 +4419,6 @@</span><br><span> unsigned int expected_packets;</span><br><span> unsigned int expected_interval;</span><br><span> unsigned int received_interval;</span><br><span style="color: hsl(0, 100%, 40%);">- double rxlost_current;</span><br><span> int lost_interval;</span><br><span> </span><br><span> /* Compute statistics */</span><br><span>@@ -4464,6 +4448,13 @@</span><br><span> /* Update RTCP statistics */</span><br><span> rtp->rtcp->received_prior = rtp->rxcount;</span><br><span> rtp->rtcp->expected_prior = expected_packets;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * While rxlost represents the number of packets lost since the last report was sent, for</span><br><span style="color: hsl(120, 100%, 40%);">+ * the calculations below it should be thought of as a single sample. Thus min/max are the</span><br><span style="color: hsl(120, 100%, 40%);">+ * lowest/highest sample value seen, and the mean is the average number of packets lost</span><br><span style="color: hsl(120, 100%, 40%);">+ * between each report. As such rxlost_count only needs to be incremented per report.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span> if (lost_interval <= 0) {</span><br><span> rtp->rtcp->rxlost = 0;</span><br><span> } else {</span><br><span>@@ -4478,16 +4469,9 @@</span><br><span> if (lost_interval > rtp->rtcp->maxrxlost) {</span><br><span> rtp->rtcp->maxrxlost = rtp->rtcp->rxlost;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- rxlost_current = normdev_compute(rtp->rtcp->normdev_rxlost,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rxlost,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rxlost_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->stdev_rxlost = stddev_compute(rtp->rtcp->stdev_rxlost,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rxlost,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->normdev_rxlost,</span><br><span style="color: hsl(0, 100%, 40%);">- rxlost_current,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rxlost_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->normdev_rxlost = rxlost_current;</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rxlost_count++;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ calc_mean_and_standard_deviation(rtp->rtcp->rxlost, &rtp->rtcp->normdev_rxlost,</span><br><span style="color: hsl(120, 100%, 40%);">+ &rtp->rtcp->stdev_rxlost, &rtp->rtcp->rxlost_count);</span><br><span> }</span><br><span> </span><br><span> static int ast_rtcp_generate_report(struct ast_rtp_instance *instance, unsigned char *rtcpheader,</span><br><span>@@ -5423,7 +5407,6 @@</span><br><span> double prog;</span><br><span> int rate = ast_rtp_get_rate(rtp->f.subclass.format);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- double normdev_rxjitter_current;</span><br><span> if ((!rtp->rxcore.tv_sec && !rtp->rxcore.tv_usec) || mark) {</span><br><span> gettimeofday(&rtp->rxcore, NULL);</span><br><span> rtp->drxcore = (double) rtp->rxcore.tv_sec + (double) rtp->rxcore.tv_usec / 1000000;</span><br><span>@@ -5458,11 +5441,8 @@</span><br><span> if (rtp->rtcp && rtp->rxjitter < rtp->rtcp->minrxjitter)</span><br><span> rtp->rtcp->minrxjitter = rtp->rxjitter;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- normdev_rxjitter_current = normdev_compute(rtp->rtcp->normdev_rxjitter,rtp->rxjitter,rtp->rtcp->rxjitter_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->stdev_rxjitter = stddev_compute(rtp->rtcp->stdev_rxjitter,rtp->rxjitter,rtp->rtcp->normdev_rxjitter,normdev_rxjitter_current,rtp->rtcp->rxjitter_count);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->normdev_rxjitter = normdev_rxjitter_current;</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rxjitter_count++;</span><br><span style="color: hsl(120, 100%, 40%);">+ calc_mean_and_standard_deviation(rtp->rxjitter, &rtp->rtcp->normdev_rxjitter,</span><br><span style="color: hsl(120, 100%, 40%);">+ &rtp->rtcp->stdev_rxjitter, &rtp->rtcp->rxjitter_count);</span><br><span> }</span><br><span> }</span><br><span> </span><br><span>@@ -5778,7 +5758,6 @@</span><br><span> unsigned int rtt_lsw;</span><br><span> unsigned int lsr_a;</span><br><span> unsigned int rtt;</span><br><span style="color: hsl(0, 100%, 40%);">- double normdevrtt_current;</span><br><span> </span><br><span> gettimeofday(&now, NULL);</span><br><span> timeval2ntp(now, &msw, &lsw);</span><br><span>@@ -5815,16 +5794,8 @@</span><br><span> rtp->rtcp->maxrtt = rtp->rtcp->rtt;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- normdevrtt_current = normdev_compute(rtp->rtcp->normdevrtt,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rtt,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rtt_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->stdevrtt = stddev_compute(rtp->rtcp->stdevrtt,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rtt,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->normdevrtt,</span><br><span style="color: hsl(0, 100%, 40%);">- normdevrtt_current,</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rtt_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->normdevrtt = normdevrtt_current;</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->rtt_count++;</span><br><span style="color: hsl(120, 100%, 40%);">+ calc_mean_and_standard_deviation(rtp->rtcp->rtt, &rtp->rtcp->normdevrtt,</span><br><span style="color: hsl(120, 100%, 40%);">+ &rtp->rtcp->stdevrtt, &rtp->rtcp->rtt_count);</span><br><span> </span><br><span> return 0;</span><br><span> }</span><br><span>@@ -5836,7 +5807,6 @@</span><br><span> static void update_jitter_stats(struct ast_rtp *rtp, unsigned int ia_jitter)</span><br><span> {</span><br><span> double reported_jitter;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_normdev_jitter_current;</span><br><span> </span><br><span> rtp->rtcp->reported_jitter = ia_jitter;</span><br><span> reported_jitter = (double) rtp->rtcp->reported_jitter;</span><br><span>@@ -5849,9 +5819,9 @@</span><br><span> if (reported_jitter > rtp->rtcp->reported_maxjitter) {</span><br><span> rtp->rtcp->reported_maxjitter = reported_jitter;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- reported_normdev_jitter_current = normdev_compute(rtp->rtcp->reported_normdev_jitter, reported_jitter, rtp->rtcp->reported_jitter_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->reported_stdev_jitter = stddev_compute(rtp->rtcp->reported_stdev_jitter, reported_jitter, rtp->rtcp->reported_normdev_jitter, reported_normdev_jitter_current, rtp->rtcp->reported_jitter_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->reported_normdev_jitter = reported_normdev_jitter_current;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ calc_mean_and_standard_deviation(reported_jitter, &rtp->rtcp->reported_normdev_jitter,</span><br><span style="color: hsl(120, 100%, 40%);">+ &rtp->rtcp->reported_stdev_jitter, &rtp->rtcp->reported_jitter_count);</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -5861,11 +5831,10 @@</span><br><span> static void update_lost_stats(struct ast_rtp *rtp, unsigned int lost_packets)</span><br><span> {</span><br><span> double reported_lost;</span><br><span style="color: hsl(0, 100%, 40%);">- double reported_normdev_lost_current;</span><br><span> </span><br><span> rtp->rtcp->reported_lost = lost_packets;</span><br><span> reported_lost = (double)rtp->rtcp->reported_lost;</span><br><span style="color: hsl(0, 100%, 40%);">- if (rtp->rtcp->reported_jitter_count == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (rtp->rtcp->reported_lost_count == 0) {</span><br><span> rtp->rtcp->reported_minlost = reported_lost;</span><br><span> }</span><br><span> if (reported_lost < rtp->rtcp->reported_minlost) {</span><br><span>@@ -5874,9 +5843,9 @@</span><br><span> if (reported_lost > rtp->rtcp->reported_maxlost) {</span><br><span> rtp->rtcp->reported_maxlost = reported_lost;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- reported_normdev_lost_current = normdev_compute(rtp->rtcp->reported_normdev_lost, reported_lost, rtp->rtcp->reported_jitter_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->reported_stdev_lost = stddev_compute(rtp->rtcp->reported_stdev_lost, reported_lost, rtp->rtcp->reported_normdev_lost, reported_normdev_lost_current, rtp->rtcp->reported_jitter_count);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->reported_normdev_lost = reported_normdev_lost_current;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ calc_mean_and_standard_deviation(reported_lost, &rtp->rtcp->reported_normdev_lost,</span><br><span style="color: hsl(120, 100%, 40%);">+ &rtp->rtcp->reported_stdev_lost, &rtp->rtcp->reported_lost_count);</span><br><span> }</span><br><span> </span><br><span> /*! \pre instance is locked */</span><br><span>@@ -6449,7 +6418,6 @@</span><br><span> }</span><br><span> update_jitter_stats(rtp, report_block->ia_jitter);</span><br><span> update_lost_stats(rtp, report_block->lost_count.packets);</span><br><span style="color: hsl(0, 100%, 40%);">- rtp->rtcp->reported_jitter_count++;</span><br><span> </span><br><span> if (rtcp_debug_test_addr(addr)) {</span><br><span> ast_verbose(" Fraction lost: %d\n", report_block->lost_count.fraction);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15674">change 15674</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15674"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ibc6e18be41c28bed3fde06d612607acc3fbd621f </div>
<div style="display:none"> Gerrit-Change-Number: 15674 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>