-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ceiling divide logic in
AudioTrackPositionTracker.hasPendingData
This fixes a bug with playing very short audio files, introduced by fe71087 The existing code using floor integer division results in playback never transitioning to `STATE_ENDED` because at the end of playback for the short sample clip provided `currentPositionUs=189937`, `outputSampleRate=16000` and `(189937 * 16000) / 1000000 = 3038.992`, while `writtenFrames=3039`. This is fixed by using `Util.ceilDivide` so we return `3039`, which means `AudioTrackPositionTracker.hasPendingData()` returns `false` (since `writtenFrames == durationUsToFrames(getCurrentPositionUs(/* sourceEnded= */ false))`). Issue: #538 PiperOrigin-RevId: 554481782 (cherry picked from commit 6e91f0d)
- Loading branch information
Showing
5 changed files
with
74 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters