summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-06-15 14:49:21 -0700
committerEric Laurent <elaurent@google.com>2012-06-19 08:34:32 -0700
commit996da01c08a2d168f13d63032de91f9ac21e4cd0 (patch)
tree89314709da3913722f1b5651420f0e6be3dccd92 /audio
parentb99741857c507a12b064571243d45b8212b2e2fc (diff)
downloaddevice_samsung_tuna-996da01c08a2d168f13d63032de91f9ac21e4cd0.zip
device_samsung_tuna-996da01c08a2d168f13d63032de91f9ac21e4cd0.tar.gz
device_samsung_tuna-996da01c08a2d168f13d63032de91f9ac21e4cd0.tar.bz2
audio: acquire lock in adev_set_voice_volume()
Acquire the audio device mutex before calling into ril library in adev_set_voice_volume() to avoid concurrency with other calls to ril from select_mode() or set_incall_device(). Bug 6626532. Change-Id: I2347477b39ce46137a654047266b70dd691c021c
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 74f2383..d377f2b 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -1142,7 +1142,7 @@ static void select_mode(struct tuna_audio_device *adev)
adev->devices &= ~AUDIO_DEVICE_OUT_SPEAKER;
select_output_device(adev);
start_call(adev);
- adev_set_voice_volume(&adev->hw_device, adev->voice_volume);
+ ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, adev->voice_volume);
adev->in_call = 1;
}
} else {
@@ -3408,11 +3408,13 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
{
struct tuna_audio_device *adev = (struct tuna_audio_device *)dev;
+ pthread_mutex_lock(&adev->lock);
adev->voice_volume = volume;
if (adev->mode == AUDIO_MODE_IN_CALL)
ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, volume);
+ pthread_mutex_unlock(&adev->lock);
return 0;
}