summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-07-25 17:23:38 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-25 17:23:38 -0700
commita8377945c249394e51d2ce699c428fcf66bcbb0d (patch)
tree5222d9fe03c0967bd17252f343241f4dc0d0e78d
parent014ecfe82c8a1ab7176bbb13c9b8a710c66b0f60 (diff)
parentd974bd3937a1115473c89b1f084a12a4ecf3f988 (diff)
downloaddevice_samsung_tuna-a8377945c249394e51d2ce699c428fcf66bcbb0d.zip
device_samsung_tuna-a8377945c249394e51d2ce699c428fcf66bcbb0d.tar.gz
device_samsung_tuna-a8377945c249394e51d2ce699c428fcf66bcbb0d.tar.bz2
Merge "audio: add missing locks"
-rw-r--r--audio/audio_hw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index a9a5be7..4eac118 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -730,6 +730,7 @@ static int start_input_stream(struct tuna_stream_in *in)
* Also check how capture is possible during voice calls or if both use cases are mutually
* exclusive.
*/
+ pthread_mutex_lock(&adev->lock);
if (in->port == PORT_VX)
set_route_by_array(adev->mixer, vx_ul_amic, 1);
else
@@ -737,6 +738,7 @@ static int start_input_stream(struct tuna_stream_in *in)
mixer_ctl_set_enum_by_string(adev->mixer_ctls.left_capture,
MIXER_MAIN_MIC);
+ pthread_mutex_unlock(&adev->lock);
/* this assumes routing is done previously */
in->pcm = pcm_open(0, in->port, PCM_IN, &in->config);
@@ -1265,6 +1267,7 @@ static int adev_open(const hw_module_t* module, const char* name,
}
/* Set the default route before the PCM stream is opened */
+ pthread_mutex_lock(&adev->lock);
set_route_by_array(adev->mixer, defaults, 1);
adev->mode = AUDIO_MODE_NORMAL;
adev->out_device = AUDIO_DEVICE_OUT_SPEAKER;
@@ -1276,6 +1279,7 @@ static int adev_open(const hw_module_t* module, const char* name,
/* RIL */
ril_open(&adev->ril);
+ pthread_mutex_unlock(&adev->lock);
*device = &adev->device.common;