Bug 1708179 throw when attempting to set AudioParam value during setValueCurveAtTime() interval r=padenot,emilio

Depends on D113938

Differential Revision: https://phabricator.services.mozilla.com/D113939
This commit is contained in:
Karl Tomlinson 2021-05-04 03:48:32 +00:00
Родитель f2c39b5980
Коммит a6be19d968
4 изменённых файлов: 27 добавлений и 16 удалений

Просмотреть файл

@ -72,14 +72,10 @@ class AudioParam final : public nsWrapperCache, public AudioParamTimeline {
SendEventToEngine(event);
}
void SetValue(float aValue) {
void SetValue(float aValue, ErrorResult& aRv) {
AudioTimelineEvent event(AudioTimelineEvent::SetValue, 0.0f, aValue);
ErrorResult rv;
if (!ValidateEvent(event, rv)) {
MOZ_ASSERT(false,
"This should not happen, "
"setting the value should always work");
if (!ValidateEvent(event, aRv)) {
return;
}

Просмотреть файл

@ -67,26 +67,38 @@ class PannerNode final : public AudioNode {
SendInt32ParameterToTrack(DISTANCE_MODEL, int32_t(mDistanceModel));
}
void SetPosition(double aX, double aY, double aZ) {
void SetPosition(double aX, double aY, double aZ, ErrorResult& aRv) {
if (fabs(aX) > std::numeric_limits<float>::max() ||
fabs(aY) > std::numeric_limits<float>::max() ||
fabs(aZ) > std::numeric_limits<float>::max()) {
return;
}
mPositionX->SetValue(aX);
mPositionY->SetValue(aY);
mPositionZ->SetValue(aZ);
mPositionX->SetValue(aX, aRv);
if (aRv.Failed()) {
return;
}
mPositionY->SetValue(aY, aRv);
if (aRv.Failed()) {
return;
}
mPositionZ->SetValue(aZ, aRv);
}
void SetOrientation(double aX, double aY, double aZ) {
void SetOrientation(double aX, double aY, double aZ, ErrorResult& aRv) {
if (fabs(aX) > std::numeric_limits<float>::max() ||
fabs(aY) > std::numeric_limits<float>::max() ||
fabs(aZ) > std::numeric_limits<float>::max()) {
return;
}
mOrientationX->SetValue(aX);
mOrientationY->SetValue(aY);
mOrientationZ->SetValue(aZ);
mOrientationX->SetValue(aX, aRv);
if (aRv.Failed()) {
return;
}
mOrientationY->SetValue(aY, aRv);
if (aRv.Failed()) {
return;
}
mOrientationZ->SetValue(aZ, aRv);
}
double RefDistance() const { return mRefDistance; }

Просмотреть файл

@ -4,7 +4,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/
* https://webaudio.github.io/web-audio-api/#enumdef-automationrate
* https://webaudio.github.io/web-audio-api/#audioparam
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
@ -18,7 +19,7 @@ enum AutomationRate {
[Pref="dom.webaudio.enabled",
Exposed=Window]
interface AudioParam {
[SetterThrows]
attribute float value;
readonly attribute float defaultValue;
readonly attribute float minValue;

Просмотреть файл

@ -48,7 +48,9 @@ interface PannerNode : AudioNode {
attribute PanningModelType panningModel;
// Uses a 3D cartesian coordinate system
[Throws]
void setPosition(double x, double y, double z);
[Throws]
void setOrientation(double x, double y, double z);
// Cartesian coordinate for position