WebAudio: limit output level to 0db
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2012 15:51:25 +0000 (15:51 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2012 15:51:25 +0000 (15:51 +0000)
commit0e71a295a8947986c63972f1d09dedc6132e5883
tree8b72b5fb030ca39ab1ae7d851de2b375599e6763
parent2e297c5ad567e74110ad381f14c5a1330e048ec9
WebAudio: limit output level to 0db
https://bugs.webkit.org/show_bug.cgi?id=95792
<rdar://problem/11966135>

Reviewed by Chris Rogers.

.:

Add a manual test to determine that output volume has been limited to 0db.

* ManualTests/webaudio/limit-level-0db.html: Added.

Source/WebCore:

Clamp the output buffer data to the range of [-1,1], which limits
output volume to 0db. This ensures that malicious or poorly-written
pages will not be able to blow through the system volume limit by
creating >0db buffers and effects.

No new tests; added ManualTests/webaudio/limit-level-0db.html.

Clamp the output vector to values of [-1,1]:
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::render):

Add a VectorMath wrapper for vDSP_clip to provide accelerated vector threshold operations:
* platform/audio/VectorMath.h:
* platform/audio/VectorMath.cpp:
(VectorMath):
(WebCore::VectorMath::vclip):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ChangeLog
ManualTests/webaudio/limit-level-0db.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/audio/VectorMath.cpp
Source/WebCore/platform/audio/VectorMath.h
Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp