summaryrefslogtreecommitdiffstats
path: root/include/private/media
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-11-11 12:17:22 -0800
committerAndy Hung <hunga@google.com>2014-11-18 17:15:51 -0800
commitcb2129b3b568a4e31bcbda3545a468024bc972fe (patch)
tree87f7c1114770b59e3a6166e7adbb3bcdea8601d2 /include/private/media
parent97e6ca1a0be83e420ab238d9a1c31d3112126646 (diff)
downloadframeworks_av-cb2129b3b568a4e31bcbda3545a468024bc972fe.zip
frameworks_av-cb2129b3b568a4e31bcbda3545a468024bc972fe.tar.gz
frameworks_av-cb2129b3b568a4e31bcbda3545a468024bc972fe.tar.bz2
Fix missing loop count for static tracks.
StaticAudioTrackServerProxy::framesReady() previously returned only the contiguous frames, update to return the total available frames. This resolves short-count looping in SoundPool for FastTracks. Also (1) Removes the racy condition of reading two variables and (2) Fixes buffer->mNonContig to return the correct value and (3) Restores behavior that loop count of 1 goes back to loopStart once during playback. Bug: 11830751 Bug: 12070295 Bug: 17456842 Change-Id: I64906e6036bb00a1d7375b03efe6deb69d6478ca
Diffstat (limited to 'include/private/media')
-rw-r--r--include/private/media/AudioTrackShared.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index fa1b20a..31dff36 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -450,7 +450,14 @@ private:
ssize_t pollPosition(); // poll for state queue update, and return current position
StaticAudioTrackSingleStateQueue::Observer mObserver;
size_t mPosition; // server's current play position in frames, relative to 0
- size_t mEnd; // cached value computed from mState, safe for asynchronous read
+
+ size_t mFramesReadySafe; // Assuming size_t read/writes are atomic on 32 / 64 bit
+ // processors, this is a thread-safe version of
+ // mFramesReady.
+ int64_t mFramesReady; // The number of frames ready in the static buffer
+ // including loops. This is 64 bits since loop mode
+ // can cause a track to appear to have a large number
+ // of frames. INT64_MAX means an infinite loop.
bool mFramesReadyIsCalledByMultipleThreads;
StaticAudioTrackState mState;
};