Ignore:
Timestamp:
Apr 4, 2016 1:44:10 AM (9 years ago)
Author:
riza
Message:

Re #1908: Implement new API to open speaker only in pjsua/pjsua2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua2/media.cpp

    r5170 r5273  
    680680 
    681681void AudDevManager::setCaptureDev(int capture_dev) const throw(Error) 
    682 { 
    683     int playback_dev = getPlaybackDev(); 
    684  
    685     PJSUA2_CHECK_EXPR( pjsua_set_snd_dev(capture_dev, playback_dev) ); 
     682{     
     683    pjsua_snd_dev_param param; 
     684    pjsua_snd_dev_param_default(&param);     
     685 
     686    param.capture_dev = capture_dev; 
     687    param.playback_dev = getPlaybackDev();     
     688 
     689    param.mode = PJSUA_SND_DEV_NO_IMMEDIATE_OPEN;     
     690 
     691    PJSUA2_CHECK_EXPR( pjsua_set_snd_dev2(&param) ); 
    686692} 
    687693 
    688694void AudDevManager::setPlaybackDev(int playback_dev) const throw(Error) 
    689695{ 
    690     int capture_dev = getCaptureDev(); 
    691  
    692     PJSUA2_CHECK_EXPR( pjsua_set_snd_dev(capture_dev, playback_dev) ); 
     696    pjsua_snd_dev_param param; 
     697    pjsua_snd_dev_param_default(&param);     
     698 
     699    param.capture_dev = getCaptureDev(); 
     700    param.playback_dev = playback_dev; 
     701 
     702    param.mode = PJSUA_SND_DEV_NO_IMMEDIATE_OPEN;     
     703 
     704    PJSUA2_CHECK_EXPR( pjsua_set_snd_dev2(&param) );     
    693705} 
    694706 
     
    719731{ 
    720732    return (MediaPort*)pjsua_set_no_snd_dev(); 
     733} 
     734 
     735void AudDevManager::setSndDevMode(unsigned mode) const throw(Error) 
     736{     
     737    int capture_dev = 0, playback_dev = 0; 
     738    pjsua_snd_dev_param param; 
     739    pj_status_t status = pjsua_get_snd_dev(&capture_dev, &playback_dev);     
     740    if (status != PJ_SUCCESS) { 
     741        PJSUA2_RAISE_ERROR2(status, "AudDevManager::setSndDevMode()");   
     742    } 
     743    pjsua_snd_dev_param_default(&param); 
     744    param.capture_dev = capture_dev; 
     745    param.playback_dev = playback_dev; 
     746    param.mode = mode; 
     747    PJSUA2_CHECK_EXPR( pjsua_set_snd_dev2(&param) ); 
    721748} 
    722749 
Note: See TracChangeset for help on using the changeset viewer.