Fix issue 2363154: Speech synthesis fails to start over A2DP after media server process crash.
The problem is that after a media_server crash, the value of the A2DP output handle can change.
As this value is cached in AudioSystem for all client processes there can be a mismatch between the cached
and actual value after a media_server restart.
The fix consists in clearing the cached output handles and output to stream map values cached
in AudioSystem in AudioFlingerClient::binderDied() which is called when the media_server crashes.
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 5352234..e1b1776 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -348,6 +348,9 @@
Mutex::Autolock _l(AudioSystem::gLock);
AudioSystem::gAudioFlinger.clear();
+ // clear output handles and stream to output map caches
+ AudioSystem::gStreamOutputMap.clear();
+ AudioSystem::gOutputs.clear();
if (gAudioErrorCallback) {
gAudioErrorCallback(DEAD_OBJECT);