summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-12-14 15:40:27 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-12-14 15:40:27 -0800
commite5dfcd8c6792c4b64120fd03708729b70a887f2a (patch)
tree1b6910473934e744ac9c7cd5ce0d06269ab5217f /services
parent738ed42488491b740e73c0cddc2f257af17b638d (diff)
parent7dede876998ff56351d495ec3a798c1b131193e8 (diff)
downloadframeworks_av-e5dfcd8c6792c4b64120fd03708729b70a887f2a.zip
frameworks_av-e5dfcd8c6792c4b64120fd03708729b70a887f2a.tar.gz
frameworks_av-e5dfcd8c6792c4b64120fd03708729b70a887f2a.tar.bz2
Merge "Use units after all times"
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index fd276aa..df550bd 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -80,14 +80,16 @@ static const int8_t kMaxTrackStartupRetries = 50;
static const int8_t kMaxTrackRetriesDirect = 2;
static const int kDumpLockRetries = 50;
-static const int kDumpLockSleep = 20000;
+static const int kDumpLockSleepUs = 20000;
-static const nsecs_t kWarningThrottle = seconds(5);
+// don't warn about blocked writes or record buffer overflows more often than this
+static const nsecs_t kWarningThrottleNs = seconds(5);
// RecordThread loop sleep time upon application overrun or audio HAL read error
static const int kRecordThreadSleepUs = 5000;
-static const nsecs_t kSetParametersTimeout = seconds(2);
+// maximum time to wait for setParameters to complete
+static const nsecs_t kSetParametersTimeoutNs = seconds(2);
// minimum sleep time for the mixer thread loop when tracks are active but in underrun
static const uint32_t kMinThreadSleepTimeUs = 5000;
@@ -320,7 +322,7 @@ static bool tryLock(Mutex& mutex)
locked = true;
break;
}
- usleep(kDumpLockSleep);
+ usleep(kDumpLockSleepUs);
}
return locked;
}
@@ -1043,7 +1045,7 @@ status_t AudioFlinger::ThreadBase::setParameters(const String8& keyValuePairs)
mWaitWorkCV.signal();
// wait condition with timeout in case the thread loop has exited
// before the request could be processed
- if (mParamCond.waitRelative(mLock, kSetParametersTimeout) == NO_ERROR) {
+ if (mParamCond.waitRelative(mLock, kSetParametersTimeoutNs) == NO_ERROR) {
status = mParamStatus;
mWaitWorkCV.signal();
} else {
@@ -2028,7 +2030,7 @@ bool AudioFlinger::MixerThread::threadLoop()
nsecs_t delta = now - mLastWriteTime;
if (!mStandby && delta > maxPeriod) {
mNumDelayedWrites++;
- if ((now - lastWarning) > kWarningThrottle) {
+ if ((now - lastWarning) > kWarningThrottleNs) {
LOGW("write blocked for %llu msecs, %d delayed writes, thread %p",
ns2ms(delta), mNumDelayedWrites, this);
lastWarning = now;
@@ -2414,7 +2416,7 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l()
mParamCond.signal();
// wait for condition with time out in case the thread calling ThreadBase::setParameters()
// already timed out waiting for the status and will never signal the condition.
- mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout);
+ mWaitWorkCV.waitRelative(mLock, kSetParametersTimeoutNs);
}
return reconfig;
}
@@ -2890,7 +2892,7 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameters_l()
mParamCond.signal();
// wait for condition with time out in case the thread calling ThreadBase::setParameters()
// already timed out waiting for the status and will never signal the condition.
- mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout);
+ mWaitWorkCV.waitRelative(mLock, kSetParametersTimeoutNs);
}
return reconfig;
}
@@ -4410,7 +4412,7 @@ bool AudioFlinger::RecordThread::threadLoop()
else {
if (!mActiveTrack->setOverflow()) {
nsecs_t now = systemTime();
- if ((now - lastWarning) > kWarningThrottle) {
+ if ((now - lastWarning) > kWarningThrottleNs) {
LOGW("RecordThread: buffer overflow");
lastWarning = now;
}
@@ -4733,7 +4735,7 @@ bool AudioFlinger::RecordThread::checkForNewParameters_l()
mParamCond.signal();
// wait for condition with time out in case the thread calling ThreadBase::setParameters()
// already timed out waiting for the status and will never signal the condition.
- mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout);
+ mWaitWorkCV.waitRelative(mLock, kSetParametersTimeoutNs);
}
return reconfig;
}