Changeset 2991 for pjproject/trunk/pjsip-apps/src/pjsystest/systest.c
- Timestamp:
- Nov 8, 2009 3:35:41 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsystest/systest.c
r2840 r2991 115 115 116 116 strcpy(themsg, title); 117 strncat(themsg, errmsg, sizeof(themsg) );117 strncat(themsg, errmsg, sizeof(themsg)-1); 118 118 themsg[sizeof(themsg)-1] = '\0'; 119 119 … … 246 246 } 247 247 248 /* Util: create file player, each time trying different paths until we get 249 * the file. 250 */ 251 static 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 } 248 265 249 266 /***************************************************************************** 250 267 * test: play WAV file 251 268 */ 252 static void systest_play_wav( const char *filename)269 static void systest_play_wav(unsigned path_cnt, const char *paths[]) 253 270 { 254 271 pjsua_player_id play_id = PJSUA_INVALID_ID; 255 272 enum gui_key key; 256 273 test_item_t *ti; 257 pj_str_t name;258 274 const char *title = "WAV File Playback Test"; 259 275 pj_status_t status; … … 269 285 "for a while to make sure that everything is okay." 270 286 " Press OK to start, CANCEL to skip", 271 filename);287 paths[0]); 272 288 273 289 key = gui_msgbox(title, textbuf, … … 281 297 282 298 /* WAV port */ 283 status = pjsua_player_create(pj_cstr(&name, filename), 0, &play_id);299 status = create_player(path_cnt, paths, &play_id); 284 300 if (status != PJ_SUCCESS) 285 301 goto on_return; … … 314 330 static void systest_play_wav1(void) 315 331 { 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); 317 335 } 318 336 319 337 static void systest_play_wav2(void) 320 338 { 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); 322 342 } 323 343 … … 713 733 static void systest_latency_test(void) 714 734 { 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 }; 716 736 const pj_str_t rec_wav_file = pj_str(WAV_LATENCY_OUT_PATH); 717 737 pjsua_player_id play_id = PJSUA_INVALID_ID; … … 755 775 PJ_LOG(3,(THIS_FILE, "Running %s", title)); 756 776 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); 758 779 if (status != PJ_SUCCESS) 759 780 goto on_return;
Note: See TracChangeset
for help on using the changeset viewer.