Commit 19e8af2
[WebAudio] Fix AudioBufferSourceNode start duration loop underflow
The end_frame calculation in AudioBufferSourceHandler::RenderFromBuffer
was incorrectly using the duration argument from start() to constrain
the physical read boundary of the audio buffer even when looping was
enabled. This caused the loop calculation (virtual_delta_frames) to
underflow and evaluate to a negative number, failing internal sanity
checks and causing the audio node to immediately output silence.
This CL fixes the issue by allowing the read boundary (end_frame) to
extend to the full buffer length when looping, and relying on
buffer_played_frames_ to act as the duration stopwatch instead.
Bug: 40910590
Change-Id: I8ac1efd0e5ca97c9287a3bc876e5827e0ac6b698
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7850471
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Commit-Queue: Mahesh Kannan <kmaheshb@google.com>
Cr-Commit-Position: refs/heads/main@{#1632602}1 parent 4c52381 commit 19e8af2
1 file changed
Lines changed: 46 additions & 0 deletions
File tree
- webaudio/the-audio-api/the-audiobuffersourcenode-interface
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments