summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-09-19 14:37:46 -0700
committerEric Laurent <elaurent@google.com>2013-09-19 15:53:20 -0700
commitede6c3b8b1147bc425f7b923882f559a513fe23b (patch)
treeac3986f0521aa4a5af705299ab423ec9d5e98bfa /services/audioflinger/Threads.h
parent5baf2af52cd186633b7173196c1e4a4cd3435f22 (diff)
downloadframeworks_av-ede6c3b8b1147bc425f7b923882f559a513fe23b.zip
frameworks_av-ede6c3b8b1147bc425f7b923882f559a513fe23b.tar.gz
frameworks_av-ede6c3b8b1147bc425f7b923882f559a513fe23b.tar.bz2
audioflinger: fix lost offload thread resume event
It was possible that a resume request signaled by addTrack_l() while waiting for an async write callback is lost. This is because mSignalPending was not set and waitingAsyncCallback_l() would pause the thread loop before executing prepareTracks_l(). The fix consists in using signal_l() method to wake the thread loop o that mSignalPending is set. Also make sure that sleepTime is reset to 0 when resuming to make sure that we write any remaining bytes to the HAL. Bug: 10810347. Change-Id: If9a3b22cc3b9e6eb384a56c48c40e6258d0896ad
Diffstat (limited to 'services/audioflinger/Threads.h')
-rw-r--r--services/audioflinger/Threads.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 3fe470c..b3d88e3 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -526,7 +526,7 @@ private:
status_t addTrack_l(const sp<Track>& track);
bool destroyTrack_l(const sp<Track>& track);
void removeTrack_l(const sp<Track>& track);
- void signal_l();
+ void broadcast_l();
void readOutputParameters();
@@ -590,6 +590,8 @@ private:
// Bit 0 is reset by the async callback thread calling resetDraining(). Out of sequence
// callbacks are ignored.
uint32_t mDrainSequence;
+ // A condition that must be evaluated by prepareTrack_l() has changed and we must not wait
+ // for async write callback in the thread loop before evaluating it
bool mSignalPending;
sp<AsyncCallbackThread> mCallbackThread;