Changeset 2991


Ignore:
Timestamp:
Nov 8, 2009 3:35:41 AM (15 years ago)
Author:
bennylp
Message:

Misc (#951): some fixes for pjsystest application:

  • added the missing build target on the Makefile build system
  • added alternative search path for the WAV files
Location:
pjproject/trunk/pjsip-apps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/build/Makefile

    r2506 r2991  
    4040 
    4141 
     42############################################################################### 
     43# Defines for building pjsystest 
     44# 
     45export PJSYSTEST_SRCDIR = ../src/pjsystest 
     46export PJSYSTEST_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ 
     47                        systest.o main_console.o 
     48export PJSYSTEST_CFLAGS += $(_CFLAGS) 
     49export PJSYSTEST_LDFLAGS += $(APP_LDFLAGS) $(APP_LDLIBS) $(LDFLAGS) 
     50export PJSYSTEST_EXE:=../bin/pjsystest-$(TARGET_NAME)$(HOST_EXE) 
     51 
     52 
    4253export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT  
    4354############################################################################### 
     
    4556# 
    4657# 
    47 TARGETS := pjsua samples 
     58TARGETS := pjsua pjsystest samples 
    4859 
    4960.PHONY: $(TARGETS) 
     
    6172        $(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(PJSUA_EXE) 
    6273 
     74pjsystest: 
     75        $(MAKE) -f $(RULES_MAK) APP=PJSYSTEST app=pjsystest $(PJSYSTEST_EXE) 
     76 
    6377samples: 
    6478        $(MAKE) -f Samples.mak 
     
    7387        @if test "$@" = "depend"; then \ 
    7488          echo '$(PJSUA_EXE): $(APP_LIB_FILES)' >> .pjsua-$(TARGET_NAME).depend; \ 
     89          echo '$(PJSYSTEST_EXE): $(APP_LIB_FILES)' >> .pjsystest-$(TARGET_NAME).depend; \ 
    7590        fi 
    7691 
  • pjproject/trunk/pjsip-apps/src/pjsystest/systest.c

    r2840 r2991  
    115115     
    116116    strcpy(themsg, title); 
    117     strncat(themsg, errmsg, sizeof(themsg)); 
     117    strncat(themsg, errmsg, sizeof(themsg)-1); 
    118118    themsg[sizeof(themsg)-1] = '\0'; 
    119119 
     
    246246} 
    247247 
     248/* Util: create file player, each time trying different paths until we get 
     249 * the file. 
     250 */ 
     251static pj_status_t create_player(unsigned path_cnt, const char *paths[],  
     252                                 pjsua_player_id *p_id) 
     253{ 
     254    pj_str_t name; 
     255    pj_status_t status = PJ_ENOTFOUND; 
     256    unsigned i; 
     257 
     258    for (i=0; i<path_cnt; ++i) { 
     259        status = pjsua_player_create(pj_cstr(&name, paths[i]), 0, p_id); 
     260        if (status == PJ_SUCCESS) 
     261            return PJ_SUCCESS; 
     262    } 
     263    return status; 
     264} 
    248265 
    249266/***************************************************************************** 
    250267 * test: play WAV file 
    251268 */ 
    252 static void systest_play_wav(const char *filename) 
     269static void systest_play_wav(unsigned path_cnt, const char *paths[]) 
    253270{ 
    254271    pjsua_player_id play_id = PJSUA_INVALID_ID; 
    255272    enum gui_key key; 
    256273    test_item_t *ti; 
    257     pj_str_t name; 
    258274    const char *title = "WAV File Playback Test"; 
    259275    pj_status_t status; 
     
    269285                     "for a while to make sure that everything is okay." 
    270286                     " Press OK to start, CANCEL to skip", 
    271                      filename); 
     287                     paths[0]); 
    272288 
    273289    key = gui_msgbox(title, textbuf, 
     
    281297 
    282298    /* WAV port */ 
    283     status = pjsua_player_create(pj_cstr(&name, filename), 0, &play_id); 
     299    status = create_player(path_cnt, paths, &play_id); 
    284300    if (status != PJ_SUCCESS) 
    285301        goto on_return; 
     
    314330static void systest_play_wav1(void) 
    315331{ 
    316     systest_play_wav(WAV_PLAYBACK_PATH); 
     332    const char *paths[] = { WAV_PLAYBACK_PATH,  
     333                            ALT_PATH1 WAV_PLAYBACK_PATH }; 
     334    systest_play_wav(PJ_ARRAY_SIZE(paths), paths); 
    317335} 
    318336 
    319337static void systest_play_wav2(void) 
    320338{ 
    321     systest_play_wav(WAV_TOCK8_PATH); 
     339    const char *paths[] = { WAV_TOCK8_PATH,  
     340                            ALT_PATH1 WAV_TOCK8_PATH}; 
     341    systest_play_wav(PJ_ARRAY_SIZE(paths), paths); 
    322342} 
    323343 
     
    713733static void systest_latency_test(void) 
    714734{ 
    715     const pj_str_t ref_wav_file = pj_str(WAV_TOCK8_PATH); 
     735    const char *ref_wav_paths[] = { WAV_TOCK8_PATH, ALT_PATH1 WAV_TOCK8_PATH }; 
    716736    const pj_str_t rec_wav_file = pj_str(WAV_LATENCY_OUT_PATH); 
    717737    pjsua_player_id play_id = PJSUA_INVALID_ID; 
     
    755775    PJ_LOG(3,(THIS_FILE, "Running %s", title)); 
    756776 
    757     status = pjsua_player_create(&ref_wav_file, 0, &play_id); 
     777    status = create_player(PJ_ARRAY_SIZE(ref_wav_paths), ref_wav_paths,  
     778                           &play_id); 
    758779    if (status != PJ_SUCCESS) 
    759780        goto on_return; 
  • pjproject/trunk/pjsip-apps/src/pjsystest/systest.h

    r2839 r2991  
    5454    #define WAV_TOCK8_PATH              "\\Program Files\\pjsystest\\tock8.WAV" 
    5555    #define WAV_LATENCY_OUT_PATH        "\\PJSYSTEST_LATREC.WAV" 
     56    #define ALT_PATH1                   "" 
    5657#else 
    5758    #define LOG_OUT_PATH                "PJSYSTEST.LOG" 
     
    6162    #define WAV_TOCK8_PATH              "tock8.wav" 
    6263    #define WAV_LATENCY_OUT_PATH        "PJSYSTEST_LATREC.WAV" 
     64    #define ALT_PATH1                   "../../tests/pjsua/wavs/" 
    6365#endif 
    6466 
Note: See TracChangeset for help on using the changeset viewer.