diff options
author | Andy Hung <hunga@google.com> | 2015-01-14 22:57:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-01-14 22:57:13 +0000 |
commit | dafbdeeb75856965de07aa64c405b518e9cdf373 (patch) | |
tree | 8bdd0bf815c10b2b38049f71b4c6771b969a3122 /media | |
parent | 7da74b31df9170ed8689841328b74b2162966de5 (diff) | |
parent | 2d85f097d653b21d1ff2c34f0b732c674d20ccc2 (diff) | |
download | frameworks_av-dafbdeeb75856965de07aa64c405b518e9cdf373.zip frameworks_av-dafbdeeb75856965de07aa64c405b518e9cdf373.tar.gz frameworks_av-dafbdeeb75856965de07aa64c405b518e9cdf373.tar.bz2 |
Merge "Fix cumulative error in setPositionNotificationPeriod"
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index ca36143..99750bd 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1746,10 +1746,11 @@ nsecs_t AudioTrack::processAudioBuffer() minFrames = markerPosition - position; } if (loopPeriod > 0 && loopPeriod < minFrames) { + // loopPeriod is already adjusted for actual position. minFrames = loopPeriod; } - if (updatePeriod > 0 && updatePeriod < minFrames) { - minFrames = updatePeriod; + if (updatePeriod > 0) { + minFrames = min(minFrames, uint32_t(newPosition - position)); } // If > 0, poll periodically to recover from a stuck server. A good value is 2. |