summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-05-17 03:34:35 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-05-17 03:34:35 +0000
commitc1f5b740380508a307ef9b9c348484aa99c7f07e (patch)
tree3d63bbcb11dbe67153e51b328f69e8333c2ec585
parent631890c701cec4c0eb09080b6d49b13a1af123d4 (diff)
Fix #1510: sharing and assertion problem with native ALSA device.
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4125 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/src/pjmedia-audiodev/alsa_dev.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/pjmedia/src/pjmedia-audiodev/alsa_dev.c b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
index 69e10d01..5bcdedf0 100644
--- a/pjmedia/src/pjmedia-audiodev/alsa_dev.c
+++ b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
@@ -547,6 +547,7 @@ static pj_status_t open_playback (struct alsa_stream* stream,
int result;
unsigned int rate;
snd_pcm_uframes_t tmp_buf_size;
+ snd_pcm_uframes_t tmp_period_size;
if (param->play_id < 0 || param->play_id >= stream->af->dev_cnt)
return PJMEDIA_EAUD_INVDEV;
@@ -613,10 +614,11 @@ static pj_status_t open_playback (struct alsa_stream* stream,
param->channel_count;
TRACE_((THIS_FILE, "open_playback: set period size: %d",
stream->pb_frames));
+ tmp_period_size = stream->pb_frames;
snd_pcm_hw_params_set_period_size_near (stream->pb_pcm, params,
- &stream->pb_frames, NULL);
+ &tmp_period_size, NULL);
TRACE_((THIS_FILE, "open_playback: period size set to: %d",
- stream->pb_frames));
+ tmp_period_size));
/* Set the sound device buffer size and latency */
if (param->flags & PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY)
@@ -663,6 +665,7 @@ static pj_status_t open_capture (struct alsa_stream* stream,
int result;
unsigned int rate;
snd_pcm_uframes_t tmp_buf_size;
+ snd_pcm_uframes_t tmp_period_size;
if (param->rec_id < 0 || param->rec_id >= stream->af->dev_cnt)
return PJMEDIA_EAUD_INVDEV;
@@ -729,10 +732,11 @@ static pj_status_t open_capture (struct alsa_stream* stream,
param->channel_count;
TRACE_((THIS_FILE, "open_capture: set period size: %d",
stream->ca_frames));
+ tmp_period_size = stream->ca_frames;
snd_pcm_hw_params_set_period_size_near (stream->ca_pcm, params,
- &stream->ca_frames, NULL);
+ &tmp_period_size, NULL);
TRACE_((THIS_FILE, "open_capture: period size set to: %d",
- stream->ca_frames));
+ tmp_period_size));
/* Set the sound device buffer size and latency */
if (param->flags & PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY)