summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2008-08-21 15:04:20 +0000
committerNanang Izzuddin <nanang@teluu.com>2008-08-21 15:04:20 +0000
commitd2ddfe91af3a2642f5ecd9227159600dc65b5e30 (patch)
tree01356f6357b6501abf929f73f5bb359ed4243d2b
parent1946ffa8f43901fb397a2a33ec327ba4c8a66ccc (diff)
Fixed pjsua-lib bug that it failed to connect sound device & conference for some audio_frame_ptime settings (thanks Thomas Ramp).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2229 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index 799c2456..695a7f00 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -2127,20 +2127,22 @@ PJ_DEF(pj_status_t) pjsua_set_snd_dev( int capture_dev,
/* Attempts to open the sound device with different clock rates */
for (i=0; i<PJ_ARRAY_SIZE(clock_rates); ++i) {
char errmsg[PJ_ERR_MSG_SIZE];
- unsigned fps;
+ unsigned samples_per_frame;
PJ_LOG(4,(THIS_FILE,
"pjsua_set_snd_dev(): attempting to open devices "
"@%d Hz", clock_rates[i]));
+ samples_per_frame = clock_rates[i] *
+ pjsua_var.media_cfg.audio_frame_ptime *
+ pjsua_var.media_cfg.channel_count / 1000;
+
/* Create the sound device. Sound port will start immediately. */
- fps = 1000 / pjsua_var.media_cfg.audio_frame_ptime;
status = pjmedia_snd_port_create(pjsua_var.snd_pool, capture_dev,
playback_dev,
clock_rates[i],
pjsua_var.media_cfg.channel_count,
- clock_rates[i]/fps *
- pjsua_var.media_cfg.channel_count,
+ samples_per_frame,
16, 0, &pjsua_var.snd_port);
if (status == PJ_SUCCESS) {