summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@android.com>2013-06-20 15:18:16 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-20 15:18:16 -0700
commit30755ddfd36849a0be87fee5da849f161a45a8a6 (patch)
tree528633c6e06177376f76292888319ed7253328b8 /services/audioflinger
parentb3570568b3f37b3f7018257ece53cbc009b91407 (diff)
parentd3ac2fc0c5429003f69d161e42bba7e94434ec09 (diff)
downloadframeworks_av-30755ddfd36849a0be87fee5da849f161a45a8a6.zip
frameworks_av-30755ddfd36849a0be87fee5da849f161a45a8a6.tar.gz
frameworks_av-30755ddfd36849a0be87fee5da849f161a45a8a6.tar.bz2
am d3ac2fc0: am f3e21c30: am 60f3f102: Merge "Prevent AudioCommands being freed before read"
* commit 'd3ac2fc0c5429003f69d161e42bba7e94434ec09': Prevent AudioCommands being freed before read
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/AudioPolicyService.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 4256fc4..2706880 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -49,6 +49,8 @@ static const char kCmdDeadlockedString[] = "AudioPolicyService command thread ma
static const int kDumpLockRetries = 50;
static const int kDumpLockSleepUs = 20000;
+static const nsecs_t kAudioCommandTimeout = 3000000000; // 3 seconds
+
namespace {
extern struct audio_policy_service_ops aps_ops;
};
@@ -707,7 +709,7 @@ bool AudioPolicyService::AudioCommandThread::threadLoop()
data->mIO);
if (command->mWaitStatus) {
command->mCond.signal();
- mWaitWorkCV.wait(mLock);
+ command->mCond.waitRelative(mLock, kAudioCommandTimeout);
}
delete data;
}break;
@@ -718,7 +720,7 @@ bool AudioPolicyService::AudioCommandThread::threadLoop()
command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs);
if (command->mWaitStatus) {
command->mCond.signal();
- mWaitWorkCV.wait(mLock);
+ command->mCond.waitRelative(mLock, kAudioCommandTimeout);
}
delete data;
}break;
@@ -729,7 +731,7 @@ bool AudioPolicyService::AudioCommandThread::threadLoop()
command->mStatus = AudioSystem::setVoiceVolume(data->mVolume);
if (command->mWaitStatus) {
command->mCond.signal();
- mWaitWorkCV.wait(mLock);
+ command->mCond.waitRelative(mLock, kAudioCommandTimeout);
}
delete data;
}break;
@@ -837,7 +839,7 @@ status_t AudioPolicyService::AudioCommandThread::volumeCommand(audio_stream_type
if (command->mWaitStatus) {
command->mCond.wait(mLock);
status = command->mStatus;
- mWaitWorkCV.signal();
+ command->mCond.signal();
}
return status;
}
@@ -862,7 +864,7 @@ status_t AudioPolicyService::AudioCommandThread::parametersCommand(audio_io_hand
if (command->mWaitStatus) {
command->mCond.wait(mLock);
status = command->mStatus;
- mWaitWorkCV.signal();
+ command->mCond.signal();
}
return status;
}
@@ -883,7 +885,7 @@ status_t AudioPolicyService::AudioCommandThread::voiceVolumeCommand(float volume
if (command->mWaitStatus) {
command->mCond.wait(mLock);
status = command->mStatus;
- mWaitWorkCV.signal();
+ command->mCond.signal();
}
return status;
}