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
commit9f6530f53ae9eda43f4e7c1cb30d2379db00aa00 (patch)
tree663430f29fec8c038ad2770e2640c9480c0e2251 /media/libmedia/AudioSystem.cpp
parentd2824a9a392e02a09929a34f0a3dad41ac1faacf (diff)
downloadframeworks_av-9f6530f53ae9eda43f4e7c1cb30d2379db00aa00.zip
frameworks_av-9f6530f53ae9eda43f4e7c1cb30d2379db00aa00.tar.gz
frameworks_av-9f6530f53ae9eda43f4e7c1cb30d2379db00aa00.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) {