summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-07-24 17:45:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-07-24 17:45:09 +0000
commit9f00e69c5f2702b66e9bdf8f4f75f99a338738d7 (patch)
treec58d6491de029480251a67f20a737f21c336505d /media
parent63310b10c5834f92164a96ea2ad4ad8ab1e309ec (diff)
parenta8d0890ca969ec40fdcf1cfcbeef85c0c379cfaf (diff)
downloadframeworks_av-9f00e69c5f2702b66e9bdf8f4f75f99a338738d7.zip
frameworks_av-9f00e69c5f2702b66e9bdf8f4f75f99a338738d7.tar.gz
frameworks_av-9f00e69c5f2702b66e9bdf8f4f75f99a338738d7.tar.bz2
Merge "Fix race condition in AudioTrackThread::wake" into mnc-dev
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioTrack.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index ab720c6..9b40d45 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -2551,11 +2551,15 @@ void AudioTrack::AudioTrackThread::resume()
void AudioTrack::AudioTrackThread::wake()
{
AutoMutex _l(mMyLock);
- if (!mPaused && mPausedInt && mPausedNs > 0) {
- // audio track is active and internally paused with timeout.
+ if (!mPaused) {
+ // wake() might be called while servicing a callback - ignore the next
+ // pause time and call processAudioBuffer.
mIgnoreNextPausedInt = true;
- mPausedInt = false;
- mMyCond.signal();
+ if (mPausedInt && mPausedNs > 0) {
+ // audio track is active and internally paused with timeout.
+ mPausedInt = false;
+ mMyCond.signal();
+ }
}
}