diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-06-03 18:59:37 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-06-03 18:59:37 +0000 |
commit | 7d34bc703776dd5ad0f2cccd8ebb396c3de273ff (patch) | |
tree | 2bf5cb1266fed7ec821438035a356289be854c19 /pjsip/src/pjsua-lib | |
parent | 773bf20713639d11e14c010fe0e6b11a774472ce (diff) |
More ticket #876:
- fixed crash when null-audio is used with switchboard
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2742 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index efe65307..958756f9 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -1720,26 +1720,39 @@ PJ_DEF(pj_status_t) pjsua_conf_connect( pjsua_conf_port_id source, } if (need_reopen) { - pjmedia_aud_param param; - - /* Create parameter based on peer info */ - status = create_aud_param(¶m, pjsua_var.cap_dev, - pjsua_var.play_dev, - peer_info.clock_rate, - peer_info.channel_count, - peer_info.samples_per_frame, - peer_info.bits_per_sample); - - /* And peer format */ - if (peer_info.format.id != PJMEDIA_FORMAT_PCM) { - param.flags |= PJMEDIA_AUD_DEV_CAP_EXT_FORMAT; - param.ext_fmt = peer_info.format; - } + if (pjsua_var.cap_dev != NULL_SND_DEV_ID) { + pjmedia_aud_param param; + + /* Create parameter based on peer info */ + status = create_aud_param(¶m, pjsua_var.cap_dev, + pjsua_var.play_dev, + peer_info.clock_rate, + peer_info.channel_count, + peer_info.samples_per_frame, + peer_info.bits_per_sample); + if (status != PJ_SUCCESS) { + pjsua_perror(THIS_FILE, "Error opening sound device", status); + return status; + } - status = open_snd_dev(¶m); - if (status != PJ_SUCCESS) { - pjsua_perror(THIS_FILE, "Error opening sound device", status); - return status; + /* And peer format */ + if (peer_info.format.id != PJMEDIA_FORMAT_PCM) { + param.flags |= PJMEDIA_AUD_DEV_CAP_EXT_FORMAT; + param.ext_fmt = peer_info.format; + } + + status = open_snd_dev(¶m); + if (status != PJ_SUCCESS) { + pjsua_perror(THIS_FILE, "Error opening sound device", status); + return status; + } + } else { + /* Null-audio */ + status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); + if (status != PJ_SUCCESS) { + pjsua_perror(THIS_FILE, "Error opening sound device", status); + return status; + } } } |