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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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; 
Note: See TracChangeset for help on using the changeset viewer.