summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2015-05-12 17:40:16 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-12 17:40:18 +0000
commit69dce3343ffe33d2ba60ab4c6755953a7ec96899 (patch)
tree71e7ceb677e83c6496e4d87bc578d3203858e1b9 /services/audioflinger/Threads.cpp
parentd0e25a2529584b07e4fe3544f973c6b0ebda7fc3 (diff)
parent078538cfc6c4682889ed52de460d29c0d15bb9eb (diff)
downloadframeworks_av-69dce3343ffe33d2ba60ab4c6755953a7ec96899.zip
frameworks_av-69dce3343ffe33d2ba60ab4c6755953a7ec96899.tar.gz
frameworks_av-69dce3343ffe33d2ba60ab4c6755953a7ec96899.tar.bz2
Merge "Work around bug in offload driver" into mnc-dev
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r--services/audioflinger/Threads.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index e7fbc08..2722d32 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2679,13 +2679,23 @@ bool AudioFlinger::PlaybackThread::threadLoop()
if (exitPending()) {
break;
}
- releaseWakeLock_l();
+ bool released = false;
+ // The following works around a bug in the offload driver. Ideally we would release
+ // the wake lock every time, but that causes the last offload buffer(s) to be
+ // dropped while the device is on battery, so we need to hold a wake lock during
+ // the drain phase.
+ if (mBytesRemaining && !(mDrainSequence & 1)) {
+ releaseWakeLock_l();
+ released = true;
+ }
mWakeLockUids.clear();
mActiveTracksGeneration++;
ALOGV("wait async completion");
mWaitWorkCV.wait(mLock);
ALOGV("async completion/wake");
- acquireWakeLock_l();
+ if (released) {
+ acquireWakeLock_l();
+ }
standbyTime = systemTime() + standbyDelay;
sleepTime = 0;