Improve AudioTrack EVENT_LOOP_END and EVENT_BUFFER_END accuracy
Fix timing computation to consider current position.
Fix EVENT_LOOP_END count accuracy (some could be dropped before)
for non-infinite loop static AudioTracks.
Change-Id: I255f692915b55ab6f08ccd6a2365fee3f5d0a4fe
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 0f9df4f..c995bd2 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -736,6 +736,10 @@
int32_t mLoopCount; // last setLoop loopCount; zero means disabled
uint32_t mLoopStart; // last setLoop loopStart
uint32_t mLoopEnd; // last setLoop loopEnd
+ int32_t mLoopCountNotified; // the last loopCount notified by callback.
+ // mLoopCountNotified counts down, matching
+ // the remaining loop count for static track
+ // playback.
// These are private to processAudioBuffer(), and are not protected by a lock
uint32_t mRemainingFrames; // number of frames to request in obtainBuffer()