From 787aa597d497ffd3019fb64c244a1e944a5f8453 Mon Sep 17 00:00:00 2001
From: Eric Laurent <elaurent@google.com>
Date: Mon, 25 Jan 2010 10:27:15 -0800
Subject: 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.
---
 media/libmedia/AudioSystem.cpp | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'media')

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 @@ void AudioSystem::AudioFlingerClient::binderDied(const wp<IBinder>& who) {
     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);
-- 
cgit v1.1