Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6ee8c6bb887e95f6523846509a7824c2eeabbcc5
https://github.com/WebKit/WebKit/commit/6ee8c6bb887e95f6523846509a7824c2eeabbcc5
Author: Chris Dumez <[email protected]>
Date: 2026-06-04 (Thu, 04 Jun 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-non-finite-distance-params-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-non-finite-distance-params.html
M Source/WebCore/platform/audio/Distance.cpp
Log Message:
-----------
PannerNode produces non-finite samples for edge-case distance parameters
https://bugs.webkit.org/show_bug.cgi?id=316174
Reviewed by Eric Carlson.
The Web Audio specification permits configurations that make the distance
gain formulas degenerate:
- Linear model with refDistance == maxDistance: divides by zero in
1 - rolloff * (d - ref) / (max - ref).
- Inverse and exponential models with refDistance == 0 and distance == 0:
divide by zero in ref / (ref + ...) and pow(d / ref, ...) respectively.
These produced NaN / Inf gains that propagated into the rendered audio.
Guard the formulas by returning the well-defined limit:
- linearGain() returns 1 - rolloffFactor when refDistance == maxDistance.
- inverseGain() and exponentialGain() apply the spec-mandated
std::max(distance, refDistance) clamping inline (matching Gecko) so the
only remaining division by zero is when both refDistance and distance
are 0; that case returns 0.
Test:
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-non-finite-distance-params.html
This test is passing in Chrome and Firefox, but failing in shipping Safari.
*
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-non-finite-distance-params-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-non-finite-distance-params.html:
Added.
* Source/WebCore/platform/audio/Distance.cpp:
(WebCore::DistanceEffect::linearGain const):
(WebCore::DistanceEffect::inverseGain const):
(WebCore::DistanceEffect::exponentialGain const):
Canonical link: https://commits.webkit.org/314608@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications