Merge "Bail out after kMaxColorFormatSupported calls to OMX_GetParameter(). Avoid infinite loop in querying omx component about the supported color format." into ics-mr0
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index ab49f93..3e0304f 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1832,7 +1832,9 @@
     size_t mixBufferSize = mFrameCount * mFrameSize;
     // 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;
+    // increase threshold again due to low power audio mode. The way this warning threshold is
+    // calculated and its usefulness should be reconsidered anyway.
+    nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
     nsecs_t lastWarning = 0;
     bool longStandbyExit = false;
     uint32_t activeSleepTime = activeSleepTimeUs();
@@ -1886,7 +1888,9 @@
                 mixBufferSize = mFrameCount * mFrameSize;
                 // 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;
+                // increase threshold again due to low power audio mode. The way this warning
+                // threshold is calculated and its usefulness should be reconsidered anyway.
+                maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
                 activeSleepTime = activeSleepTimeUs();
                 idleSleepTime = idleSleepTimeUs();
             }
@@ -1983,7 +1987,7 @@
             mInWrite = false;
             nsecs_t now = systemTime();
             nsecs_t delta = now - mLastWriteTime;
-            if (delta > maxPeriod) {
+            if (!mStandby && delta > maxPeriod) {
                 mNumDelayedWrites++;
                 if ((now - lastWarning) > kWarningThrottle) {
                     LOGW("write blocked for %llu msecs, %d delayed writes, thread %p",