Changeset 384 for pjproject/trunk/pjsip-apps/src/samples/siprtp.c
- Timestamp:
- Apr 5, 2006 4:56:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/siprtp.c
r383 r384 59 59 unsigned loss_min, loss_avg, loss_max; 60 60 char *loss_type; 61 unsigned jitter_min , jitter_avg, jitter_max;61 unsigned jitter_min_us, jitter_avg_us, jitter_max_us; 62 62 unsigned rtcp_cnt; 63 63 }; … … 254 254 { 255 255 pj_sockaddr_in addr; 256 256 pjsip_host_port addrname; 257 258 pj_memset(&addr, 0, sizeof(addr)); 257 259 addr.sin_family = PJ_AF_INET; 258 260 addr.sin_addr.s_addr = 0; 259 261 addr.sin_port = pj_htons((pj_uint16_t)app.sip_port); 260 262 261 status = pjsip_udp_transport_start( app.sip_endpt, &addr, NULL, 263 if (app.local_addr) { 264 addrname.host = pj_str(app.local_addr); 265 addrname.port = app.sip_port; 266 } 267 268 status = pjsip_udp_transport_start( app.sip_endpt, &addr, 269 (app.local_addr ? &addrname:NULL), 262 270 1, NULL); 263 if (status != PJ_SUCCESS) 271 if (status != PJ_SUCCESS) { 272 app_perror(THIS_FILE, "Unable to start UDP transport", status); 264 273 return status; 274 } 265 275 } 266 276 … … 365 375 return -1; 366 376 } 367 368 377 369 378 /* RTP port counter */ … … 1124 1133 unsigned jitter; 1125 1134 1126 jitter = pj_ntohl(strm->rem_rtcp.rr.jitter) * 1000 / 1127 strm->clock_rate; 1128 if (jitter < strm->tx_stat.jitter_min) 1129 strm->tx_stat.jitter_min = jitter; 1130 if (jitter > strm->tx_stat.jitter_max) 1131 strm->tx_stat.jitter_max = jitter; 1132 strm->tx_stat.jitter_avg = (strm->tx_stat.jitter_avg * strm->tx_stat.rtcp_cnt + 1133 jitter) / (strm->tx_stat.rtcp_cnt + 1); 1135 jitter = (unsigned)(pj_ntohl(strm->rem_rtcp.rr.jitter) * 1136 1000000.0 / strm->clock_rate); 1137 if (jitter < strm->tx_stat.jitter_min_us) 1138 strm->tx_stat.jitter_min_us = jitter; 1139 if (jitter > strm->tx_stat.jitter_max_us) 1140 strm->tx_stat.jitter_max_us = jitter; 1141 strm->tx_stat.jitter_avg_us = 1142 (strm->tx_stat.jitter_avg_us * strm->tx_stat.rtcp_cnt + 1143 jitter) / (strm->tx_stat.rtcp_cnt + 1); 1134 1144 1135 1145 strm->tx_stat.rtcp_cnt++; … … 1219 1229 unsigned jitter; 1220 1230 1221 jitter = pj_ntohl(rtcp_pkt->rr.jitter) * 1000 / 1222 strm->clock_rate; 1223 if (jitter < strm->rx_stat.jitter_min) 1224 strm->rx_stat.jitter_min = jitter; 1225 if (jitter > strm->rx_stat.jitter_max) 1226 strm->rx_stat.jitter_max = jitter; 1227 strm->rx_stat.jitter_avg = (strm->rx_stat.jitter_avg * strm->rx_stat.rtcp_cnt + 1228 jitter) / (strm->rx_stat.rtcp_cnt + 1); 1231 jitter = (unsigned) (pj_ntohl(rtcp_pkt->rr.jitter) * 1232 1000000.0 / strm->clock_rate); 1233 if (jitter < strm->rx_stat.jitter_min_us) 1234 strm->rx_stat.jitter_min_us = jitter; 1235 if (jitter > strm->rx_stat.jitter_max_us) 1236 strm->rx_stat.jitter_max_us = jitter; 1237 strm->rx_stat.jitter_avg_us = 1238 (strm->rx_stat.jitter_avg_us * strm->rx_stat.rtcp_cnt + 1239 jitter) / (strm->rx_stat.rtcp_cnt + 1); 1229 1240 1230 1241 strm->rx_stat.rtcp_cnt++; … … 1233 1244 next_rtcp.u64 += (freq.u64 * RTCP_INTERVAL); 1234 1245 } 1235 1236 1246 } 1237 1247 … … 1247 1257 pj_pool_t *pool; 1248 1258 struct media_stream *audio; 1249 pjmedia_sdp_session *local_sdp, *remote_sdp;1259 const pjmedia_sdp_session *local_sdp, *remote_sdp; 1250 1260 struct codec *codec_desc = NULL; 1251 1261 unsigned i; … … 1408 1418 PJ_TIME_VAL_SUB(now, call->connect_time); 1409 1419 1410 sprintf(duration, " [duration: %02 d:%02d:%02d.%03d]",1420 sprintf(duration, " [duration: %02ld:%02ld:%02ld.%03ld]", 1411 1421 now.sec / 3600, 1412 1422 (now.sec % 3600) / 60, … … 1444 1454 t = call->response_time; 1445 1455 PJ_TIME_VAL_SUB(t, call->start_time); 1446 sprintf(pdd, "got 1st response in % d ms", PJ_TIME_VAL_MSEC(t));1456 sprintf(pdd, "got 1st response in %ld ms", PJ_TIME_VAL_MSEC(t)); 1447 1457 } else { 1448 1458 pdd[0] = '\0'; … … 1452 1462 t = call->connect_time; 1453 1463 PJ_TIME_VAL_SUB(t, call->start_time); 1454 sprintf(connectdelay, ", connected after: %d ms", PJ_TIME_VAL_MSEC(t)); 1464 sprintf(connectdelay, ", connected after: %ld ms", 1465 PJ_TIME_VAL_MSEC(t)); 1455 1466 } else { 1456 1467 connectdelay[0] = '\0'; … … 1465 1476 } 1466 1477 1467 printf(" Stream #0: audio %.*s@%dHz, %dms/frame, %s bps (%sbps +IP hdr)\n",1468 1469 1470 1471 1472 1473 1478 printf(" Stream #0: audio %.*s@%dHz, %dms/frame, %sB/s (%sB/s +IP hdr)\n", 1479 (int)audio->si.fmt.encoding_name.slen, 1480 audio->si.fmt.encoding_name.ptr, 1481 audio->clock_rate, 1482 audio->samples_per_frame * 1000 / audio->clock_rate, 1483 good_number(bps, audio->bytes_per_frame * audio->clock_rate / audio->samples_per_frame), 1484 good_number(ipbps, (audio->bytes_per_frame+32) * audio->clock_rate / audio->samples_per_frame)); 1474 1485 1475 1486 total_loss = (audio->rtcp.rtcp_pkt.rr.total_lost_2 << 16) + … … 1479 1490 printf(" RX total %s packets %sB received (%sB +IP hdr)%s\n" 1480 1491 " pkt discards=%d (%3.1f%%), loss=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 1481 " loss period min=%d ms, avg=%d ms, max=%dms%s\n"1482 " jitter min=% d ms, avg=%d ms, max=%d ms, current=%dms%s\n",1492 " loss period min=%dms, avg=%dms, max=%dms%s\n" 1493 " jitter min=%5.3fms, avg=%5.3fms, max=%5.3fms, curr=%5.3f ms%s\n", 1483 1494 good_number(packets, audio->rx_stat.pkt), 1484 1495 good_number(bytes, audio->rx_stat.payload), … … 1493 1504 -1, -1, -1, 1494 1505 "", 1495 (audio->rx_stat.rtcp_cnt ? audio->rx_stat.jitter_min : -1),1496 (audio->rx_stat.rtcp_cnt ? audio->rx_stat.jitter_avg : -1),1497 (audio->rx_stat.rtcp_cnt ? audio->rx_stat.jitter_max : -1),1498 (audio->rx_stat.rtcp_cnt ? pj_ntohl(audio->rtcp.rtcp_pkt.rr.jitter)*1000/audio->clock_rate : -1),1506 (audio->rx_stat.rtcp_cnt? audio->rx_stat.jitter_min_us/1000.0 : -1.), 1507 (audio->rx_stat.rtcp_cnt? audio->rx_stat.jitter_avg_us/1000.0 : -1.), 1508 (audio->rx_stat.rtcp_cnt? audio->rx_stat.jitter_max_us/1000.0 : -1.), 1509 (audio->rx_stat.rtcp_cnt? pj_ntohl(audio->rtcp.rtcp_pkt.rr.jitter)*1000.0/audio->clock_rate : -1.), 1499 1510 "" 1500 1511 ); … … 1507 1518 printf(" TX total %s packets %sB sent (%sB +IP hdr)%s\n" 1508 1519 " pkt discards=%d (%3.1f%%), loss=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 1509 " loss period min=%d ms, avg=%d ms, max=%dms%s\n"1510 " jitter min=% d ms, avg=%d ms, max=%d ms, current=%dms%s\n",1520 " loss period min=%dms, avg=%dms, max=%dms%s\n" 1521 " jitter min=%5.3fms, avg=%5.3fms, max=%5.3fms, curr=%5.3f ms%s\n", 1511 1522 good_number(packets, audio->tx_stat.pkt), 1512 1523 good_number(bytes, audio->tx_stat.payload), … … 1521 1532 -1, -1, -1, 1522 1533 "", 1523 (audio->tx_stat.rtcp_cnt ? audio->tx_stat.jitter_min : -1),1524 (audio->tx_stat.rtcp_cnt ? audio->tx_stat.jitter_avg : -1),1525 (audio->tx_stat.rtcp_cnt ? audio->tx_stat.jitter_max : -1),1526 (audio->tx_stat.rtcp_cnt ? pj_ntohl(audio->rem_rtcp.rr.jitter)*1000/audio->clock_rate : -1),1534 (audio->tx_stat.rtcp_cnt? audio->tx_stat.jitter_min_us/1000.0 : -1.), 1535 (audio->tx_stat.rtcp_cnt? audio->tx_stat.jitter_avg_us/1000.0 : -1.), 1536 (audio->tx_stat.rtcp_cnt? audio->tx_stat.jitter_max_us/1000.0 : -1.), 1537 (audio->tx_stat.rtcp_cnt? pj_ntohl(audio->rem_rtcp.rr.jitter)*1000.0/audio->clock_rate : -1.), 1527 1538 "" 1528 1539 ); 1529 1540 1530 printf(" End to end delay: %u ms\n", audio->rtcp.ee_delay); 1541 printf(" End to end delay: %5.3f ms\n", 1542 audio->rtcp.rtt_us / 1000.0); 1531 1543 1532 1544 }
Note: See TracChangeset
for help on using the changeset viewer.