Changeset 2906


Ignore:
Timestamp:
Aug 21, 2009 11:12:19 AM (15 years ago)
Author:
bennylp
Message:

Misc (ticket #951): fixed crash in pjsua application during shutdown with STEREO_DEO (thanks Andreas Ahland for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r2897 r2906  
    2424#define NO_LIMIT        (int)0x7FFFFFFF 
    2525 
    26 //#define STEREO_DEMO 
     26#define STEREO_DEMO 
    2727//#define TRANSPORT_ADAPTER_SAMPLE 
    2828 
     
    104104#ifdef STEREO_DEMO 
    105105    pjmedia_snd_port       *snd; 
     106    pjmedia_port           *sc, *sc_ch1; 
     107    pjsua_conf_port_id      sc_ch1_slot; 
    106108#endif 
    107109 
     
    46794681        app_config.snd = NULL; 
    46804682    } 
     4683    if (app_config.sc_ch1) { 
     4684        pjsua_conf_remove_port(app_config.sc_ch1_slot); 
     4685        app_config.sc_ch1_slot = PJSUA_INVALID_ID; 
     4686        pjmedia_port_destroy(app_config.sc_ch1); 
     4687        app_config.sc_ch1 = NULL; 
     4688    } 
     4689    if (app_config.sc) { 
     4690        pjmedia_port_destroy(app_config.sc); 
     4691        app_config.sc = NULL; 
     4692    } 
    46814693#endif 
    46824694 
     
    47184730 
    47194731#ifdef STEREO_DEMO 
     4732/* 
     4733 * In this stereo demo, we open the sound device in stereo mode and 
     4734 * arrange the attachment to the PJSUA-LIB conference bridge as such 
     4735 * so that channel0/left channel of the sound device corresponds to 
     4736 * slot 0 in the bridge, and channel1/right channel of the sound 
     4737 * device corresponds to slot 1 in the bridge. Then user can independently 
     4738 * feed different media to/from the speakers/microphones channels, by 
     4739 * connecting them to slot 0 or 1 respectively. 
     4740 * 
     4741 * Here's how the connection looks like: 
     4742 * 
     4743   +-----------+ stereo +-----------------+ 2x mono +-----------+ 
     4744   | AUDIO DEV |<------>| SPLITCOMB   left|<------->|#0  BRIDGE | 
     4745   +-----------+        |            right|<------->|#1         | 
     4746                        +-----------------+         +-----------+ 
     4747 */ 
    47204748static void stereo_demo() 
    47214749{ 
    4722     pjmedia_port *conf, *splitter, *ch1; 
     4750    pjmedia_port *conf; 
    47234751    pj_status_t status; 
    47244752 
     
    47334761                                      conf->info.bits_per_sample, 
    47344762                                      0     /* options */, 
    4735                                       &splitter); 
     4763                                      &app_config.sc); 
    47364764    pj_assert(status == PJ_SUCCESS); 
    47374765 
    47384766    /* Connect channel0 (left channel?) to conference port slot0 */ 
    4739     status = pjmedia_splitcomb_set_channel(splitter, 0 /* ch0 */,  
     4767    status = pjmedia_splitcomb_set_channel(app_config.sc, 0 /* ch0 */,  
    47404768                                           0 /*options*/, 
    47414769                                           conf); 
     
    47444772    /* Create reverse channel for channel1 (right channel?)... */ 
    47454773    status = pjmedia_splitcomb_create_rev_channel(app_config.pool, 
    4746                                                   splitter, 
     4774                                                  app_config.sc, 
    47474775                                                  1  /* ch1 */, 
    47484776                                                  0  /* options */, 
    4749                                                   &ch1); 
     4777                                                  &app_config.sc_ch1); 
    47504778    pj_assert(status == PJ_SUCCESS); 
    47514779 
     
    47534781     * if there's no other devices connected to the bridge) 
    47544782     */ 
    4755     status = pjsua_conf_add_port(app_config.pool, ch1, NULL); 
     4783    status = pjsua_conf_add_port(app_config.pool, app_config.sc_ch1,  
     4784                                 &app_config.sc_ch1_slot); 
    47564785    pj_assert(status == PJ_SUCCESS); 
    47574786     
     
    47674796 
    47684797    /* Connect the splitter to the sound device */ 
    4769     status = pjmedia_snd_port_connect(app_config.snd, splitter); 
     4798    status = pjmedia_snd_port_connect(app_config.snd, app_config.sc); 
    47704799    pj_assert(status == PJ_SUCCESS); 
    47714800 
Note: See TracChangeset for help on using the changeset viewer.