summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Tracks.cpp
diff options
context:
space:
mode:
authorHaynes Mathew George <hgeorge@codeaurora.org>2014-01-15 12:32:55 -0800
committerEric Laurent <elaurent@google.com>2014-02-06 11:48:22 -0800
commit7844f679be8d94c5cdf017f53754cb68ee2f00da (patch)
tree60b91c8d8d95f49d98b1c35110b6f4fe5498cb62 /services/audioflinger/Tracks.cpp
parent0f02f265123b7ef2fd6ac09ff70cde26eb5559ad (diff)
downloadframeworks_av-7844f679be8d94c5cdf017f53754cb68ee2f00da.zip
frameworks_av-7844f679be8d94c5cdf017f53754cb68ee2f00da.tar.gz
frameworks_av-7844f679be8d94c5cdf017f53754cb68ee2f00da.tar.bz2
AudioFlinger: Modify flush handling for offload path
Do not allow an offload track to directly control the offload thread behavior. OffloadThread can check for any pending flush reporting by its active tracks and decide to flush the HW or not. Bug: 12530661 Change-Id: Ib33f023c942f6c091b618004136b153c38a6eef6
Diffstat (limited to 'services/audioflinger/Tracks.cpp')
-rw-r--r--services/audioflinger/Tracks.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index ecedca9..8ffa43e 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -347,7 +347,8 @@ AudioFlinger::PlaybackThread::Track::Track(
mCachedVolume(1.0),
mIsInvalid(false),
mAudioTrackServerProxy(NULL),
- mResumeToStopping(false)
+ mResumeToStopping(false),
+ mFlushHwPending(false)
{
if (mCblk != NULL) {
if (sharedBuffer == 0) {
@@ -731,6 +732,7 @@ void AudioFlinger::PlaybackThread::Track::flush()
mRetryCount = PlaybackThread::kMaxTrackRetriesOffload;
}
+ mFlushHwPending = true;
mResumeToStopping = false;
} else {
if (mState != STOPPING_1 && mState != STOPPING_2 && mState != STOPPED &&
@@ -751,11 +753,19 @@ void AudioFlinger::PlaybackThread::Track::flush()
// Prevent flush being lost if the track is flushed and then resumed
// before mixer thread can run. This is important when offloading
// because the hardware buffer could hold a large amount of audio
- playbackThread->flushOutput_l();
playbackThread->broadcast_l();
}
}
+// must be called with thread lock held
+void AudioFlinger::PlaybackThread::Track::flushAck()
+{
+ if (!isOffloaded())
+ return;
+
+ mFlushHwPending = false;
+}
+
void AudioFlinger::PlaybackThread::Track::reset()
{
// Do not reset twice to avoid discarding data written just after a flush and before