Fix lockup in audio flinger threadbase setParameters.
The function checkForNewParameters_l() is called with the ThreadBase mutex mLock locked. In the case where the parameter change implies
an audio parameter modification (e.g. sampling rate) the function sendConfigEvent() is called which tries to lock mLock creating a deadlock.
The fix consists in creating a function equivalent to sendConfigEvent() that must be called with mLock locked and does not lock mLock.
Also added the possibility to have more than one set parameter request pending.
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index 4a4b823..c9f3448 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -318,6 +318,7 @@
virtual String8 getParameters(const String8& keys) = 0;
virtual void audioConfigChanged(int event, int param = 0) = 0;
void sendConfigEvent(int event, int param = 0);
+ void sendConfigEvent_l(int event, int param = 0);
void processConfigEvents();
mutable Mutex mLock;
@@ -341,7 +342,7 @@
int mFormat;
uint32_t mFrameSize;
Condition mParamCond;
- String8 mNewParameters;
+ Vector<String8> mNewParameters;
status_t mParamStatus;
Vector<ConfigEvent *> mConfigEvents;
bool mStandby;