Changeset 1961
- Timestamp:
- May 17, 2008 2:54:18 PM (16 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pjlib.h
r1953 r1961 43 43 #include <pj/lock.h> 44 44 #include <pj/log.h> 45 #include <pj/math.h> 45 46 #include <pj/os.h> 46 47 #include <pj/pool.h> -
pjproject/trunk/pjmedia/include/pjmedia/jbuf.h
r1942 r1961 77 77 unsigned max_prefetch; /**< Maximum allowed prefetch, in frms. */ 78 78 unsigned size; /**< Current buffer size, in frames. */ 79 unsigned max_size; /**< Maximum size ever. */ 79 unsigned avg_delay; /**< Average delay, in ms. */ 80 unsigned min_delay; /**< Minimum delay, in ms. */ 81 unsigned max_delay; /**< Maximum delay, in ms. */ 82 unsigned dev_delay; /**< Standard deviation of delay, in ms. */ 80 83 }; 81 84 -
pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
r1942 r1961 28 28 #include <pjmedia/rtcp_xr.h> 29 29 #include <pjmedia/rtp.h> 30 31 30 32 31 PJ_BEGIN_DECL … … 181 180 unsigned dup; /**< Total number of duplicates packets */ 182 181 183 struct { 184 unsigned count; /**< Number of period samples(to calc avg) */ 185 unsigned min; /**< Minimum loss period (in usec) */ 186 unsigned avg; /**< Average loss period (in usec) */ 187 unsigned max; /**< Maximum loss period (in usec) */ 188 unsigned last; /**< Last loss period (in usec) */ 189 } loss_period; /**< Lost period history. */ 182 pj_math_stat loss_period;/**< Loss period statistics (in usec) */ 190 183 191 184 struct { … … 194 187 } loss_type; /**< Types of loss detected. */ 195 188 196 struct { 197 unsigned count; /**< Number of updates. */ 198 unsigned min; /**< Minimum jitter (in usec) */ 199 unsigned avg; /**< Average jitter (in usec) */ 200 unsigned max; /**< Maximum jitter (in usec) */ 201 unsigned last; /**< Last jitter (in usec) */ 202 } jitter; /**< Jitter history. */ 189 pj_math_stat jitter; /**< Jitter statistics (in usec) */ 203 190 }; 204 191 … … 221 208 pjmedia_rtcp_stream_stat rx; /**< Decoder stream statistics. */ 222 209 223 struct { 224 unsigned min; /**< Minimum round-trip delay (in usec) */ 225 unsigned avg; /**< Average round-trip delay (in usec) */ 226 unsigned max; /**< Maximum round-trip delay (in usec) */ 227 unsigned last; /**< Last round-trip delay (in usec) */ 228 } rtt; /**< Round trip delay history. */ 229 230 unsigned rtt_update_cnt; /**< Nb of times rtt is updated. */ 210 pj_math_stat rtt; /**< Round trip delay statistic(in usec)*/ 231 211 }; 232 212 -
pjproject/trunk/pjmedia/include/pjmedia/rtcp_xr.h
r1943 r1961 26 26 27 27 #include <pjmedia/types.h> 28 #include <pj/math.h> 28 29 29 30 … … 247 248 unsigned lost; /**< Number of packets lost */ 248 249 unsigned dup; /**< Number of duplicated packets */ 249 250 struct { 251 unsigned min; /**< Minimum jitter (in usec) */ 252 unsigned max; /**< Maximum jitter (in usec) */ 253 unsigned dev; /**< Jitter deviation (in usec) */ 254 unsigned mean; /**< Average jitter (in usec) */ 255 unsigned count; /**< Update count */ 256 } jitter; /**< Jitter history. */ 257 258 struct { 259 unsigned min; /**< Minimum ToH */ 260 unsigned max; /**< Maximum ToH */ 261 unsigned dev; /**< ToH deviation */ 262 unsigned mean; /**< Average ToH */ 263 unsigned count; /**< Update count */ 264 } toh; /**< TTL of hop limit history. */ 250 pj_math_stat jitter; /**< Jitter statistics (in usec) */ 251 pj_math_stat toh; /**< TTL of hop limit statistics. */ 265 252 } stat_sum; 266 253 … … 301 288 typedef struct pjmedia_rtcp_xr_stat 302 289 { 303 pjmedia_rtcp_xr_stream_stat rx; 304 pjmedia_rtcp_xr_stream_stat tx; 305 306 /* RTT calculated from receiver side */ 307 struct { 308 unsigned min; /**< Minimum round-trip delay (in usec) */ 309 unsigned avg; /**< Average round-trip delay (in usec) */ 310 unsigned max; /**< Maximum round-trip delay (in usec) */ 311 unsigned last; /**< Last round-trip delay (in usec) */ 312 unsigned update_cnt; /**< Nb of times rtt is updated. */ 313 } rtt; /**< Round trip delay history. */ 314 290 pjmedia_rtcp_xr_stream_stat rx; /**< Decoding direction statistics. */ 291 pjmedia_rtcp_xr_stream_stat tx; /**< Encoding direction statistics. */ 292 pj_math_stat rtt; /**< Round-trip delay stat (in usec) 293 the value is calculated from 294 receiver side. */ 315 295 } pjmedia_rtcp_xr_stat; 316 296 -
pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
r1942 r1961 25 25 #include <pj/assert.h> 26 26 #include <pj/log.h> 27 #include <pj/math.h> 27 28 #include <pj/string.h> 28 29 … … 67 68 int jb_max_prefetch; // Maximum allowable prefetch 68 69 int jb_status; // status is 'init' until the first 'put' operation 69 70 int jb_max_size; // Maximum frames buffered ever 70 pj_math_stat jb_delay; // Delay statistics of jitter buffer (in frame unit) 71 71 }; 72 72 … … 74 74 #define JB_STATUS_INITIALIZING 0 75 75 #define JB_STATUS_PROCESSING 1 76 77 #define PJ_ABS(x) ((x > 0) ? (x) : -(x))78 #define PJ_MAX(x, y) ((x > y) ? (x) : (y))79 #define PJ_MIN(x, y) ((x < y) ? (x) : (y))80 81 76 82 77 /* Enabling this would log the jitter buffer state about once per … … 314 309 jb->jb_max_count = max_count; 315 310 311 pj_math_stat_init(&jb->jb_delay); 312 316 313 *p_jb = jb; 317 314 return PJ_SUCCESS; … … 369 366 jb->jb_status = JB_STATUS_INITIALIZING; 370 367 jb->jb_max_hist_level = 0; 371 jb->jb_max_size = 0;372 368 373 369 jb_framelist_remove_head(&jb->jb_framelist, 374 370 jb_framelist_size(&jb->jb_framelist)); 371 372 pj_math_stat_init(&jb->jb_delay); 373 375 374 return PJ_SUCCESS; 376 375 } … … 389 388 /* Update jb_max_size */ 390 389 cur_size = jb_framelist_size(&jb->jb_framelist); 391 if (cur_size > jb->jb_max_size)392 jb->jb_max_size = cur_size;393 390 394 391 /* Only apply burst-level calculation on PUT operation since if VAD is … … 457 454 jb_framelist_remove_head(&jb->jb_framelist, diff); 458 455 456 pj_math_stat_update(&jb->jb_delay, cur_size - diff); 457 459 458 TRACE__((jb->name.ptr, 460 459 "JB shrinking %d frame(s), size=%d", diff, 461 460 jb_framelist_size(&jb->jb_framelist))); 461 } else { 462 pj_math_stat_update(&jb->jb_delay, cur_size); 462 463 } 463 464 … … 612 613 state->max_prefetch = jb->jb_max_prefetch; 613 614 state->size = jb_framelist_size(&jb->jb_framelist); 614 state->max_size = jb->jb_max_size; 615 state->avg_delay = jb->jb_delay.mean * jb->jb_frame_ptime; 616 state->min_delay = jb->jb_delay.min * jb->jb_frame_ptime; 617 state->max_delay = jb->jb_delay.max * jb->jb_frame_ptime; 618 state->dev_delay = pj_math_stat_get_stddev(&jb->jb_delay) * 619 jb->jb_frame_ptime; 615 620 616 621 return PJ_SUCCESS; 617 622 } 618 -
pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
r1942 r1961 167 167 pj_get_timestamp_freq(&sess->ts_freq); 168 168 169 /* Initialize statistics states */ 170 pj_math_stat_init(&sess->stat.rtt); 171 pj_math_stat_init(&sess->stat.rx.loss_period); 172 pj_math_stat_init(&sess->stat.rx.jitter); 173 pj_math_stat_init(&sess->stat.tx.loss_period); 174 pj_math_stat_init(&sess->stat.tx.jitter); 175 169 176 /* RR will be initialized on receipt of the first RTP packet. */ 170 177 } … … 275 282 276 283 /* Update loss period stat */ 277 if (sess->stat.rx.loss_period.count == 0 || 278 period < sess->stat.rx.loss_period.min) 279 { 280 sess->stat.rx.loss_period.min = period; 281 } 282 if (period > sess->stat.rx.loss_period.max) 283 sess->stat.rx.loss_period.max = period; 284 sess->stat.rx.loss_period.avg = 285 (sess->stat.rx.loss_period.avg * sess->stat.rx.loss_period.count + 286 period) / (sess->stat.rx.loss_period.count + 1); 287 sess->stat.rx.loss_period.last = period; 288 ++sess->stat.rx.loss_period.count; 284 pj_math_stat_update(&sess->stat.rx.loss_period, period); 289 285 } 290 286 … … 330 326 } 331 327 332 /* Add to average */333 sess->avg_jitter =334 (jitter + sess->avg_jitter * sess->stat.rx.jitter.count) /335 (sess->stat.rx.jitter.count + 1);336 sess->stat.rx.jitter.avg = (unsigned)sess->avg_jitter;337 ++sess->stat.rx.jitter.count;338 339 328 /* Update jitter stat */ 340 if (jitter < sess->stat.rx.jitter.min) 341 sess->stat.rx.jitter.min = jitter; 342 if (jitter > sess->stat.rx.jitter.max) 343 sess->stat.rx.jitter.max = jitter; 344 345 sess->stat.rx.jitter.last = jitter; 329 pj_math_stat_update(&sess->stat.rx.jitter, jitter); 346 330 347 331 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) … … 464 448 period *= 1000; 465 449 466 if (sess->stat.tx.update_cnt==0||sess->stat.tx.loss_period.min==0) 467 sess->stat.tx.loss_period.min = period; 468 if (period < sess->stat.tx.loss_period.min) 469 sess->stat.tx.loss_period.min = period; 470 if (period > sess->stat.tx.loss_period.max) 471 sess->stat.tx.loss_period.max = period; 472 473 sess->stat.tx.loss_period.avg = 474 (sess->stat.tx.loss_period.avg*sess->stat.tx.update_cnt+period) 475 / (sess->stat.tx.update_cnt + 1); 476 sess->stat.tx.loss_period.last = period; 450 /* Update loss period stat */ 451 pj_math_stat_update(&sess->stat.tx.loss_period, period); 477 452 } 478 453 … … 488 463 489 464 /* Update jitter statistics */ 490 if (sess->stat.tx.jitter.count == 0) 491 sess->stat.tx.jitter.min = jitter; 492 if (jitter < sess->stat.tx.jitter.min && jitter) 493 sess->stat.tx.jitter.min = jitter; 494 if (jitter > sess->stat.tx.jitter.max) 495 sess->stat.tx.jitter.max = jitter; 496 sess->stat.tx.jitter.avg = 497 (sess->stat.tx.jitter.avg * sess->stat.tx.jitter.count + jitter) / 498 (sess->stat.tx.jitter.count + 1); 499 ++sess->stat.tx.jitter.count; 500 sess->stat.tx.jitter.last = jitter; 501 465 pj_math_stat_update(&sess->stat.tx.jitter, jitter); 502 466 503 467 /* Can only calculate if LSR and DLSR is present in RR */ … … 553 517 } 554 518 555 if (sess->stat.rtt_update_cnt == 0)556 sess->stat.rtt.min = rtt;557 558 519 /* "Normalize" rtt value that is exceptionally high. 559 520 * For such values, "normalize" the rtt to be three times 560 521 * the average value. 561 522 */ 562 if (rtt > (sess->stat.rtt.avg*3) && sess->stat.rtt_update_cnt!=0) { 523 if (rtt > ((unsigned)sess->stat.rtt.mean*3) && sess->stat.rtt.n!=0) 524 { 563 525 unsigned orig_rtt = rtt; 564 rtt = sess->stat.rtt. avg*3;526 rtt = sess->stat.rtt.mean*3; 565 527 PJ_LOG(5,(sess->name, 566 528 "RTT value %d usec is normalized to %d usec", … … 570 532 TRACE_((sess->name, "RTCP RTT is set to %d usec", rtt)); 571 533 572 if (rtt < sess->stat.rtt.min && rtt) 573 sess->stat.rtt.min = rtt; 574 if (rtt > sess->stat.rtt.max) 575 sess->stat.rtt.max = rtt; 576 577 sess->stat.rtt.avg = 578 (sess->stat.rtt.avg * sess->stat.rtt_update_cnt + rtt) / 579 (sess->stat.rtt_update_cnt + 1); 580 581 sess->stat.rtt.last = rtt; 582 sess->stat.rtt_update_cnt++; 534 /* Update RTT stat */ 535 pj_math_stat_update(&sess->stat.rtt, rtt); 583 536 584 537 } else { -
pjproject/trunk/pjmedia/src/pjmedia/rtcp_xr.c
r1945 r1961 27 27 #include <pj/string.h> 28 28 29 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)29 #if 1 //defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) 30 30 31 31 #define THIS_FILE "rtcp_xr.c" … … 58 58 # define TRACE_(x) ; 59 59 #endif 60 61 /* Integer square root for calculating standard deviation */62 static pj_uint32_t my_isqrt(pj_uint32_t i)63 {64 pj_uint32_t res = 1, prev;65 66 /* Rough guess */67 prev = i >> 2;68 while (prev) {69 prev >>= 2;70 res <<= 1;71 }72 73 /* Babilonian method */74 do {75 prev = res;76 res = (prev + i/prev) >> 1;77 } while ((prev+res)>>1 != res);78 79 return res;80 }81 60 82 61 void pjmedia_rtcp_xr_init( pjmedia_rtcp_xr_session *session, … … 231 210 r->jitter_min = pj_htonl(sess->stat.rx.stat_sum.jitter.min); 232 211 r->jitter_max = pj_htonl(sess->stat.rx.stat_sum.jitter.max); 233 r->jitter_mean = pj_htonl(sess->stat.rx.stat_sum.jitter.mean);234 sess->stat.rx.stat_sum.jitter.dev =235 my_isqrt(sess->stat.rx.stat_sum.jitter.dev);236 r->jitter_dev = pj_htonl(sess->stat.rx.stat_sum.jitter.dev);212 r->jitter_mean = 213 pj_htonl((unsigned)sess->stat.rx.stat_sum.jitter.mean); 214 r->jitter_dev = 215 pj_htonl(pj_math_stat_get_stddev(&sess->stat.rx.stat_sum.jitter)); 237 216 } 238 217 if (sess->stat.rx.stat_sum.t) { 239 218 r->toh_min = sess->stat.rx.stat_sum.toh.min; 240 219 r->toh_max = sess->stat.rx.stat_sum.toh.max; 241 r->toh_mean = sess->stat.rx.stat_sum.toh.mean; 242 sess->stat.rx.stat_sum.toh.dev = 243 my_isqrt(sess->stat.rx.stat_sum.toh.dev); 244 r->toh_dev = sess->stat.rx.stat_sum.toh.dev; 220 r->toh_mean = (unsigned) sess->stat.rx.stat_sum.toh.mean; 221 r->toh_dev = pj_math_stat_get_stddev(&sess->stat.rx.stat_sum.toh); 245 222 } 246 223 … … 293 270 294 271 /* Calculate burst and densities. */ 295 if (c total) {272 if (c11 && (c23 || c33)) { 296 273 p32 = c32 / (c31 + c32 + c33); 297 274 if((c22 + c23) < 1) { … … 518 495 */ 519 496 if (eedelay <= 30 * 1000 * 1000UL) { 520 if (sess->stat.rtt.update_cnt == 0)521 sess->stat.rtt.min = rtt;522 523 497 /* "Normalize" rtt value that is exceptionally high. 524 498 * For such values, "normalize" the rtt to be three times 525 499 * the average value. 526 500 */ 527 if (rtt>( sess->stat.rtt.avg*3) && sess->stat.rtt.update_cnt!=0)501 if (rtt>((unsigned)sess->stat.rtt.mean*3) && sess->stat.rtt.n!=0) 528 502 { 529 503 unsigned orig_rtt = rtt; 530 rtt = sess->stat.rtt.avg*3;504 rtt = (unsigned)sess->stat.rtt.mean*3; 531 505 PJ_LOG(5,(sess->name, 532 506 "RTT value %d usec is normalized to %d usec", … … 535 509 536 510 TRACE_((sess->name, "RTCP RTT is set to %d usec", rtt)); 537 538 if (rtt < sess->stat.rtt.min && rtt) 539 sess->stat.rtt.min = rtt; 540 if (rtt > sess->stat.rtt.max) 541 sess->stat.rtt.max = rtt; 542 543 sess->stat.rtt.avg = 544 (sess->stat.rtt.avg * sess->stat.rtt.update_cnt + rtt) / 545 (sess->stat.rtt.update_cnt + 1); 546 547 sess->stat.rtt.last = rtt; 548 sess->stat.rtt.update_cnt++; 511 pj_math_stat_update(&sess->stat.rtt, rtt); 549 512 } 550 513 } else { … … 586 549 sess->stat.tx.stat_sum.jitter.min = pj_ntohl(rb_stats->jitter_min); 587 550 sess->stat.tx.stat_sum.jitter.max = pj_ntohl(rb_stats->jitter_max); 588 sess->stat.tx.stat_sum.jitter.mean = pj_ntohl(rb_stats->jitter_mean); 589 sess->stat.tx.stat_sum.jitter.dev = pj_ntohl(rb_stats->jitter_dev); 551 sess->stat.tx.stat_sum.jitter.mean= pj_ntohl(rb_stats->jitter_mean); 552 pj_math_stat_set_stddev(&sess->stat.tx.stat_sum.jitter, 553 pj_ntohl(rb_stats->jitter_dev)); 590 554 } 591 555 … … 593 557 sess->stat.tx.stat_sum.toh.min = rb_stats->toh_min; 594 558 sess->stat.tx.stat_sum.toh.max = rb_stats->toh_max; 595 sess->stat.tx.stat_sum.toh.mean = rb_stats->toh_mean; 596 sess->stat.tx.stat_sum.toh.dev = rb_stats->toh_dev; 559 sess->stat.tx.stat_sum.toh.mean= rb_stats->toh_mean; 560 pj_math_stat_set_stddev(&sess->stat.tx.stat_sum.toh, 561 pj_ntohl(rb_stats->toh_dev)); 597 562 } 598 563 … … 728 693 729 694 if (jitter >= 0) { 730 pj_int32_t diff;731 732 695 sess->stat.rx.stat_sum.j = PJ_TRUE; 733 if (sess->stat.rx.stat_sum.jitter.min > (pj_uint32_t)jitter) 734 sess->stat.rx.stat_sum.jitter.min = jitter; 735 if (sess->stat.rx.stat_sum.jitter.max < (pj_uint32_t)jitter) 736 sess->stat.rx.stat_sum.jitter.max = jitter; 737 sess->stat.rx.stat_sum.jitter.mean = 738 (jitter + sess->stat.rx.stat_sum.jitter.mean * 739 sess->stat.rx.stat_sum.jitter.count) / 740 (sess->stat.rx.stat_sum.jitter.count + 1); 741 742 diff = sess->stat.rx.stat_sum.jitter.mean - jitter; 743 sess->stat.rx.stat_sum.jitter.dev = 744 (diff * diff + sess->stat.rx.stat_sum.jitter.dev * 745 sess->stat.rx.stat_sum.jitter.count) / 746 (sess->stat.rx.stat_sum.jitter.count + 1); 747 748 ++sess->stat.rx.stat_sum.jitter.count; 696 pj_math_stat_update(&sess->stat.rx.stat_sum.jitter, jitter); 749 697 } 750 698 751 699 if (toh >= 0) { 752 pj_int32_t diff;753 754 700 sess->stat.rx.stat_sum.t = toh_ipv4? 1 : 2; 755 756 if (sess->stat.rx.stat_sum.toh.min > (pj_uint32_t)toh) 757 sess->stat.rx.stat_sum.toh.min = toh; 758 if (sess->stat.rx.stat_sum.toh.max < (pj_uint32_t)toh) 759 sess->stat.rx.stat_sum.toh.max = toh; 760 sess->stat.rx.stat_sum.toh.mean = 761 (toh + sess->stat.rx.stat_sum.toh.mean * 762 sess->stat.rx.stat_sum.toh.count) / 763 (sess->stat.rx.stat_sum.toh.count + 1); 764 765 diff = sess->stat.rx.stat_sum.toh.mean - toh; 766 sess->stat.rx.stat_sum.toh.dev = 767 (diff * diff + sess->stat.rx.stat_sum.toh.dev * 768 sess->stat.rx.stat_sum.toh.count) / 769 (sess->stat.rx.stat_sum.toh.count + 1); 770 771 ++sess->stat.rx.stat_sum.toh.count; 701 pj_math_stat_update(&sess->stat.rx.stat_sum.toh, toh); 772 702 } 773 703 -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r1945 r1961 501 501 pjmedia_jbuf_get_state(stream->jb, &jb_state); 502 502 503 i = jb_state. size * stream->codec_param.info.frm_ptime;503 i = jb_state.avg_delay; 504 504 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session, 505 505 PJMEDIA_RTCP_XR_INFO_JB_NOM, 506 506 i); 507 507 508 i = jb_state.max_ size* stream->codec_param.info.frm_ptime;508 i = jb_state.max_delay; 509 509 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session, 510 510 PJMEDIA_RTCP_XR_INFO_JB_MAX, … … 1674 1674 pjmedia_jbuf_get_state(stream->jb, &jb_state); 1675 1675 1676 i = jb_state. size * stream->codec_param.info.frm_ptime;1676 i = jb_state.avg_delay; 1677 1677 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session, 1678 1678 PJMEDIA_RTCP_XR_INFO_JB_NOM, 1679 1679 i); 1680 1680 1681 i = jb_state.max_ size* stream->codec_param.info.frm_ptime;1681 i = jb_state.max_delay; 1682 1682 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session, 1683 1683 PJMEDIA_RTCP_XR_INFO_JB_MAX, -
pjproject/trunk/pjsip-apps/src/samples/siprtp.c
r1873 r1961 1660 1660 MIN_(min_stat.rx.jitter.min, audio->rtcp.stat.rx.jitter.min); 1661 1661 MAX_(max_stat.rx.jitter.max, audio->rtcp.stat.rx.jitter.max); 1662 AVG_(avg_stat.rx.jitter. avg, audio->rtcp.stat.rx.jitter.avg);1662 AVG_(avg_stat.rx.jitter.mean, audio->rtcp.stat.rx.jitter.mean); 1663 1663 1664 1664 … … 1693 1693 MIN_(min_stat.tx.jitter.min, audio->rtcp.stat.tx.jitter.min); 1694 1694 MAX_(max_stat.tx.jitter.max, audio->rtcp.stat.tx.jitter.max); 1695 AVG_(avg_stat.tx.jitter. avg, audio->rtcp.stat.tx.jitter.avg);1695 AVG_(avg_stat.tx.jitter.mean, audio->rtcp.stat.tx.jitter.mean); 1696 1696 1697 1697 … … 1699 1699 MIN_(min_stat.rtt.min, audio->rtcp.stat.rtt.min); 1700 1700 MAX_(max_stat.rtt.max, audio->rtcp.stat.rtt.max); 1701 AVG_(avg_stat.rtt. avg, audio->rtcp.stat.rtt.avg);1701 AVG_(avg_stat.rtt.mean, audio->rtcp.stat.rtt.mean); 1702 1702 1703 1703 ++count; … … 1768 1768 1769 1769 min_stat.rx.jitter.min/1000.0, 1770 avg_stat.rx.jitter. avg/1000.0,1770 avg_stat.rx.jitter.mean/1000.0, 1771 1771 max_stat.rx.jitter.max/1000.0, 1772 1772 "ms", … … 1799 1799 1800 1800 min_stat.tx.jitter.min/1000.0, 1801 avg_stat.tx.jitter. avg/1000.0,1801 avg_stat.tx.jitter.mean/1000.0, 1802 1802 max_stat.tx.jitter.max/1000.0, 1803 1803 "ms", … … 1805 1805 /* rtt */ 1806 1806 min_stat.rtt.min/1000.0, 1807 avg_stat.rtt. avg/1000.0,1807 avg_stat.rtt.mean/1000.0, 1808 1808 max_stat.rtt.max/1000.0, 1809 1809 "ms" -
pjproject/trunk/pjsip-apps/src/samples/siprtp_report.c
r974 r1961 161 161 "", 162 162 audio->rtcp.stat.rx.loss_period.min / 1000.0, 163 audio->rtcp.stat.rx.loss_period. avg/ 1000.0,163 audio->rtcp.stat.rx.loss_period.mean / 1000.0, 164 164 audio->rtcp.stat.rx.loss_period.max / 1000.0, 165 165 audio->rtcp.stat.rx.loss_period.last / 1000.0, 166 166 "", 167 167 audio->rtcp.stat.rx.jitter.min / 1000.0, 168 audio->rtcp.stat.rx.jitter. avg/ 1000.0,168 audio->rtcp.stat.rx.jitter.mean / 1000.0, 169 169 audio->rtcp.stat.rx.jitter.max / 1000.0, 170 170 audio->rtcp.stat.rx.jitter.last / 1000.0, … … 205 205 "", 206 206 audio->rtcp.stat.tx.loss_period.min / 1000.0, 207 audio->rtcp.stat.tx.loss_period. avg/ 1000.0,207 audio->rtcp.stat.tx.loss_period.mean / 1000.0, 208 208 audio->rtcp.stat.tx.loss_period.max / 1000.0, 209 209 audio->rtcp.stat.tx.loss_period.last / 1000.0, 210 210 "", 211 211 audio->rtcp.stat.tx.jitter.min / 1000.0, 212 audio->rtcp.stat.tx.jitter. avg/ 1000.0,212 audio->rtcp.stat.tx.jitter.mean / 1000.0, 213 213 audio->rtcp.stat.tx.jitter.max / 1000.0, 214 214 audio->rtcp.stat.tx.jitter.last / 1000.0, … … 220 220 " RTT delay : %7.3f %7.3f %7.3f %7.3f%s\n", 221 221 audio->rtcp.stat.rtt.min / 1000.0, 222 audio->rtcp.stat.rtt. avg/ 1000.0,222 audio->rtcp.stat.rtt.mean / 1000.0, 223 223 audio->rtcp.stat.rtt.max / 1000.0, 224 224 audio->rtcp.stat.rtt.last / 1000.0, -
pjproject/trunk/pjsip-apps/src/samples/streamutil.c
r1943 r1961 769 769 " total %s packets %sB received (%sB +IP hdr)%s\n" 770 770 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 771 " (msec) min avg max last \n"772 " loss period: %7.3f %7.3f %7.3f %7.3f %s\n"773 " jitter : %7.3f %7.3f %7.3f %7.3f %s\n",771 " (msec) min avg max last dev\n" 772 " loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n" 773 " jitter : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 774 774 last_update, 775 775 good_number(packets, stat.rx.pkt), … … 785 785 "", 786 786 stat.rx.loss_period.min / 1000.0, 787 stat.rx.loss_period. avg/ 1000.0,787 stat.rx.loss_period.mean / 1000.0, 788 788 stat.rx.loss_period.max / 1000.0, 789 789 stat.rx.loss_period.last / 1000.0, 790 pj_math_stat_get_stddev(&stat.rx.loss_period) / 1000.0, 790 791 "", 791 792 stat.rx.jitter.min / 1000.0, 792 stat.rx.jitter. avg/ 1000.0,793 stat.rx.jitter.mean / 1000.0, 793 794 stat.rx.jitter.max / 1000.0, 794 795 stat.rx.jitter.last / 1000.0, 796 pj_math_stat_get_stddev(&stat.rx.jitter) / 1000.0, 795 797 "" 796 798 ); … … 812 814 " total %s packets %sB sent (%sB +IP hdr)%s\n" 813 815 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 814 " (msec) min avg max last \n"815 " loss period: %7.3f %7.3f %7.3f %7.3f %s\n"816 " jitter : %7.3f %7.3f %7.3f %7.3f %s\n",816 " (msec) min avg max last dev\n" 817 " loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n" 818 " jitter : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 817 819 last_update, 818 820 good_number(packets, stat.tx.pkt), … … 828 830 "", 829 831 stat.tx.loss_period.min / 1000.0, 830 stat.tx.loss_period. avg/ 1000.0,832 stat.tx.loss_period.mean / 1000.0, 831 833 stat.tx.loss_period.max / 1000.0, 832 834 stat.tx.loss_period.last / 1000.0, 835 pj_math_stat_get_stddev(&stat.tx.loss_period) / 1000.0, 833 836 "", 834 837 stat.tx.jitter.min / 1000.0, 835 stat.tx.jitter. avg/ 1000.0,838 stat.tx.jitter.mean / 1000.0, 836 839 stat.tx.jitter.max / 1000.0, 837 840 stat.tx.jitter.last / 1000.0, 841 pj_math_stat_get_stddev(&stat.tx.jitter) / 1000.0, 838 842 "" 839 843 ); 840 844 841 845 842 printf(" RTT delay : %7.3f %7.3f %7.3f %7.3f %s\n",846 printf(" RTT delay : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 843 847 stat.rtt.min / 1000.0, 844 stat.rtt. avg/ 1000.0,848 stat.rtt.mean / 1000.0, 845 849 stat.rtt.max / 1000.0, 846 850 stat.rtt.last / 1000.0, 851 pj_math_stat_get_stddev(&stat.rtt) / 1000.0, 847 852 "" 848 853 ); … … 886 891 SAMPLES_TO_USEC(jmean, xr_stat.rx.stat_sum.jitter.mean, 887 892 port->info.clock_rate); 888 SAMPLES_TO_USEC(jdev, xr_stat.rx.stat_sum.jitter.dev, 889 port->info.clock_rate); 893 SAMPLES_TO_USEC(jdev, 894 pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.jitter), 895 port->info.clock_rate); 890 896 sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 891 897 jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0); … … 898 904 xr_stat.rx.stat_sum.toh.mean, 899 905 xr_stat.rx.stat_sum.toh.max, 900 xr_stat.rx.stat_sum.toh.dev);906 pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh)); 901 907 } else 902 908 sprintf(toh, "(report not available)"); … … 948 954 SAMPLES_TO_USEC(jmean, xr_stat.tx.stat_sum.jitter.mean, 949 955 port->info.clock_rate); 950 SAMPLES_TO_USEC(jdev, xr_stat.tx.stat_sum.jitter.dev, 951 port->info.clock_rate); 956 SAMPLES_TO_USEC(jdev, 957 pj_math_stat_get_stddev(&xr_stat.tx.stat_sum.jitter), 958 port->info.clock_rate); 952 959 sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 953 960 jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0); … … 960 967 xr_stat.tx.stat_sum.toh.mean, 961 968 xr_stat.tx.stat_sum.toh.max, 962 xr_stat.tx.stat_sum.toh.dev);969 pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh)); 963 970 } else 964 971 sprintf(toh, "(report not available)"); … … 1169 1176 1170 1177 1171 /* RTT delay , need this?*/1172 printf(" (msec) min avg max last \n");1173 printf(" RTT delay : %7.3f %7.3f %7.3f %7.3f %s\n",1178 /* RTT delay (by receiver side) */ 1179 printf(" (msec) min avg max last dev\n"); 1180 printf(" RTT delay : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 1174 1181 xr_stat.rtt.min / 1000.0, 1175 xr_stat.rtt. avg/ 1000.0,1182 xr_stat.rtt.mean / 1000.0, 1176 1183 xr_stat.rtt.max / 1000.0, 1177 1184 xr_stat.rtt.last / 1000.0, 1185 pj_math_stat_get_stddev(&xr_stat.rtt) / 1000.0, 1178 1186 "" 1179 1187 ); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r1931 r1961 2059 2059 "%s total %spkt %sB (%sB +IP hdr) @avg=%sbps/%sbps\n" 2060 2060 "%s pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)\n" 2061 "%s (msec) min avg max last \n"2062 "%s loss period: %7.3f %7.3f %7.3f %7.3f \n"2063 "%s jitter : %7.3f %7.3f %7.3f %7.3f %s",2061 "%s (msec) min avg max last dev\n" 2062 "%s loss period: %7.3f %7.3f %7.3f %7.3f %7.3f\n" 2063 "%s jitter : %7.3f %7.3f %7.3f %7.3f %7.3f%s", 2064 2064 indent, info.stream_info[i].fmt.pt, 2065 2065 last_update, … … 2079 2079 indent, indent, 2080 2080 stat.rx.loss_period.min / 1000.0, 2081 stat.rx.loss_period. avg/ 1000.0,2081 stat.rx.loss_period.mean / 1000.0, 2082 2082 stat.rx.loss_period.max / 1000.0, 2083 2083 stat.rx.loss_period.last / 1000.0, 2084 pj_math_stat_get_stddev(&stat.rx.loss_period) / 1000.0, 2084 2085 indent, 2085 2086 stat.rx.jitter.min / 1000.0, 2086 stat.rx.jitter. avg/ 1000.0,2087 stat.rx.jitter.mean / 1000.0, 2087 2088 stat.rx.jitter.max / 1000.0, 2088 2089 stat.rx.jitter.last / 1000.0, 2090 pj_math_stat_get_stddev(&stat.rx.jitter) / 1000.0, 2089 2091 "" 2090 2092 ); … … 2115 2117 "%s total %spkt %sB (%sB +IP hdr) @avg %sbps/%sbps\n" 2116 2118 "%s pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)\n" 2117 "%s (msec) min avg max last \n"2118 "%s loss period: %7.3f %7.3f %7.3f %7.3f \n"2119 "%s jitter : %7.3f %7.3f %7.3f %7.3f %s",2119 "%s (msec) min avg max last dev \n" 2120 "%s loss period: %7.3f %7.3f %7.3f %7.3f %7.3f\n" 2121 "%s jitter : %7.3f %7.3f %7.3f %7.3f %7.3f%s", 2120 2122 indent, 2121 2123 info.stream_info[i].tx_pt, … … 2141 2143 indent, indent, 2142 2144 stat.tx.loss_period.min / 1000.0, 2143 stat.tx.loss_period. avg/ 1000.0,2145 stat.tx.loss_period.mean / 1000.0, 2144 2146 stat.tx.loss_period.max / 1000.0, 2145 2147 stat.tx.loss_period.last / 1000.0, 2148 pj_math_stat_get_stddev(&stat.tx.loss_period) / 1000.0, 2146 2149 indent, 2147 2150 stat.tx.jitter.min / 1000.0, 2148 stat.tx.jitter. avg/ 1000.0,2151 stat.tx.jitter.mean / 1000.0, 2149 2152 stat.tx.jitter.max / 1000.0, 2150 2153 stat.tx.jitter.last / 1000.0, 2154 pj_math_stat_get_stddev(&stat.tx.jitter) / 1000.0, 2151 2155 "" 2152 2156 ); … … 2162 2166 2163 2167 len = pj_ansi_snprintf(p, end-p, 2164 "%s RTT msec : %7.3f %7.3f %7.3f %7.3f ",2168 "%s RTT msec : %7.3f %7.3f %7.3f %7.3f %7.3f", 2165 2169 indent, 2166 2170 stat.rtt.min / 1000.0, 2167 stat.rtt. avg/ 1000.0,2171 stat.rtt.mean / 1000.0, 2168 2172 stat.rtt.max / 1000.0, 2169 stat.rtt.last / 1000.0 2173 stat.rtt.last / 1000.0, 2174 pj_math_stat_get_stddev(&stat.rtt) / 1000.0 2170 2175 ); 2171 2176 if (len < 1 || len > end-p) {
Note: See TracChangeset
for help on using the changeset viewer.