summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;