Changeset 621 for pjproject/trunk/pjsip-apps/src/samples/siprtp_report.c
- Timestamp:
- Jul 22, 2006 12:53:04 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/siprtp_report.c
r568 r621 26 26 * functionality (such as writing to XML file). 27 27 */ 28 29 static const char *good_number(char *buf, pj_int32_t val)30 {31 if (val < 1000) {32 pj_ansi_sprintf(buf, "%d", val);33 } else if (val < 1000000) {34 pj_ansi_sprintf(buf, "%d.%dK",35 val / 1000,36 (val % 1000) / 100);37 } else {38 pj_ansi_sprintf(buf, "%d.%02dM",39 val / 1000000,40 (val % 1000000) / 10000);41 }42 43 return buf;44 }45 28 46 29 … … 55 38 char duration[80], last_update[80]; 56 39 char bps[16], ipbps[16], packets[16], bytes[16], ipbytes[16]; 40 unsigned decor; 57 41 pj_time_val now; 42 43 44 decor = pj_log_get_decor(); 45 pj_log_set_decor(PJ_LOG_HAS_NEWLINE); 58 46 59 47 pj_gettimeofday(&now); … … 80 68 81 69 /* Call number and state */ 82 printf("Call #%d: %s%s\n", call_index, pjsip_inv_state_name(inv->state), 83 duration); 70 PJ_LOG(3, (THIS_FILE, 71 "Call #%d: %s%s", 72 call_index, pjsip_inv_state_name(inv->state), 73 duration)); 84 74 85 75 … … 92 82 userinfo[len] = '\0'; 93 83 94 printf(" %s\n", userinfo);84 PJ_LOG(3, (THIS_FILE, " %s", userinfo)); 95 85 96 86 … … 98 88 call->connect_time.sec == 0) 99 89 { 90 pj_log_set_decor(decor); 100 91 return; 101 92 } … … 124 115 } 125 116 126 printf(" Signaling quality: %s%s\n", pdd, connectdelay); 127 } 128 129 130 printf(" Stream #0: audio %.*s@%dHz, %dms/frame, %sB/s (%sB/s +IP hdr)\n", 117 PJ_LOG(3, (THIS_FILE, 118 " Signaling quality: %s%s", pdd, connectdelay)); 119 } 120 121 122 PJ_LOG(3, (THIS_FILE, 123 " Stream #0: audio %.*s@%dHz, %dms/frame, %sB/s (%sB/s +IP hdr)", 131 124 (int)audio->si.fmt.encoding_name.slen, 132 125 audio->si.fmt.encoding_name.ptr, … … 134 127 audio->samples_per_frame * 1000 / audio->clock_rate, 135 128 good_number(bps, audio->bytes_per_frame * audio->clock_rate / audio->samples_per_frame), 136 good_number(ipbps, (audio->bytes_per_frame+32) * audio->clock_rate / audio->samples_per_frame)) ;129 good_number(ipbps, (audio->bytes_per_frame+32) * audio->clock_rate / audio->samples_per_frame))); 137 130 138 131 if (audio->rtcp.stat.rx.update_cnt == 0) … … 148 141 } 149 142 150 printf(" RX stat last update: %s\n" 143 PJ_LOG(3, (THIS_FILE, 144 " RX stat last update: %s\n" 151 145 " total %s packets %sB received (%sB +IP hdr)%s\n" 152 146 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 153 147 " (msec) min avg max last\n" 154 148 " loss period: %7.3f %7.3f %7.3f %7.3f%s\n" 155 " jitter : %7.3f %7.3f %7.3f %7.3f%s \n",149 " jitter : %7.3f %7.3f %7.3f %7.3f%s", 156 150 last_update, 157 151 good_number(packets, audio->rtcp.stat.rx.pkt), … … 176 170 audio->rtcp.stat.rx.jitter.last / 1000.0, 177 171 "" 178 ) ;172 )); 179 173 180 174 … … 191 185 } 192 186 193 printf(" TX stat last update: %s\n" 187 PJ_LOG(3, (THIS_FILE, 188 " TX stat last update: %s\n" 194 189 " total %s packets %sB sent (%sB +IP hdr)%s\n" 195 190 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 196 191 " (msec) min avg max last\n" 197 192 " loss period: %7.3f %7.3f %7.3f %7.3f%s\n" 198 " jitter : %7.3f %7.3f %7.3f %7.3f%s \n",193 " jitter : %7.3f %7.3f %7.3f %7.3f%s", 199 194 last_update, 200 195 good_number(packets, audio->rtcp.stat.tx.pkt), … … 219 214 audio->rtcp.stat.tx.jitter.last / 1000.0, 220 215 "" 221 ); 222 223 224 printf(" RTT delay : %7.3f %7.3f %7.3f %7.3f%s\n", 216 )); 217 218 219 PJ_LOG(3, (THIS_FILE, 220 " RTT delay : %7.3f %7.3f %7.3f %7.3f%s\n", 225 221 audio->rtcp.stat.rtt.min / 1000.0, 226 222 audio->rtcp.stat.rtt.avg / 1000.0, … … 228 224 audio->rtcp.stat.rtt.last / 1000.0, 229 225 "" 230 ); 231 226 )); 227 228 pj_log_set_decor(decor); 232 229 } 233 230
Note: See TracChangeset
for help on using the changeset viewer.