Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 03afbb84134b8c07a976f314fc4a2bf7fd8c7722
      
https://github.com/WebKit/WebKit/commit/03afbb84134b8c07a976f314fc4a2bf7fd8c7722
  Author: Chris Dumez <[email protected]>
  Date:   2026-08-03 (Mon, 03 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-loop-short-duration-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-loop-short-duration.html
    M Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp

  Log Message:
  -----------
  [WPT] Fix 
webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-loop-short-duration.html
https://bugs.webkit.org/show_bug.cgi?id=320865

Reviewed by Darin Adler.

When a looping AudioBufferSourceNode was started with an explicit grain
duration, renderFromBuffer() clamped maxFrame to the grain end
(grainOffset + grainDuration). Intersecting the loop range against that
maxFrame could make virtualMinFrame (loopStart) exceed virtualMaxFrame,
producing a negative virtualDeltaFrames. The subsequent
`abs(pitchRate) > virtualDeltaFrames` sanity check then bailed out and
the node output silence.

The grain-duration limit is already enforced separately via m_endTime
(set in adjustGrainParameters() and honored by updateSchedulingInfo()),
so when looping the read window should be bounded by the loop points, not
by the grain end. Only clamp maxFrame to the grain end for non-looping
grains. This matches the behavior of Blink & Gecko.

Test: 
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-loop-short-duration.html

* 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-loop-short-duration-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-loop-short-duration.html:
 Added.
Import test from upstream WPT.

* Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::renderFromBuffer):

Canonical link: https://commits.webkit.org/318514@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to