summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-08-13 13:53:18 +0000
committerBenny Prijono <bennylp@teluu.com>2008-08-13 13:53:18 +0000
commit73f0b593fb6854a35c8b0bf8bfe851aeb889da81 (patch)
treedb3725621d22be4202b060129f5ee696d717829f
parentfc20128b14dec8af0762191cc178452625a9b55c (diff)
Added interactive option in aectest sample and to display WAV duration on exit
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2210 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/samples/aectest.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/pjsip-apps/src/samples/aectest.c b/pjsip-apps/src/samples/aectest.c
index 773f7c94..9d9fabad 100644
--- a/pjsip-apps/src/samples/aectest.c
+++ b/pjsip-apps/src/samples/aectest.c
@@ -57,7 +57,8 @@ static const char *desc =
" -d The delay between playback and capture in ms. Default is zero.\n"
" -l Set the echo tail length in ms. Default is 200 ms \n"
" -r Set repeat count (default=1) \n"
-" -a Algorithm: 0=default, 1=speex, 3=echo suppress \n";
+" -a Algorithm: 0=default, 1=speex, 3=echo suppress \n"
+" -i Interactive \n";
/*
* Sample session:
@@ -92,10 +93,10 @@ int main(int argc, char *argv[])
unsigned latency_ms = 0;
unsigned tail_ms = TAIL_LENGTH;
pj_timestamp t0, t1;
- int i, repeat=1, c;
+ int i, repeat=1, interactive=0, c;
pj_optind = 0;
- while ((c=pj_getopt(argc, argv, "d:l:a:r:")) !=-1) {
+ while ((c=pj_getopt(argc, argv, "d:l:a:r:i")) !=-1) {
switch (c) {
case 'd':
latency_ms = atoi(pj_optarg);
@@ -130,6 +131,9 @@ int main(int argc, char *argv[])
return 1;
}
break;
+ case 'i':
+ interactive = 1;
+ break;
}
}
@@ -246,6 +250,10 @@ int main(int argc, char *argv[])
}
pj_get_timestamp(&t1);
+ i = pjmedia_wav_writer_port_get_pos(wav_out) * 1000 /
+ (wav_out->info.clock_rate * wav_out->info.channel_count);
+ PJ_LOG(3,(THIS_FILE, "Processed %3d.%03ds audio",
+ i / 1000, i % 1000));
PJ_LOG(3,(THIS_FILE, "Completed in %u msec\n", pj_elapsed_msec(&t0, &t1)));
/* Destroy file port(s) */
@@ -271,13 +279,11 @@ int main(int argc, char *argv[])
/* Shutdown PJLIB */
pj_shutdown();
-#if 0
- {
+ if (interactive) {
char s[10];
puts("ENTER to quit");
fgets(s, sizeof(s), stdin);
}
-#endif
/* Done. */
return 0;