Fix race condition in AudioTrackThread::wake

Bug: 22533684
Change-Id: I2f46770dca44fc9dae41e067d3bec893c42a826e
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::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();
+        }
     }
 }