From fa0d31107cf117f260d8b8678c1d10c1c159df92 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 17 Jul 2009 11:37:42 +0000 Subject: More ticket #720: added Win32 target in VS2005 project git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2839 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsystest/systest.c | 28 +++++++++++++++------------- pjsip-apps/src/pjsystest/systest.h | 32 ++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 21 deletions(-) (limited to 'pjsip-apps/src/pjsystest') diff --git a/pjsip-apps/src/pjsystest/systest.c b/pjsip-apps/src/pjsystest/systest.c index 01401848..600ba80c 100644 --- a/pjsip-apps/src/pjsystest/systest.c +++ b/pjsip-apps/src/pjsystest/systest.c @@ -377,11 +377,6 @@ static void systest_rec_audio(void) pjsua_recorder_destroy(rec_id); rec_id = PJSUA_INVALID_ID; - key = gui_msgbox(title, - "Recording has been stopped. Press OK to playback " - "the recorded audio.", - WITH_OK); - status = pjsua_player_create(&filename, 0, &play_id); if (status != PJ_SUCCESS) goto on_return; @@ -393,6 +388,7 @@ static void systest_rec_audio(void) goto on_return; key = gui_msgbox(title, + "Recording has been stopped. " "The recorded audio is being played now to " "the speaker device, in a loop. Listen for " "any audio impairments. Press OK to stop.", @@ -486,7 +482,7 @@ static void systest_audio_test(void) param.dir = dir; param.rec_id = systest.rec_id; param.play_id = systest.play_id; - param.clock_rate = systest.media_cfg.clock_rate; + param.clock_rate = systest.media_cfg.snd_clock_rate; param.channel_count = systest.media_cfg.channel_count; param.samples_per_frame = param.clock_rate * param.channel_count * systest.media_cfg.audio_frame_ptime / 1000; @@ -568,8 +564,8 @@ static void systest_audio_test(void) -result.rec_drift_per_sec; pj_ansi_snprintf(drifttext, sizeof(drifttext), - "Clock drifts detected. Capture device " - "is running %d samples per second %s " + "Clock drifts detected. Capture " + "is %d samples/sec %s " "than the playback device", drift, which); problems[problem_count++] = drifttext; @@ -680,7 +676,7 @@ static int calculate_latency(pj_pool_t *pool, pjmedia_port *wav, lat = (max_echo_pos - max_signal_pos) * 1000 / wav->info.clock_rate; -#if 1 +#if 0 PJ_LOG(4,(THIS_FILE, "Signal at %dms, echo at %d ms, latency %d ms", max_signal_pos * 1000 / wav->info.clock_rate, max_echo_pos * 1000 / wav->info.clock_rate, @@ -770,6 +766,7 @@ static void systest_latency_test(void) /* We're running */ + PJ_LOG(3,(THIS_FILE, "Please wait while test is running (~10 sec)")); gui_sleep(10); /* Done with the test */ @@ -946,10 +943,14 @@ static void systest_display_settings(void) pj_get_version()); len = strlen(textbuf); - pj_ansi_snprintf(textbuf+len, sizeof(textbuf)-len, "Clock rate: %d\r\n", + pj_ansi_snprintf(textbuf+len, sizeof(textbuf)-len, "Test clock rate: %d\r\n", systest.media_cfg.clock_rate); len = strlen(textbuf); + pj_ansi_snprintf(textbuf+len, sizeof(textbuf)-len, "Device clock rate: %d\r\n", + systest.media_cfg.snd_clock_rate); + len = strlen(textbuf); + pj_ansi_snprintf(textbuf+len, sizeof(textbuf)-len, "Aud frame ptime: %d\r\n", systest.media_cfg.audio_frame_ptime); len = strlen(textbuf); @@ -1031,12 +1032,13 @@ int systest_init(void) pjsua_config_default(&systest.ua_cfg); pjsua_media_config_default(&systest.media_cfg); - systest.media_cfg.clock_rate = CLOCK_RATE; + systest.media_cfg.clock_rate = TEST_CLOCK_RATE; + systest.media_cfg.snd_clock_rate = DEV_CLOCK_RATE; if (OVERRIDE_AUD_FRAME_PTIME) systest.media_cfg.audio_frame_ptime = OVERRIDE_AUD_FRAME_PTIME; systest.media_cfg.channel_count = CHANNEL_COUNT; - systest.rec_id = PJMEDIA_AUD_DEFAULT_CAPTURE_DEV; - systest.play_id = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV; + systest.rec_id = REC_DEV_ID; + systest.play_id = PLAY_DEV_ID; systest.media_cfg.ec_tail_len = 0; #if defined(OVERRIDE_AUDDEV_PLAY_LAT) && OVERRIDE_AUDDEV_PLAY_LAT!=0 diff --git a/pjsip-apps/src/pjsystest/systest.h b/pjsip-apps/src/pjsystest/systest.h index 1b802fe7..f5043be2 100644 --- a/pjsip-apps/src/pjsystest/systest.h +++ b/pjsip-apps/src/pjsystest/systest.h @@ -24,12 +24,28 @@ /* * Overrideable parameters */ -#define OVERRIDE_AUDDEV_REC_LAT 100 -#define OVERRIDE_AUDDEV_PLAY_LAT 200 +#define REC_DEV_ID PJMEDIA_AUD_DEFAULT_CAPTURE_DEV +#define PLAY_DEV_ID PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV +//#define REC_DEV_ID 5 +//#define PLAY_DEV_ID 5 +#define OVERRIDE_AUDDEV_REC_LAT 0 +#define OVERRIDE_AUDDEV_PLAY_LAT 0 #define OVERRIDE_AUD_FRAME_PTIME 0 -#define CLOCK_RATE 8000 + +/* Don't change this */ #define CHANNEL_COUNT 1 +/* If you change CLOCK_RATE then the input WAV files need to be + * changed, so normally don't need to change this. + */ +#define TEST_CLOCK_RATE 8000 + +/* You may change sound device's clock rate as long as resampling + * is enabled. + */ +#define DEV_CLOCK_RATE 8000 + + #if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE #define LOG_OUT_PATH "\\PJSYSTEST.LOG" #define RESULT_OUT_PATH "\\PJSYSTEST_RESULT.TXT" @@ -39,11 +55,11 @@ #define WAV_LATENCY_OUT_PATH "\\PJSYSTEST_LATREC.WAV" #else #define LOG_OUT_PATH "PJSYSTEST.LOG" - #define RESULT_OUT_PATH "PJSYSTEST.TXT" - #define WAV_PLAYBACK_PATH "pjsip8.wav" - #define WAV_REC_OUT_PATH "TESTREC.WAV" - #define WAV_TOCK8_PATH "TOCK8.WAV" - #define WAV_LATENCY_OUT_PATH "LATENCY.WAV" + #define RESULT_OUT_PATH "PJSYSTEST_RESULT.TXT" + #define WAV_PLAYBACK_PATH "input.8.wav" + #define WAV_REC_OUT_PATH "PJSYSTEST_TESTREC.WAV" + #define WAV_TOCK8_PATH "tock8.wav" + #define WAV_LATENCY_OUT_PATH "PJSYSTEST_LATREC.WAV" #endif #ifdef __cplusplus -- cgit v1.2.3