diff options
author | Simon Wilson <simonwilson@google.com> | 2011-10-06 15:33:55 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-10-06 19:18:31 -0700 |
commit | 75e0792b8fe2c6c90c4ab9a1793f8ba845e9fa4d (patch) | |
tree | 19bea04bbf952361ad85db61fc901a84ef4602ed /audio | |
parent | 23d17844b14e26bb3e1163119da5fa7b44cc8a42 (diff) | |
download | device_samsung_tuna-75e0792b8fe2c6c90c4ab9a1793f8ba845e9fa4d.zip device_samsung_tuna-75e0792b8fe2c6c90c4ab9a1793f8ba845e9fa4d.tar.gz device_samsung_tuna-75e0792b8fe2c6c90c4ab9a1793f8ba845e9fa4d.tar.bz2 |
audio: add locks, only tear down PCMs when needed for WB AMR
Change-Id: I03ba325b613aef21dba8d16187aaccca08d2a328
Diffstat (limited to 'audio')
-rwxr-xr-x | audio/audio_hw.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index e70f767..e954fbe 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -623,13 +623,18 @@ static void end_call(struct tuna_audio_device *adev) void audio_set_wb_amr_callback(void *data, int enable) { struct tuna_audio_device *adev = (struct tuna_audio_device *)data; - adev->wb_amr = enable; - /* reopen the modem PCMs at the new rate */ - if (adev->in_call) { - end_call(adev); - start_call(adev); + pthread_mutex_lock(&adev->lock); + if (adev->wb_amr != enable) { + adev->wb_amr = enable; + + /* reopen the modem PCMs at the new rate */ + if (adev->in_call) { + end_call(adev); + start_call(adev); + } } + pthread_mutex_unlock(&adev->lock); } static void set_incall_device(struct tuna_audio_device *adev) |