Changeset 2199 for pjproject/trunk/pjsip-apps/src/samples/aectest.c
- Timestamp:
- Aug 10, 2008 4:15:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/aectest.c
r2198 r2199 57 57 " -d The delay between playback and capture in ms. Default is zero.\n" 58 58 " -l Set the echo tail length in ms. Default is 200 ms \n" 59 " -r Set repeat count (default=1) \n" 59 60 " -a Algorithm: 0=default, 1=speex, 3=echo suppress \n"; 60 61 … … 92 93 unsigned tail_ms = TAIL_LENGTH; 93 94 pj_timestamp t0, t1; 94 int c;95 int i, repeat=1, c; 95 96 96 97 pj_optind = 0; 97 while ((c=pj_getopt(argc, argv, "d:l:a: ")) !=-1) {98 while ((c=pj_getopt(argc, argv, "d:l:a:r:")) !=-1) { 98 99 switch (c) { 99 100 case 'd': … … 122 123 } 123 124 break; 125 case 'r': 126 repeat = atoi(pj_optarg); 127 if (repeat < 1) { 128 puts("Invalid algorithm"); 129 puts(desc); 130 return 1; 131 } 132 break; 124 133 } 125 134 } … … 211 220 rec_frame.buf = pj_pool_alloc(pool, wav_play->info.samples_per_frame<<1); 212 221 pj_get_timestamp(&t0); 213 for (;;) { 214 play_frame.size = wav_play->info.samples_per_frame << 1; 215 status = pjmedia_port_get_frame(wav_play, &play_frame); 216 if (status != PJ_SUCCESS) 217 break; 218 219 status = pjmedia_echo_playback(ec, (short*)play_frame.buf); 220 221 rec_frame.size = wav_play->info.samples_per_frame << 1; 222 status = pjmedia_port_get_frame(wav_rec, &rec_frame); 223 if (status != PJ_SUCCESS) 224 break; 225 226 status = pjmedia_echo_capture(ec, (short*)rec_frame.buf, 0); 227 228 //status = pjmedia_echo_cancel(ec, (short*)rec_frame.buf, 229 // (short*)play_frame.buf, 0, NULL); 230 231 pjmedia_port_put_frame(wav_out, &rec_frame); 222 for (i=0; i < repeat; ++i) { 223 for (;;) { 224 play_frame.size = wav_play->info.samples_per_frame << 1; 225 status = pjmedia_port_get_frame(wav_play, &play_frame); 226 if (status != PJ_SUCCESS) 227 break; 228 229 status = pjmedia_echo_playback(ec, (short*)play_frame.buf); 230 231 rec_frame.size = wav_play->info.samples_per_frame << 1; 232 status = pjmedia_port_get_frame(wav_rec, &rec_frame); 233 if (status != PJ_SUCCESS) 234 break; 235 236 status = pjmedia_echo_capture(ec, (short*)rec_frame.buf, 0); 237 238 //status = pjmedia_echo_cancel(ec, (short*)rec_frame.buf, 239 // (short*)play_frame.buf, 0, NULL); 240 241 pjmedia_port_put_frame(wav_out, &rec_frame); 242 } 243 244 pjmedia_wav_player_port_set_pos(wav_play, 0); 245 pjmedia_wav_player_port_set_pos(wav_rec, 0); 232 246 } 233 247 pj_get_timestamp(&t1); … … 257 271 /* Shutdown PJLIB */ 258 272 pj_shutdown(); 273 274 #if 0 275 { 276 char s[10]; 277 puts("ENTER to quit"); 278 fgets(s, sizeof(s), stdin); 279 } 280 #endif 259 281 260 282 /* Done. */
Note: See TracChangeset
for help on using the changeset viewer.