diff options
author | Marco Nelissen <marcone@google.com> | 2015-05-12 09:17:57 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2015-05-12 10:35:39 -0700 |
commit | 078538cfc6c4682889ed52de460d29c0d15bb9eb (patch) | |
tree | 80c1fcdd039f5ab2481f6fb93077176d6d9331d8 /services/audioflinger/Threads.cpp | |
parent | 3af8a321d06b3ee59afe159479c58e6b549c7b8f (diff) | |
download | frameworks_av-078538cfc6c4682889ed52de460d29c0d15bb9eb.zip frameworks_av-078538cfc6c4682889ed52de460d29c0d15bb9eb.tar.gz frameworks_av-078538cfc6c4682889ed52de460d29c0d15bb9eb.tar.bz2 |
Work around bug in offload driver
There is a bug in the offload driver that causes the last offload buffer(s)
to be dropped unless the device is on power or holding a wake lock.
To avoid truncated playback, we now hold a wake lock during the drain phase
of offloaded playback.
Bug: 19928717
Change-Id: I8df22e965ec791448aa5d9b74e743f48ef886fc4
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r-- | services/audioflinger/Threads.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 2c4d801..e02c79f 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; |