Ignore:
Timestamp:
Mar 8, 2006 12:37:22 PM (18 years ago)
Author:
bennylp
Message:

Added options to disable microphone device, usefull for streaming server (some systems only have sound player)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r279 r312  
    128128struct pjmedia_conf 
    129129{ 
     130    unsigned              options;      /**< Bitmask options.               */ 
    130131    unsigned              max_ports;    /**< Maximum ports.                 */ 
    131132    unsigned              port_cnt;     /**< Current number of ports.       */ 
     
    334335                                         unsigned samples_per_frame, 
    335336                                         unsigned bits_per_sample, 
     337                                         unsigned options, 
    336338                                         pjmedia_conf **p_conf ) 
    337339{ 
     
    352354    PJ_ASSERT_RETURN(conf->ports, PJ_ENOMEM); 
    353355 
     356    conf->options = options; 
    354357    conf->max_ports = max_ports; 
    355358    conf->clock_rate = clock_rate; 
     
    386389static pj_status_t create_sound( pjmedia_conf *conf ) 
    387390{ 
    388     /* Open recorder. */ 
    389     conf->snd_rec = pj_snd_open_recorder(-1 ,&conf->snd_info, &rec_cb, conf); 
    390     if (conf->snd_rec == NULL) { 
    391         return -1; 
     391    /* Open recorder only if mic is not disabled. */ 
     392    if ((conf->options & PJMEDIA_CONF_NO_MIC) == 0) { 
     393        conf->snd_rec = pj_snd_open_recorder(-1 ,&conf->snd_info,  
     394                                             &rec_cb, conf); 
     395        if (conf->snd_rec == NULL) { 
     396            return -1; 
     397        } 
    392398    } 
    393399 
     
    395401    conf->snd_player = pj_snd_open_player(-1, &conf->snd_info, &play_cb, conf); 
    396402    if (conf->snd_player == NULL) { 
    397         pj_snd_stream_close(conf->snd_rec); 
     403        if (conf->snd_rec) { 
     404            pj_snd_stream_close(conf->snd_rec); 
     405        } 
    398406        return -1; 
    399407    } 
     
    426434    pj_status_t status; 
    427435 
    428     if (conf->snd_rec == NULL) { 
     436    if (conf->snd_player == NULL) { 
    429437        status = create_sound(conf); 
    430438        if (status != PJ_SUCCESS) 
Note: See TracChangeset for help on using the changeset viewer.