Skip to content

Commit 276fa43

Browse files
author
Eric Laurent
committed
Limit AudioFlinger log.
AudioFlinger logs a warning when a write to the audio HAL takes too long to return. The threshold for this warning is a rule of thumb based on the assumption that the audio HAL will consume buffers at a regular pace. The introduction of low power audio mode with larger buffers and writes occuring in bursts makes that this threshold is often exceeded resulting in excessive and misleading warnings. The threshold is raised to remove unwanted warnings but we should reconsider the usefulness of this warning altogether. Change-Id: I5ef6898ea28d879cede3e47da542a64092a3cca4
1 parent 11116b8 commit 276fa43

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

services/audioflinger/AudioFlinger.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,9 @@ bool AudioFlinger::MixerThread::threadLoop()
18321832
size_t mixBufferSize = mFrameCount * mFrameSize;
18331833
// FIXME: Relaxed timing because of a certain device that can't meet latency
18341834
// Should be reduced to 2x after the vendor fixes the driver issue
1835-
nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 3;
1835+
// increase threshold again due to low power audio mode. The way this warning threshold is
1836+
// calculated and its usefulness should be reconsidered anyway.
1837+
nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
18361838
nsecs_t lastWarning = 0;
18371839
bool longStandbyExit = false;
18381840
uint32_t activeSleepTime = activeSleepTimeUs();
@@ -1886,7 +1888,9 @@ bool AudioFlinger::MixerThread::threadLoop()
18861888
mixBufferSize = mFrameCount * mFrameSize;
18871889
// FIXME: Relaxed timing because of a certain device that can't meet latency
18881890
// Should be reduced to 2x after the vendor fixes the driver issue
1889-
maxPeriod = seconds(mFrameCount) / mSampleRate * 3;
1891+
// increase threshold again due to low power audio mode. The way this warning
1892+
// threshold is calculated and its usefulness should be reconsidered anyway.
1893+
maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
18901894
activeSleepTime = activeSleepTimeUs();
18911895
idleSleepTime = idleSleepTimeUs();
18921896
}
@@ -1983,7 +1987,7 @@ bool AudioFlinger::MixerThread::threadLoop()
19831987
mInWrite = false;
19841988
nsecs_t now = systemTime();
19851989
nsecs_t delta = now - mLastWriteTime;
1986-
if (delta > maxPeriod) {
1990+
if (!mStandby && delta > maxPeriod) {
19871991
mNumDelayedWrites++;
19881992
if ((now - lastWarning) > kWarningThrottle) {
19891993
LOGW("write blocked for %llu msecs, %d delayed writes, thread %p",

0 commit comments

Comments
 (0)