diff options
author | Andy Hung <hunga@google.com> | 2015-01-07 12:45:13 -0800 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2015-01-07 17:38:55 -0800 |
commit | 2d85f097d653b21d1ff2c34f0b732c674d20ccc2 (patch) | |
tree | 84f26969648aeb0a1eb389e6b1c040ddf4957d55 /media/libmedia | |
parent | 3c09c78aabcb9d314dfb400258fb99a37c7b50c9 (diff) | |
download | frameworks_av-2d85f097d653b21d1ff2c34f0b732c674d20ccc2.zip frameworks_av-2d85f097d653b21d1ff2c34f0b732c674d20ccc2.tar.gz frameworks_av-2d85f097d653b21d1ff2c34f0b732c674d20ccc2.tar.bz2 |
Fix cumulative error in setPositionNotificationPeriod
Time for AudioTrackThread sleep due to periodic notification
needs to be computed from actual position.
External reported AOSP issue 65807.
Change-Id: Ic46b64588e6c5803afcd8252cde8837eb3fbf6ff
Diffstat (limited to 'media/libmedia')
-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. |