Commit 8e14e369 authored by Raymond Toy's avatar Raymond Toy Committed by Commit Bot

Clamp AudioParams with inputs to nominal range

The values of an AudioParam are supposed to be clamped to the nominal
range.  We do this already, but we forgot the case where there is a
connection to the AudioParam.  This can cause the values to go outside
the nominal range and cause issues for the nodes that expected the
values to be clamped appropriately.

Manually tested ASAN build with this CL and crashes don't happen
anymore.  Without this, the crash was very reliable.

Bug: 1015737, 1016165
Change-Id: Ia02bac7b60a7e20bdc5165dbfbb17df56d4d3171
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869373
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707818}
parent 786a9194
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/modules/webaudio/audio_node.h" #include "third_party/blink/renderer/modules/webaudio/audio_node.h"
#include "third_party/blink/renderer/modules/webaudio/audio_node_output.h" #include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
#include "third_party/blink/renderer/platform/audio/audio_utilities.h" #include "third_party/blink/renderer/platform/audio/audio_utilities.h"
#include "third_party/blink/renderer/platform/audio/vector_math.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h"
...@@ -283,6 +284,13 @@ void AudioParamHandler::CalculateFinalValues(float* values, ...@@ -283,6 +284,13 @@ void AudioParamHandler::CalculateFinalValues(float* values,
// Sum, with unity-gain. // Sum, with unity-gain.
summing_bus_->SumFrom(*connection_bus); summing_bus_->SumFrom(*connection_bus);
} }
// Clamp the values now to the nominal range
float min_value = MinValue();
float max_value = MaxValue();
vector_math::Vclip(values, 1, &min_value, &max_value, values, 1,
number_of_values);
} }
} }
......
...@@ -72,4 +72,3 @@ crbug.com/896068 [ Linux ] webaudio/dom-exceptions.html [ Pass Crash ] ...@@ -72,4 +72,3 @@ crbug.com/896068 [ Linux ] webaudio/dom-exceptions.html [ Pass Crash ]
# Sheriff 2019-07-31 # Sheriff 2019-07-31
crbug.com/989365 [ Linux ] external/wpt/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html [ Pass Timeout ] crbug.com/989365 [ Linux ] external/wpt/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html [ Pass Timeout ]
crbug.com/1015737 [ Linux ] external/wpt/webaudio/the-audio-api/the-delaynode-interface/no-dezippering.html [ Crash ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment