summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-03-17 18:57:48 -0700
committerEric Laurent <elaurent@google.com>2011-03-17 19:03:39 -0700
commit91454d3e99242cca70a6aee1bc6324c3da734bf6 (patch)
treee840dc0195b3e19206a153eaf51159c79e8c170d /libaudio
parentd2d93baf949656f56a3483439d92b52cdb0a66d0 (diff)
downloaddevice_samsung_crespo-91454d3e99242cca70a6aee1bc6324c3da734bf6.zip
device_samsung_crespo-91454d3e99242cca70a6aee1bc6324c3da734bf6.tar.gz
device_samsung_crespo-91454d3e99242cca70a6aee1bc6324c3da734bf6.tar.bz2
Fix issue 4126225: setMicMute() execution time
The cause is that the thread executing setMicMute() can wait for several seconds before acquiring the input thread mutex when audio capture is active. The fix consists in forcing a sleep of the capture thread when standby() (called by setMicMute()) wants the mutex. Applied the same fix to output stream and to setParameters() function. Change-Id: I3e55670d2aad16b67d44ca8582ed16398143ff6e
Diffstat (limited to 'libaudio')
-rw-r--r--libaudio/AudioHardware.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index 753c413..2ac7b67 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -1129,12 +1129,16 @@ status_t AudioHardware::AudioStreamOutALSA::standby()
{
if (mHardware == NULL) return NO_INIT;
- AutoMutex lock(mLock);
+ mSleepReq = true;
+ {
+ AutoMutex lock(mLock);
+ mSleepReq = false;
- { // scope for the AudioHardware lock
- AutoMutex hwLock(mHardware->lock());
+ { // scope for the AudioHardware lock
+ AutoMutex hwLock(mHardware->lock());
- doStandby_l();
+ doStandby_l();
+ }
}
return NO_ERROR;
@@ -1246,9 +1250,10 @@ status_t AudioHardware::AudioStreamOutALSA::setParameters(const String8& keyValu
if (mHardware == NULL) return NO_INIT;
+ mSleepReq = true;
{
AutoMutex lock(mLock);
-
+ mSleepReq = false;
if (param.getInt(String8(AudioParameter::keyRouting), device) == NO_ERROR)
{
if (device != 0) {
@@ -1496,12 +1501,16 @@ status_t AudioHardware::AudioStreamInALSA::standby()
{
if (mHardware == NULL) return NO_INIT;
- AutoMutex lock(mLock);
+ mSleepReq = true;
+ {
+ AutoMutex lock(mLock);
+ mSleepReq = false;
- { // scope for AudioHardware lock
- AutoMutex hwLock(mHardware->lock());
+ { // scope for AudioHardware lock
+ AutoMutex hwLock(mHardware->lock());
- doStandby_l();
+ doStandby_l();
+ }
}
return NO_ERROR;
}
@@ -1633,8 +1642,10 @@ status_t AudioHardware::AudioStreamInALSA::setParameters(const String8& keyValue
if (mHardware == NULL) return NO_INIT;
+ mSleepReq = true;
{
AutoMutex lock(mLock);
+ mSleepReq = false;
if (param.getInt(String8(AudioParameter::keyInputSource), value) == NO_ERROR) {
AutoMutex hwLock(mHardware->lock());