Ignore:
Timestamp:
Mar 30, 2012 7:10:13 AM (12 years ago)
Author:
bennylp
Message:

Re #1474: Merged all changes from 1.12 - HEAD (from the 1.x branch)

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk

  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c

    r3982 r3999  
    2727 
    2828/***************************************************************************** 
    29 /* 
     29 * 
    3030 * Prototypes 
    3131 */ 
     
    4444 
    4545/***************************************************************************** 
    46 /* 
     46 * 
    4747 * Call API that are closely tied to PJMEDIA 
    4848 */ 
     
    224224 
    225225/***************************************************************************** 
    226 /* 
     226 * 
    227227 * Audio media with PJMEDIA backend 
    228228 */ 
     
    807807    pj_log_push_indent(); 
    808808 
     809    PJSUA_LOCK(); 
     810 
    809811    /* If sound device idle timer is active, cancel it first. */ 
    810     PJSUA_LOCK(); 
    811812    if (pjsua_var.snd_idle_timer.id) { 
    812813        pjsip_endpt_cancel_timer(pjsua_var.endpt, &pjsua_var.snd_idle_timer); 
    813814        pjsua_var.snd_idle_timer.id = PJ_FALSE; 
    814815    } 
    815     PJSUA_UNLOCK(); 
    816816 
    817817 
     
    911911            !pjsua_var.no_snd) 
    912912        { 
    913             pj_status_t status; 
    914  
    915913            status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); 
    916914            if (status != PJ_SUCCESS) { 
     
    927925    } 
    928926 
    929     status = pjmedia_conf_connect_port(pjsua_var.mconf, source, sink, 0); 
    930  
    931927on_return: 
     928    PJSUA_UNLOCK(); 
     929 
     930    if (status == PJ_SUCCESS) { 
     931        status = pjmedia_conf_connect_port(pjsua_var.mconf, source, sink, 0); 
     932    } 
     933 
    932934    pj_log_pop_indent(); 
    933935    return status; 
     
    18521854    pj_log_push_indent(); 
    18531855 
     1856    PJSUA_LOCK(); 
     1857 
    18541858    /* Null-sound */ 
    18551859    if (capture_dev==NULL_SND_DEV_ID && playback_dev==NULL_SND_DEV_ID) { 
     1860        PJSUA_UNLOCK(); 
    18561861        status = pjsua_set_null_snd_dev(); 
    18571862        pj_log_pop_indent(); 
     
    19041909    pjsua_var.snd_is_on = PJ_TRUE; 
    19051910 
     1911    PJSUA_UNLOCK(); 
    19061912    pj_log_pop_indent(); 
    19071913    return PJ_SUCCESS; 
    19081914 
    19091915on_error: 
     1916    PJSUA_UNLOCK(); 
    19101917    pj_log_pop_indent(); 
    19111918    return status; 
     
    19211928                                      int *playback_dev) 
    19221929{ 
     1930    PJSUA_LOCK(); 
     1931 
    19231932    if (capture_dev) { 
    19241933        *capture_dev = pjsua_var.cap_dev; 
     
    19281937    } 
    19291938 
     1939    PJSUA_UNLOCK(); 
    19301940    return PJ_SUCCESS; 
    19311941} 
     
    19431953    pj_log_push_indent(); 
    19441954 
     1955    PJSUA_LOCK(); 
    19451956 
    19461957    /* Close existing sound device */ 
     
    19701981        pjsua_perror(THIS_FILE, "Unable to create null sound device", 
    19711982                     status); 
     1983        PJSUA_UNLOCK(); 
    19721984        pj_log_pop_indent(); 
    19731985        return status; 
     
    19841996    pjsua_var.snd_is_on = PJ_TRUE; 
    19851997 
     1998    PJSUA_UNLOCK(); 
    19861999    pj_log_pop_indent(); 
    19872000    return PJ_SUCCESS; 
     
    19952008PJ_DEF(pjmedia_port*) pjsua_set_no_snd_dev(void) 
    19962009{ 
     2010    PJSUA_LOCK(); 
     2011 
    19972012    /* Close existing sound device */ 
    19982013    close_snd_dev(); 
    1999  
    20002014    pjsua_var.no_snd = PJ_TRUE; 
     2015 
     2016    PJSUA_UNLOCK(); 
     2017 
    20012018    return pjmedia_conf_get_master_port(pjsua_var.mconf); 
    20022019} 
     
    20082025PJ_DEF(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options) 
    20092026{ 
     2027    pj_status_t status = PJ_SUCCESS; 
     2028 
     2029    PJSUA_LOCK(); 
     2030 
    20102031    pjsua_var.media_cfg.ec_tail_len = tail_ms; 
    20112032 
    20122033    if (pjsua_var.snd_port) 
    2013         return pjmedia_snd_port_set_ec( pjsua_var.snd_port, pjsua_var.pool, 
    2014                                         tail_ms, options); 
    2015  
    2016     return PJ_SUCCESS; 
     2034        status = pjmedia_snd_port_set_ec(pjsua_var.snd_port, pjsua_var.pool, 
     2035                                         tail_ms, options); 
     2036 
     2037    PJSUA_UNLOCK(); 
     2038    return status; 
    20172039} 
    20182040 
     
    20502072        return PJMEDIA_EAUD_INVCAP; 
    20512073    } 
     2074 
     2075    PJSUA_LOCK(); 
    20522076 
    20532077    /* If sound is active, set it immediately */ 
     
    20612085    } 
    20622086 
    2063     if (status != PJ_SUCCESS) 
     2087    if (status != PJ_SUCCESS) { 
     2088        PJSUA_UNLOCK(); 
    20642089        return status; 
     2090    } 
    20652091 
    20662092    /* Save in internal param for later device open */ 
     
    20702096    } 
    20712097 
     2098    PJSUA_UNLOCK(); 
    20722099    return status; 
    20732100} 
     
    20792106                                           void *pval) 
    20802107{ 
     2108    pj_status_t status; 
     2109 
     2110    PJSUA_LOCK(); 
     2111 
    20812112    /* If sound device has never been opened before, open it to 
    20822113     * retrieve the initial setting from the device (e.g. audio 
     
    20942125 
    20952126        strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 
    2096         return pjmedia_aud_stream_get_cap(strm, cap, pval); 
     2127        status = pjmedia_aud_stream_get_cap(strm, cap, pval); 
    20972128    } else { 
    20982129        /* Otherwise retrieve from internal param */ 
    2099         return pjmedia_aud_param_get_cap(&pjsua_var.aud_param, 
    2100                                          cap, pval); 
    2101     } 
     2130        status = pjmedia_aud_param_get_cap(&pjsua_var.aud_param, 
     2131                                           cap, pval); 
     2132    } 
     2133 
     2134    PJSUA_UNLOCK(); 
     2135    return status; 
    21022136} 
    21032137 
Note: See TracChangeset for help on using the changeset viewer.