From 05ce0941649c3cdd7f8034496719e607977fc005 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 30 Aug 2011 10:18:54 -0700 Subject: 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 --- include/media/AudioSystem.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/media') diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index e0d7898..6a15f6e 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -185,6 +185,10 @@ public: static status_t unregisterEffect(int id); static status_t setEffectEnabled(int id, bool enabled); + // clear stream to output mapping cache (gStreamOutputMap) + // and output configuration cache (gOutputs) + static void clearAudioConfigCache(); + static const sp& get_audio_policy_service(); // ---------------------------------------------------------------------------- @@ -236,7 +240,8 @@ private: // mapping between stream types and outputs static DefaultKeyedVector gStreamOutputMap; - // list of output descritor containing cached parameters (sampling rate, framecount, channel count...) + // list of output descriptors containing cached parameters + // (sampling rate, framecount, channel count...) static DefaultKeyedVector gOutputs; }; -- cgit v1.1