Changes between Version 2 and Version 3 of Ticket #2077


Ignore:
Timestamp:
Aug 20, 2018 10:01:03 AM (10 months ago)
Author:
nanang
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2077 – Description

    v2 v3  
    1111    - PJSUA: it must have API to query the conference bridge port. 
    1212    - PJSUA2: it must be a descendant of [http://www.pjsip.org/docs/book-latest/html/reference.html#classpj_1_1AudioMedia AudioMedia]. 
     13 
     14=== Sample code using PJSUA === 
     15{{{ 
     16enum { EXTRA_SND_DEV_ID  = 3; }; 
     17 
     18pjmedia_snd_port_param ext_param; 
     19pjsua_ext_snd_dev *ext_snd_dev; 
     20pjsua_conf_port_id ext_id; 
     21 
     22/* Generate params (with default values) */ 
     23status = pjmedia_snd_port_param_default(&ext_param); 
     24status = pjmedia_aud_dev_default_param(EXTRA_SND_DEV_ID, &ext_param.base); 
     25 
     26/* Create the extra audio device */ 
     27status = pjsua_ext_snd_dev_create(&ext_param, &ext_snd_dev); 
     28ext_id = pjsua_ext_snd_dev_get_conf_port(ext_snd_dev); 
     29 
     30/* Connect extra audio dev mic to main audio dev */ 
     31status = pjsua_conf_connect(ext_id, 0); 
     32 
     33/* Connect main audio dev mic to extra audio dev */ 
     34status = pjsua_conf_connect(0, ext_id); 
     35 
     36... 
     37 
     38/* Destroy extra audio dev (after no longer used) */ 
     39pjsua_ext_snd_dev_destroy(ext_snd_dev); 
     40}}} 
     41 
     42=== Sample code using PJSUA2 === 
     43{{{ 
     44/* Use Null Audio Device as main media clock. This is useful for improving 
     45 * media clock (see also https://trac.pjsip.org/repos/wiki/FAQ#tx-timing) 
     46 * especially when sound device clock is jittery. 
     47 */ 
     48ep.audDevManager().setNullDev(); 
     49 
     50/* Install extra audio device */ 
     51ExtraAudioDevice *auddev2 = new ExtraAudioDevice(-1, -1); 
     52try { 
     53    auddev2->open(); 
     54} catch (...) { 
     55    std::cout << "Extra sound device failed" << std::endl; 
     56} 
     57 
     58/* Create WAV player and play the WAV to extra audio speaker */ 
     59AudioMediaPlayer amp; 
     60amp.createPlayer(PATH_TO_WAV_FILE); 
     61if (auddev2->isOpened()) 
     62    amp.startTransmit(*auddev2); 
     63 
     64/* Wait for the WAV playback */ 
     65pj_thread_sleep(5000); 
     66 
     67... 
     68 
     69/* Destroy extra audio device (after no longer used) */ 
     70delete auddev2; 
     71}}}