diff options
author | Eric Laurent <elaurent@google.com> | 2012-06-15 14:45:03 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2012-06-19 08:35:34 -0700 |
commit | 5f12136299918ea30555f3481668ec0dbb775e5f (patch) | |
tree | 69acc85f312c0bf1577eeccf16e31e0ecd226269 /services | |
parent | 1222bb9d9551cdf84923ea342ca3f4210867bd9a (diff) | |
download | frameworks_av-5f12136299918ea30555f3481668ec0dbb775e5f.zip frameworks_av-5f12136299918ea30555f3481668ec0dbb775e5f.tar.gz frameworks_av-5f12136299918ea30555f3481668ec0dbb775e5f.tar.bz2 |
audio policy: acquire lock for volume functions
Acquire the AudioPolicyService mutex when executing
setStreamVolumeIndex() and getStreamVolumeIndex().
These functions have become more complex and iterate on the
list of opened outputs and it is safer to acquire the
AudioPolicyService mutex to avoid concurrency with other
functions.
Bug 6626532.
Change-Id: Ifdcbbbf13338fd9a59f694d43faa7ade143f94bf
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 0d13970..c32fc6b 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -373,6 +373,7 @@ status_t AudioPolicyService::initStreamVolume(audio_stream_type_t stream, if (uint32_t(stream) >= AUDIO_STREAM_CNT) { return BAD_VALUE; } + Mutex::Autolock _l(mLock); mpAudioPolicy->init_stream_volume(mpAudioPolicy, stream, indexMin, indexMax); return NO_ERROR; } @@ -390,7 +391,7 @@ status_t AudioPolicyService::setStreamVolumeIndex(audio_stream_type_t stream, if (uint32_t(stream) >= AUDIO_STREAM_CNT) { return BAD_VALUE; } - + Mutex::Autolock _l(mLock); if (mpAudioPolicy->set_stream_volume_index_for_device) { return mpAudioPolicy->set_stream_volume_index_for_device(mpAudioPolicy, stream, @@ -411,6 +412,7 @@ status_t AudioPolicyService::getStreamVolumeIndex(audio_stream_type_t stream, if (uint32_t(stream) >= AUDIO_STREAM_CNT) { return BAD_VALUE; } + Mutex::Autolock _l(mLock); if (mpAudioPolicy->get_stream_volume_index_for_device) { return mpAudioPolicy->get_stream_volume_index_for_device(mpAudioPolicy, stream, |