More on ticket #535: updated files using and related to math.h

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1961 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c
index a091d83..61179ef 100644
--- a/pjsip-apps/src/samples/siprtp.c
+++ b/pjsip-apps/src/samples/siprtp.c
@@ -1659,7 +1659,7 @@
 	/* Jitter  */
 	MIN_(min_stat.rx.jitter.min, audio->rtcp.stat.rx.jitter.min);
 	MAX_(max_stat.rx.jitter.max, audio->rtcp.stat.rx.jitter.max);
-	AVG_(avg_stat.rx.jitter.avg, audio->rtcp.stat.rx.jitter.avg);
+	AVG_(avg_stat.rx.jitter.mean, audio->rtcp.stat.rx.jitter.mean);
 
 
 	/* TX Statistisc: */
@@ -1692,13 +1692,13 @@
 	/* Jitter  */
 	MIN_(min_stat.tx.jitter.min, audio->rtcp.stat.tx.jitter.min);
 	MAX_(max_stat.tx.jitter.max, audio->rtcp.stat.tx.jitter.max);
-	AVG_(avg_stat.tx.jitter.avg, audio->rtcp.stat.tx.jitter.avg);
+	AVG_(avg_stat.tx.jitter.mean, audio->rtcp.stat.tx.jitter.mean);
 
 
 	/* RTT */
 	MIN_(min_stat.rtt.min, audio->rtcp.stat.rtt.min);
 	MAX_(max_stat.rtt.max, audio->rtcp.stat.rtt.max);
-	AVG_(avg_stat.rtt.avg, audio->rtcp.stat.rtt.avg);
+	AVG_(avg_stat.rtt.mean, audio->rtcp.stat.rtt.mean);
 
 	++count;
     }
@@ -1767,7 +1767,7 @@
 	   "packets",
 
 	   min_stat.rx.jitter.min/1000.0, 
-	   avg_stat.rx.jitter.avg/1000.0, 
+	   avg_stat.rx.jitter.mean/1000.0, 
 	   max_stat.rx.jitter.max/1000.0,
 	   "ms",
 	
@@ -1798,13 +1798,13 @@
 	   "packets",
 
 	   min_stat.tx.jitter.min/1000.0, 
-	   avg_stat.tx.jitter.avg/1000.0, 
+	   avg_stat.tx.jitter.mean/1000.0, 
 	   max_stat.tx.jitter.max/1000.0,
 	   "ms",
 
 	   /* rtt */
 	   min_stat.rtt.min/1000.0, 
-	   avg_stat.rtt.avg/1000.0, 
+	   avg_stat.rtt.mean/1000.0, 
 	   max_stat.rtt.max/1000.0,
 	   "ms"
 	   );
diff --git a/pjsip-apps/src/samples/siprtp_report.c b/pjsip-apps/src/samples/siprtp_report.c
index adba64d..3c08445 100644
--- a/pjsip-apps/src/samples/siprtp_report.c
+++ b/pjsip-apps/src/samples/siprtp_report.c
@@ -160,12 +160,12 @@
 	   audio->rtcp.stat.rx.reorder * 100.0 / (audio->rtcp.stat.rx.pkt + audio->rtcp.stat.rx.loss),
 	   "",
 	   audio->rtcp.stat.rx.loss_period.min / 1000.0, 
-	   audio->rtcp.stat.rx.loss_period.avg / 1000.0, 
+	   audio->rtcp.stat.rx.loss_period.mean / 1000.0, 
 	   audio->rtcp.stat.rx.loss_period.max / 1000.0,
 	   audio->rtcp.stat.rx.loss_period.last / 1000.0,
 	   "",
 	   audio->rtcp.stat.rx.jitter.min / 1000.0,
-	   audio->rtcp.stat.rx.jitter.avg / 1000.0,
+	   audio->rtcp.stat.rx.jitter.mean / 1000.0,
 	   audio->rtcp.stat.rx.jitter.max / 1000.0,
 	   audio->rtcp.stat.rx.jitter.last / 1000.0,
 	   ""
@@ -204,12 +204,12 @@
 	   audio->rtcp.stat.tx.reorder * 100.0 / (audio->rtcp.stat.tx.pkt + audio->rtcp.stat.tx.loss),
 	   "",
 	   audio->rtcp.stat.tx.loss_period.min / 1000.0, 
-	   audio->rtcp.stat.tx.loss_period.avg / 1000.0, 
+	   audio->rtcp.stat.tx.loss_period.mean / 1000.0, 
 	   audio->rtcp.stat.tx.loss_period.max / 1000.0,
 	   audio->rtcp.stat.tx.loss_period.last / 1000.0,
 	   "",
 	   audio->rtcp.stat.tx.jitter.min / 1000.0,
-	   audio->rtcp.stat.tx.jitter.avg / 1000.0,
+	   audio->rtcp.stat.tx.jitter.mean / 1000.0,
 	   audio->rtcp.stat.tx.jitter.max / 1000.0,
 	   audio->rtcp.stat.tx.jitter.last / 1000.0,
 	   ""
@@ -219,7 +219,7 @@
     PJ_LOG(3, (THIS_FILE,
 	   "             RTT delay      : %7.3f %7.3f %7.3f %7.3f%s\n", 
 	   audio->rtcp.stat.rtt.min / 1000.0,
-	   audio->rtcp.stat.rtt.avg / 1000.0,
+	   audio->rtcp.stat.rtt.mean / 1000.0,
 	   audio->rtcp.stat.rtt.max / 1000.0,
 	   audio->rtcp.stat.rtt.last / 1000.0,
 	   ""
diff --git a/pjsip-apps/src/samples/streamutil.c b/pjsip-apps/src/samples/streamutil.c
index dfd2ee5..29462c9 100644
--- a/pjsip-apps/src/samples/streamutil.c
+++ b/pjsip-apps/src/samples/streamutil.c
@@ -768,9 +768,9 @@
     printf(" RX stat last update: %s\n"
 	   "    total %s packets %sB received (%sB +IP hdr)%s\n"
 	   "    pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n"
-	   "          (msec)    min     avg     max     last\n"
-	   "    loss period: %7.3f %7.3f %7.3f %7.3f%s\n"
-	   "    jitter     : %7.3f %7.3f %7.3f %7.3f%s\n",
+	   "          (msec)    min     avg     max     last    dev\n"
+	   "    loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n"
+	   "    jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n",
 	   last_update,
 	   good_number(packets, stat.rx.pkt),
 	   good_number(bytes, stat.rx.bytes),
@@ -784,14 +784,16 @@
 	   stat.rx.reorder * 100.0 / (stat.rx.pkt + stat.rx.loss),
 	   "",
 	   stat.rx.loss_period.min / 1000.0, 
-	   stat.rx.loss_period.avg / 1000.0, 
+	   stat.rx.loss_period.mean / 1000.0, 
 	   stat.rx.loss_period.max / 1000.0,
 	   stat.rx.loss_period.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.rx.loss_period) / 1000.0,
 	   "",
 	   stat.rx.jitter.min / 1000.0,
-	   stat.rx.jitter.avg / 1000.0,
+	   stat.rx.jitter.mean / 1000.0,
 	   stat.rx.jitter.max / 1000.0,
 	   stat.rx.jitter.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.rx.jitter) / 1000.0,
 	   ""
 	   );
 
@@ -811,9 +813,9 @@
     printf(" TX stat last update: %s\n"
 	   "    total %s packets %sB sent (%sB +IP hdr)%s\n"
 	   "    pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n"
-	   "          (msec)    min     avg     max     last\n"
-	   "    loss period: %7.3f %7.3f %7.3f %7.3f%s\n"
-	   "    jitter     : %7.3f %7.3f %7.3f %7.3f%s\n",
+	   "          (msec)    min     avg     max     last    dev\n"
+	   "    loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n"
+	   "    jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n",
 	   last_update,
 	   good_number(packets, stat.tx.pkt),
 	   good_number(bytes, stat.tx.bytes),
@@ -827,23 +829,26 @@
 	   stat.tx.reorder * 100.0 / (stat.tx.pkt + stat.tx.loss),
 	   "",
 	   stat.tx.loss_period.min / 1000.0, 
-	   stat.tx.loss_period.avg / 1000.0, 
+	   stat.tx.loss_period.mean / 1000.0, 
 	   stat.tx.loss_period.max / 1000.0,
 	   stat.tx.loss_period.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.tx.loss_period) / 1000.0,
 	   "",
 	   stat.tx.jitter.min / 1000.0,
-	   stat.tx.jitter.avg / 1000.0,
+	   stat.tx.jitter.mean / 1000.0,
 	   stat.tx.jitter.max / 1000.0,
 	   stat.tx.jitter.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.tx.jitter) / 1000.0,
 	   ""
 	   );
 
 
-    printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f%s\n", 
+    printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 
 	   stat.rtt.min / 1000.0,
-	   stat.rtt.avg / 1000.0,
+	   stat.rtt.mean / 1000.0,
 	   stat.rtt.max / 1000.0,
 	   stat.rtt.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.rtt) / 1000.0,
 	   ""
 	   );
 
@@ -885,8 +890,9 @@
 			    port->info.clock_rate);
 	    SAMPLES_TO_USEC(jmean, xr_stat.rx.stat_sum.jitter.mean, 
 			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jdev, xr_stat.rx.stat_sum.jitter.dev, 
-			    port->info.clock_rate);
+	    SAMPLES_TO_USEC(jdev, 
+			   pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.jitter),
+			   port->info.clock_rate);
 	    sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 
 		    jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0);
 	} else
@@ -897,7 +903,7 @@
 		    xr_stat.rx.stat_sum.toh.min,
 		    xr_stat.rx.stat_sum.toh.mean,
 		    xr_stat.rx.stat_sum.toh.max,
-		    xr_stat.rx.stat_sum.toh.dev);
+		    pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh));
 	} else
 	    sprintf(toh, "(report not available)");
 
@@ -947,8 +953,9 @@
 			    port->info.clock_rate);
 	    SAMPLES_TO_USEC(jmean, xr_stat.tx.stat_sum.jitter.mean, 
 			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jdev, xr_stat.tx.stat_sum.jitter.dev, 
-			    port->info.clock_rate);
+	    SAMPLES_TO_USEC(jdev, 
+			   pj_math_stat_get_stddev(&xr_stat.tx.stat_sum.jitter),
+			   port->info.clock_rate);
 	    sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 
 		    jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0);
 	} else
@@ -959,7 +966,7 @@
 		    xr_stat.tx.stat_sum.toh.min,
 		    xr_stat.tx.stat_sum.toh.mean,
 		    xr_stat.tx.stat_sum.toh.max,
-		    xr_stat.tx.stat_sum.toh.dev);
+		    pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh));
 	} else
 	    sprintf(toh,    "(report not available)");
 
@@ -1168,13 +1175,14 @@
 	       );
 
 
-	/* RTT delay, need this? */
-	printf("          (msec)    min     avg     max     last\n");
-	printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f%s\n", 
+	/* RTT delay (by receiver side) */
+	printf("          (msec)    min     avg     max     last    dev\n");
+	printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 
 	       xr_stat.rtt.min / 1000.0,
-	       xr_stat.rtt.avg / 1000.0,
+	       xr_stat.rtt.mean / 1000.0,
 	       xr_stat.rtt.max / 1000.0,
 	       xr_stat.rtt.last / 1000.0,
+	       pj_math_stat_get_stddev(&xr_stat.rtt) / 1000.0,
 	       ""
 	       );
     } while (0);