Changeset 632 for pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
- Timestamp:
- Jul 27, 2006 10:04:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r629 r632 22 22 #define THIS_FILE "pjsua.c" 23 23 24 //#define STEREO_DEMO 24 25 25 26 … … 55 56 unsigned auto_answer; 56 57 unsigned duration; 58 59 #ifdef STEREO_DEMO 60 pjmedia_snd_port *snd; 61 #endif 62 57 63 } app_config; 58 64 … … 61 67 static pjsua_call_id current_call; 62 68 static pj_str_t uri_arg; 69 70 static void stereo_demo(); 63 71 64 72 /***************************************************************************** … … 2200 2208 return status; 2201 2209 2210 #ifdef STEREO_DEMO 2211 stereo_demo(); 2212 #endif 2213 2202 2214 /* Optionally registers WAV file */ 2203 2215 if (app_config.wav_file.slen) { … … 2273 2285 2274 2286 /* Use null sound device? */ 2287 #ifndef STEREO_DEMO 2275 2288 if (app_config.null_audio) { 2276 2289 status = pjsua_set_null_snd_dev(); … … 2278 2291 return status; 2279 2292 } 2293 #endif 2280 2294 2281 2295 return PJ_SUCCESS; … … 2305 2319 pj_status_t app_destroy(void) 2306 2320 { 2321 #ifdef STEREO_DEMO 2322 if (app_config.snd) { 2323 pjmedia_snd_port_destroy(app_config.snd); 2324 app_config.snd = NULL; 2325 } 2326 #endif 2327 2307 2328 if (app_config.pool) { 2308 2329 pj_pool_release(app_config.pool); … … 2312 2333 return pjsua_destroy(); 2313 2334 } 2335 2336 2337 #ifdef STEREO_DEMO 2338 static void stereo_demo() 2339 { 2340 pjmedia_port *conf, *splitter, *ch1; 2341 unsigned clock; 2342 pj_status_t status; 2343 2344 /* Disable existing sound device */ 2345 conf = pjsua_set_no_snd_dev(); 2346 2347 clock = app_config.media_cfg.clock_rate; 2348 2349 /* Create stereo-mono splitter/combiner */ 2350 status = pjmedia_splitcomb_create(app_config.pool, 2351 clock /* clock rate */, 2352 2 /* stereo */, 2353 clock*2*10/1000/* 10ms samples * 2ch */, 2354 16 /* bits */, 2355 0 /* options */, 2356 &splitter); 2357 pj_assert(status == PJ_SUCCESS); 2358 2359 /* Connect channel0 (left channel?) to conference port slot0 */ 2360 status = pjmedia_splitcomb_set_channel(splitter, 0 /* ch0 */, 2361 0 /*options*/, 2362 conf); 2363 pj_assert(status == PJ_SUCCESS); 2364 2365 /* Create reverse channel for channel1 (right channel?)... */ 2366 status = pjmedia_splitcomb_create_rev_channel(app_config.pool, 2367 splitter, 2368 1 /* ch1 */, 2369 0 /* options */, 2370 &ch1); 2371 pj_assert(status == PJ_SUCCESS); 2372 2373 /* .. and register it to conference bridge (it would be slot1 2374 * if there's no other devices connected to the bridge) 2375 */ 2376 status = pjsua_conf_add_port(app_config.pool, ch1, NULL); 2377 pj_assert(status == PJ_SUCCESS); 2378 2379 /* Create sound device */ 2380 status = pjmedia_snd_port_create(app_config.pool, -1, -1, 2381 clock /* clock rate */, 2382 2 /* stereo */, 2383 clock*2*10/1000 /* 10 ms samples * 2ch */, 2384 16 /* bits */, 2385 0, &app_config.snd); 2386 pj_assert(status == PJ_SUCCESS); 2387 2388 2389 /* Connect the splitter to the sound device */ 2390 status = pjmedia_snd_port_connect(app_config.snd, splitter); 2391 pj_assert(status == PJ_SUCCESS); 2392 2393 } 2394 #endif 2395
Note: See TracChangeset
for help on using the changeset viewer.