diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2011-12-20 09:52:19 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2011-12-20 09:52:19 +0000 |
commit | f7f47c2b3b622e5d00faf456b4b7ab10c63a2f49 (patch) | |
tree | 323c39843e9758c467224628d340ca17adc44048 /pjsip/src/pjsua-lib/pjsua_media.c | |
parent | c297f3477e21e31976f417c3b3d50529f6b84b4c (diff) |
Fix #1425:
- Updating port info of the switchboard master port (after reopening audio device) with the audio device param should care about PJMEDIA_AUD_DEV_CAP_EXT_FORMAT flag, i.e: only copy from audio device extended format info when the flag is set.
- Fixed switchboard to update the master port info shortcut in connecting ports, as master port info may get updated to match to the connecting ports.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3915 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_media.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index b6a53642..2f5c0b5b 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -3717,14 +3717,22 @@ static pj_status_t open_snd_dev(pjmedia_snd_port_param *param) * derived from the sound device setting, so update the setting. */ if (pjsua_var.is_mswitch) { - pj_memcpy(&conf_port->info.fmt, ¶m->base.ext_fmt, - sizeof(conf_port->info.fmt)); - conf_port->info.fmt.det.aud.clock_rate = param->base.clock_rate; - conf_port->info.fmt.det.aud.frame_time_usec = param->base.samples_per_frame* - 1000000 / - param->base.clock_rate; - conf_port->info.fmt.det.aud.channel_count = param->base.channel_count; - conf_port->info.fmt.det.aud.bits_per_sample = 16; + if (param->base.flags & PJMEDIA_AUD_DEV_CAP_EXT_FORMAT) { + conf_port->info.fmt = param->base.ext_fmt; + } else { + unsigned bps, ptime_usec; + bps = param->base.clock_rate * param->base.bits_per_sample; + ptime_usec = param->base.samples_per_frame / + param->base.channel_count * 1000000 / + param->base.clock_rate; + pjmedia_format_init_audio(&conf_port->info.fmt, + PJMEDIA_FORMAT_PCM, + param->base.clock_rate, + param->base.channel_count, + param->base.bits_per_sample, + ptime_usec, + bps, bps); + } } |