summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioSystem.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-08-30 10:18:54 -0700
committerEric Laurent <elaurent@google.com>2011-08-30 10:19:38 -0700
commit05ce0941649c3cdd7f8034496719e607977fc005 (patch)
tree1e507788895e36bcd18b37cd109ec90e7c46d90c /media/libmedia/AudioSystem.cpp
parent2c5423da4e3b23c0381952da2671f05a7501f9af (diff)
downloadframeworks_base-05ce0941649c3cdd7f8034496719e607977fc005.zip
frameworks_base-05ce0941649c3cdd7f8034496719e607977fc005.tar.gz
frameworks_base-05ce0941649c3cdd7f8034496719e607977fc005.tar.bz2
226483: A2DP connected, but music out to speaker
When the A2DP headset is connected, there is a possible race condition when the audio tracks are moved from the mixer thread attached to the speaker output to the thread attached to A2DP output. As the request to clear the stream type to output mapping cache in the client process is asynchronous, it is possible that the flag indicating to the client audio track to re-create the IAudioTrack on the new thread is processed before the cache is invalidated. In this case, the track will be attached to the old thread and music will continue playing over the device speaker instead of being redirected to A2DP headset. Change-Id: Ib2ce1eb5320eaff83287b93779061bf4e7a330df
Diffstat (limited to 'media/libmedia/AudioSystem.cpp')
-rw-r--r--media/libmedia/AudioSystem.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index bb91fa9..853a5f6 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -727,6 +727,14 @@ status_t AudioSystem::isStreamActive(int stream, bool* state, uint32_t inPastMs)
}
+void AudioSystem::clearAudioConfigCache()
+{
+ Mutex::Autolock _l(gLock);
+ LOGV("clearAudioConfigCache()");
+ gStreamOutputMap.clear();
+ gOutputs.clear();
+}
+
// ---------------------------------------------------------------------------
void AudioSystem::AudioPolicyServiceClient::binderDied(const wp<IBinder>& who) {