-
Use ceiling divide logic in `AudioTrackPositionTracker.hasPendingData` · 504020a7
This fixes a bug with playing very short audio files, introduced by https://github.com/google/ExoPlayer/commit/fe710871aad3e4e6b4e0798f1cf762d5ecfebedb 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: androidx/media#538 PiperOrigin-RevId: 554481782 (cherry picked from commit a9a2451ccbd08649da20936407076681fe3ad40f)
ibaker committed
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| src | Loading commit data... | |
| README.md | Loading commit data... | |
| build.gradle | Loading commit data... | |
| proguard-rules.txt | Loading commit data... |