Changes between Version 102 and Version 103 of FAQ


Ignore:
Timestamp:
Oct 26, 2010 11:11:13 PM (14 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v102 v103  
    479479 
    480480When you encounter this problem, and if upgrading the softphone doesn't solve the problem, you can report this to PJSIP mailing list. When reporting, please include the error log and the complete INVITE message and the 200/OK response (containing the SDP), so that we can analyze which endpoint is behaving badly. 
     481 
     482=== How can I use multiple sound devices simultaneously? === #multi-snd 
     483 
     484You can use multiple audio devices simultaneously with PJSUA-LIB. The first sound device is managed by PJSUA-LIB as usual, and you access it as slot !#0 in the conference bridge. The following steps describe how to open and use the second and subsequent sound devices in your application: 
     485 1. Create a [http://www.pjsip.org/pjmedia/docs/html/group__PJMED__SND__PORT.htm sound device port] for the sound device you want to use. 
     486 {{{ 
     487pjmedia_snd_port *sndport; 
     488pj_status_t status; 
     489 
     490status = pjmedia_snd_port_create(..., &sndport); 
     491 }}} 
     492 2. Create a [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__SPLITCOMB.htm splitter/combiner] port. 
     493 {{{ 
     494pjmedia_port *splitcomb; 
     495 
     496status = pjmedia_split_comb_create(..., &splitcomb); 
     497 }}} 
     498 3. Create a ''reverse channel'' from the splitcomb. 
     499 {{{ 
     500pjmedia_port *revch; 
     501 
     502status = pjmedia_splitcomb_create_rev_channel(pool, splitcomb, 0, 0, &revch); 
     503 }}} 
     504 4. Register the reverse channel above to the conference bridge. 
     505 {{{ 
     506int slot; 
     507 
     508status = pjsua_conf_add_port(pool, revch, &slot); 
     509 }}} 
     510 5. Connect the sound device port to the splitcomb. 
     511 {{{ 
     512status = pjmedia_snd_port_connect(sndport, splitcomb); 
     513 }}} 
     514 
     515After these, you can use the sound device (that you open in step 1 above) by using the slot number (step 4) just as you would with other media ports. For example, to play a media to the sound device, just connect (with ''pjsua_conf_connect()'') the slot number of that media to the slot number of the sound device, and vice versa. 
     516 
     517=== How can I use the sound device in stereo? === #stereo 
     518 
     519There are two options for this, and each will be explained below. 
     520 
     521The first option is to configure PJSUA-LIB's media to stereo (or in fact any number of channels greater than 1), by setting {{{pjsua_media_config.channel_count}}} to 2 (or greater). This is what the '''{{{--stereo}}}''' option in [http://www.pjsip.org/pjsua.htm pjsua] does. With this, both the main sound device and the conference bridge will be opened in stereo mode. You may register mono or stereo media ports to the conference bridge; stereo media ports will be played back in stereo, while mono media ports will have the media duplicated to the right channel. 
     522 
     523The approach above is useful to playback/capture stereo media. However, it's difficult to control over what's playing on the left or right channel of the audio device, as you would have to use splitcomb to manually combine mono media ports into stereo.  
     524 
     525The second option is to configure PJSUA-LIB's media to mono, as usual, but to open the sound device in stereo. Connect the left channel of the sound device to conference bridge slot !#0, and the right channel to slot !#1 (for example). You will then be able to control what is played to left or right channel by connecting the media to the appropriate slot number of the sound device channel. 
     526 
     527See '''{{{stereo_demo()}}}''' function in {{{pjsua_app.c}}} for a sample code. 
     528 
     529The second option has some drawbacks though. First, despite the fact that the sound device is opened in stereo, you will not be able to playback stereo media in stereo, since the conference bridge is instantiated in mono, hence it will convert the stereo media ports into mono when it's connected to the bridge. And second, since you manage the sound device manually, it won't be opened/closed automatically by PJSUA-LIB as it would normally. 
    481530 
    482531----