Changeset 437
- Timestamp:
- May 12, 2006 10:20:03 AM (18 years ago)
- Location:
- pjproject/trunk/pjsip-apps
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/build/samples.dsp
r409 r437 119 119 # Begin Source File 120 120 121 SOURCE=..\src\samples\siprtp_report.c 122 # End Source File 123 # Begin Source File 124 121 125 SOURCE=..\src\samples\sndinfo.c 122 126 # End Source File -
pjproject/trunk/pjsip-apps/src/samples/siprtp.c
r430 r437 1361 1361 * USER INTERFACE STUFFS 1362 1362 */ 1363 1364 static const char *good_number(char *buf, pj_int32_t val) 1365 { 1366 if (val < 1000) { 1367 pj_ansi_sprintf(buf, "%d", val); 1368 } else if (val < 1000000) { 1369 pj_ansi_sprintf(buf, "%d.%dK", 1370 val / 1000, 1371 (val % 1000) / 100); 1372 } else { 1373 pj_ansi_sprintf(buf, "%d.%02dM", 1374 val / 1000000, 1375 (val % 1000000) / 10000); 1376 } 1377 1378 return buf; 1379 } 1380 1381 1382 static void print_call(int call_index) 1383 { 1384 struct call *call = &app.call[call_index]; 1385 int len; 1386 pjsip_inv_session *inv = call->inv; 1387 pjsip_dialog *dlg = inv->dlg; 1388 struct media_stream *audio = &call->media[0]; 1389 char userinfo[128]; 1390 char duration[80], last_update[80]; 1391 char bps[16], ipbps[16], packets[16], bytes[16], ipbytes[16]; 1392 pj_time_val now; 1393 1394 pj_gettimeofday(&now); 1395 1396 /* Print duration */ 1397 if (inv->state >= PJSIP_INV_STATE_CONFIRMED) { 1398 1399 PJ_TIME_VAL_SUB(now, call->connect_time); 1400 1401 sprintf(duration, " [duration: %02ld:%02ld:%02ld.%03ld]", 1402 now.sec / 3600, 1403 (now.sec % 3600) / 60, 1404 (now.sec % 60), 1405 now.msec); 1406 1407 } else { 1408 duration[0] = '\0'; 1409 } 1410 1411 1412 1413 /* Call number and state */ 1414 printf("Call #%d: %s%s\n", call_index, pjsip_inv_state_name(inv->state), 1415 duration); 1416 1417 1418 1419 /* Call identification */ 1420 len = pjsip_hdr_print_on(dlg->remote.info, userinfo, sizeof(userinfo)); 1421 if (len < 1) 1422 pj_ansi_strcpy(userinfo, "<--uri too long-->"); 1423 else 1424 userinfo[len] = '\0'; 1425 1426 printf(" %s\n", userinfo); 1427 1428 1429 if (call->inv == NULL || call->inv->state < PJSIP_INV_STATE_CONFIRMED || 1430 call->connect_time.sec == 0) 1431 { 1432 return; 1433 } 1434 1435 1436 /* Signaling quality */ 1437 { 1438 char pdd[64], connectdelay[64]; 1439 pj_time_val t; 1440 1441 if (call->response_time.sec) { 1442 t = call->response_time; 1443 PJ_TIME_VAL_SUB(t, call->start_time); 1444 sprintf(pdd, "got 1st response in %ld ms", PJ_TIME_VAL_MSEC(t)); 1445 } else { 1446 pdd[0] = '\0'; 1447 } 1448 1449 if (call->connect_time.sec) { 1450 t = call->connect_time; 1451 PJ_TIME_VAL_SUB(t, call->start_time); 1452 sprintf(connectdelay, ", connected after: %ld ms", 1453 PJ_TIME_VAL_MSEC(t)); 1454 } else { 1455 connectdelay[0] = '\0'; 1456 } 1457 1458 printf(" Signaling quality: %s%s\n", pdd, connectdelay); 1459 } 1460 1461 1462 printf(" Stream #0: audio %.*s@%dHz, %dms/frame, %sB/s (%sB/s +IP hdr)\n", 1463 (int)audio->si.fmt.encoding_name.slen, 1464 audio->si.fmt.encoding_name.ptr, 1465 audio->clock_rate, 1466 audio->samples_per_frame * 1000 / audio->clock_rate, 1467 good_number(bps, audio->bytes_per_frame * audio->clock_rate / audio->samples_per_frame), 1468 good_number(ipbps, (audio->bytes_per_frame+32) * audio->clock_rate / audio->samples_per_frame)); 1469 1470 if (audio->rtcp.stat.rx.update_cnt == 0) 1471 strcpy(last_update, "never"); 1472 else { 1473 pj_gettimeofday(&now); 1474 PJ_TIME_VAL_SUB(now, audio->rtcp.stat.rx.update); 1475 sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago", 1476 now.sec / 3600, 1477 (now.sec % 3600) / 60, 1478 now.sec % 60, 1479 now.msec); 1480 } 1481 1482 printf(" RX stat last update: %s\n" 1483 " total %s packets %sB received (%sB +IP hdr)%s\n" 1484 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 1485 " (msec) min avg max last\n" 1486 " loss period: %7.3f %7.3f %7.3f %7.3f%s\n" 1487 " jitter : %7.3f %7.3f %7.3f %7.3f%s\n", 1488 last_update, 1489 good_number(packets, audio->rtcp.stat.rx.pkt), 1490 good_number(bytes, audio->rtcp.stat.rx.bytes), 1491 good_number(ipbytes, audio->rtcp.stat.rx.bytes + audio->rtcp.stat.rx.pkt * 32), 1492 "", 1493 audio->rtcp.stat.rx.loss, 1494 audio->rtcp.stat.rx.loss * 100.0 / audio->rtcp.stat.rx.pkt, 1495 audio->rtcp.stat.rx.dup, 1496 audio->rtcp.stat.rx.dup * 100.0 / audio->rtcp.stat.rx.pkt, 1497 audio->rtcp.stat.rx.reorder, 1498 audio->rtcp.stat.rx.reorder * 100.0 / audio->rtcp.stat.rx.pkt, 1499 "", 1500 audio->rtcp.stat.rx.loss_period.min / 1000.0, 1501 audio->rtcp.stat.rx.loss_period.avg / 1000.0, 1502 audio->rtcp.stat.rx.loss_period.max / 1000.0, 1503 audio->rtcp.stat.rx.loss_period.last / 1000.0, 1504 "", 1505 audio->rtcp.stat.rx.jitter.min / 1000.0, 1506 audio->rtcp.stat.rx.jitter.avg / 1000.0, 1507 audio->rtcp.stat.rx.jitter.max / 1000.0, 1508 audio->rtcp.stat.rx.jitter.last / 1000.0, 1509 "" 1510 ); 1511 1512 1513 if (audio->rtcp.stat.tx.update_cnt == 0) 1514 strcpy(last_update, "never"); 1515 else { 1516 pj_gettimeofday(&now); 1517 PJ_TIME_VAL_SUB(now, audio->rtcp.stat.tx.update); 1518 sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago", 1519 now.sec / 3600, 1520 (now.sec % 3600) / 60, 1521 now.sec % 60, 1522 now.msec); 1523 } 1524 1525 printf(" TX stat last update: %s\n" 1526 " total %s packets %sB sent (%sB +IP hdr)%s\n" 1527 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 1528 " (msec) min avg max last\n" 1529 " loss period: %7.3f %7.3f %7.3f %7.3f%s\n" 1530 " jitter : %7.3f %7.3f %7.3f %7.3f%s\n", 1531 last_update, 1532 good_number(packets, audio->rtcp.stat.tx.pkt), 1533 good_number(bytes, audio->rtcp.stat.tx.bytes), 1534 good_number(ipbytes, audio->rtcp.stat.tx.bytes + audio->rtcp.stat.tx.pkt * 32), 1535 "", 1536 audio->rtcp.stat.tx.loss, 1537 audio->rtcp.stat.tx.loss * 100.0 / audio->rtcp.stat.tx.pkt, 1538 audio->rtcp.stat.tx.dup, 1539 audio->rtcp.stat.tx.dup * 100.0 / audio->rtcp.stat.tx.pkt, 1540 audio->rtcp.stat.tx.reorder, 1541 audio->rtcp.stat.tx.reorder * 100.0 / audio->rtcp.stat.tx.pkt, 1542 "", 1543 audio->rtcp.stat.tx.loss_period.min / 1000.0, 1544 audio->rtcp.stat.tx.loss_period.avg / 1000.0, 1545 audio->rtcp.stat.tx.loss_period.max / 1000.0, 1546 audio->rtcp.stat.tx.loss_period.last / 1000.0, 1547 "", 1548 audio->rtcp.stat.tx.jitter.min / 1000.0, 1549 audio->rtcp.stat.tx.jitter.avg / 1000.0, 1550 audio->rtcp.stat.tx.jitter.max / 1000.0, 1551 audio->rtcp.stat.tx.jitter.last / 1000.0, 1552 "" 1553 ); 1554 1555 1556 printf(" RTT delay : %7.3f %7.3f %7.3f %7.3f%s\n", 1557 audio->rtcp.stat.rtt.min / 1000.0, 1558 audio->rtcp.stat.rtt.avg / 1000.0, 1559 audio->rtcp.stat.rtt.max / 1000.0, 1560 audio->rtcp.stat.rtt.last / 1000.0, 1561 "" 1562 ); 1563 1564 } 1363 #include "siprtp_report.c" 1565 1364 1566 1365
Note: See TracChangeset
for help on using the changeset viewer.