Changeset 2555
- Timestamp:
- Mar 27, 2009 3:15:46 PM (16 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-audiodev/audiotest.c
r2506 r2555 235 235 result->play.min_interval = DIV_ROUND(test_data.playback_data.delay.min, 1000); 236 236 result->play.max_interval = DIV_ROUND(test_data.playback_data.delay.max, 1000); 237 result->play.avg_interval = DIV_ROUND(test_data. capture_data.delay.mean, 1000);237 result->play.avg_interval = DIV_ROUND(test_data.playback_data.delay.mean, 1000); 238 238 result->play.dev_interval = DIV_ROUND(tmp, 1000); 239 239 result->play.max_burst = DIV_ROUND_UP(result->play.max_interval, ptime); … … 241 241 /* Check drifting */ 242 242 if (param->dir == PJMEDIA_DIR_CAPTURE_PLAYBACK) { 243 int end_diff, start_diff, drift;244 245 end_diff = test_data.capture_data.last_timestamp -246 test_data.playback_data.last_timestamp;247 start_diff = test_data.capture_data.first_timestamp-248 test_data.playback_data.first_timestamp;249 drift = end_diff > start_diff? end_diff - start_diff :250 start_diff - end_diff;243 int play_diff, cap_diff, drift; 244 245 play_diff = test_data.playback_data.last_timestamp - 246 test_data.playback_data.first_timestamp; 247 cap_diff = test_data.capture_data.last_timestamp - 248 test_data.capture_data.first_timestamp; 249 drift = play_diff > cap_diff? play_diff - cap_diff : 250 cap_diff - play_diff; 251 251 252 252 /* Allow one frame tolerance for clock drift detection */ -
pjproject/trunk/pjsip-apps/src/samples/auddemo.c
r2517 r2555 30 30 31 31 static unsigned dev_count; 32 static unsigned playback_lat = PJMEDIA_SND_DEFAULT_PLAY_LATENCY; 33 static unsigned capture_lat = PJMEDIA_SND_DEFAULT_REC_LATENCY; 32 34 33 35 static void app_perror(const char *title, pj_status_t status) … … 178 180 param.channel_count = chnum; 179 181 param.samples_per_frame = clock_rate * chnum * ptime / 1000; 182 183 /* Latency settings */ 184 param.flags |= (PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY | 185 PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY); 186 param.input_latency_ms = capture_lat; 187 param.output_latency_ms = playback_lat; 180 188 181 189 PJ_LOG(3,(THIS_FILE, "Performing test..")); … … 384 392 puts(" r RID [FILE] Record capture device RID to WAV file"); 385 393 puts(" p PID [FILE] Playback WAV file to device ID PID"); 394 puts(" d [RLAT [PLAT]] Get/set sound device latencies (in ms):"); 395 puts(" Specify no param to get current latencies setting"); 396 puts(" RLAT : record latency (-1 for default)"); 397 puts(" PLAT : playback latency (-1 for default)"); 386 398 puts(" v Toggle log verbosity"); 387 399 puts(" q Quit"); … … 521 533 break; 522 534 535 case 'd': 536 /* latencies */ 537 { 538 int rec_lat, play_lat; 539 540 if (sscanf(line+2, "%d %d", &rec_lat, &play_lat) == 2) { 541 capture_lat = (unsigned) 542 (rec_lat>=0? rec_lat:PJMEDIA_SND_DEFAULT_REC_LATENCY); 543 playback_lat = (unsigned) 544 (play_lat >= 0? play_lat : PJMEDIA_SND_DEFAULT_PLAY_LATENCY); 545 printf("Recording latency=%ums, playback latency=%ums", 546 capture_lat, playback_lat); 547 } else { 548 printf("Current latencies: record=%ums, playback=%ums", 549 capture_lat, playback_lat); 550 } 551 puts(""); 552 } 553 break; 554 523 555 case 'v': 524 556 if (pj_log_get_level() <= 3) {
Note: See TracChangeset
for help on using the changeset viewer.