diff options
| author | Dave Sparks <davidsparks@android.com> | 2009-09-30 03:09:03 -0700 |
|---|---|---|
| committer | Dave Sparks <davidsparks@android.com> | 2009-09-30 03:09:03 -0700 |
| commit | d0ac8c0879a8ba96d7ac393a2776d168009eccf7 (patch) | |
| tree | e60075f11d2aec915173627dce3a743dee7e588b /libs/audioflinger | |
| parent | 2a35c8d7017e4a9408a3c3b8ef1145df082d6782 (diff) | |
| download | frameworks_base-d0ac8c0879a8ba96d7ac393a2776d168009eccf7.zip frameworks_base-d0ac8c0879a8ba96d7ac393a2776d168009eccf7.tar.gz frameworks_base-d0ac8c0879a8ba96d7ac393a2776d168009eccf7.tar.bz2 | |
Reduce the log spew from AudioFlinger due to a certain device that can't meet latency timing. Bug 2142215.
Diffstat (limited to 'libs/audioflinger')
| -rw-r--r-- | libs/audioflinger/AudioFlinger.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index 6500791..2ed5d3b 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -74,6 +74,8 @@ static const int8_t kMaxTrackStartupRetries = 50; static const int kDumpLockRetries = 50; static const int kDumpLockSleep = 20000; +static const nsecs_t kWarningThrottle = seconds(5); + #define AUDIOFLINGER_SECURITY_ENABLED 1 @@ -1170,7 +1172,10 @@ bool AudioFlinger::MixerThread::threadLoop() size_t enabledTracks = 0; nsecs_t standbyTime = systemTime(); size_t mixBufferSize = mFrameCount * mFrameSize; - nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 2; + // FIXME: Relaxed timing because of a certain device that can't meet latency + // Should be reduced to 2x after the vendor fixes the driver issue + nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 3; + nsecs_t lastWarning = 0; while (!exitPending()) { @@ -1183,7 +1188,9 @@ bool AudioFlinger::MixerThread::threadLoop() if (checkForNewParameters_l()) { mixBufferSize = mFrameCount * mFrameSize; - maxPeriod = seconds(mFrameCount) / mSampleRate * 2; + // FIXME: Relaxed timing because of a certain device that can't meet latency + // Should be reduced to 2x after the vendor fixes the driver issue + maxPeriod = seconds(mFrameCount) / mSampleRate * 3; } const SortedVector< wp<Track> >& activeTracks = mActiveTracks; @@ -1260,10 +1267,15 @@ bool AudioFlinger::MixerThread::threadLoop() mNumWrites++; mInWrite = false; mStandby = false; - nsecs_t delta = systemTime() - mLastWriteTime; + nsecs_t now = systemTime(); + nsecs_t delta = now - mLastWriteTime; if (delta > maxPeriod) { - LOGW("write blocked for %llu msecs, thread %p", ns2ms(delta), this); mNumDelayedWrites++; + if ((now - lastWarning) > kWarningThrottle) { + LOGW("write blocked for %llu msecs, %d delayed writes, thread %p", + ns2ms(delta), mNumDelayedWrites, this); + lastWarning = now; + } } } else { usleep(sleepTime); |
