From 7ee42e4223dc970aeffc56ecddec2738c8340f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 7 Nov 2017 20:57:30 +0100 Subject: [PATCH 01/87] Initial WebAudio API stubs --- components/script/dom/audiocontext.rs | 81 +++++++++ components/script/dom/audiodestinationnode.rs | 41 +++++ components/script/dom/audionode.rs | 166 ++++++++++++++++++ components/script/dom/audioparam.rs | 66 +++++++ .../script/dom/audioscheduledsourcenode.rs | 38 ++++ components/script/dom/baseaudiocontext.rs | 79 +++++++++ components/script/dom/mod.rs | 8 + components/script/dom/oscillatornode.rs | 81 +++++++++ components/script/dom/periodicwave.rs | 40 +++++ .../script/dom/webidls/AudioContext.webidl | 40 +++++ .../dom/webidls/AudioDestinationNode.webidl | 12 ++ .../script/dom/webidls/AudioNode.webidl | 61 +++++++ .../script/dom/webidls/AudioParam.webidl | 26 +++ .../webidls/AudioScheduledSourceNode.webidl | 14 ++ .../dom/webidls/BaseAudioContext.webidl | 55 ++++++ .../script/dom/webidls/OscillatorNode.webidl | 34 ++++ .../script/dom/webidls/PeriodicWave.webidl | 21 +++ 17 files changed, 863 insertions(+) create mode 100644 components/script/dom/audiocontext.rs create mode 100644 components/script/dom/audiodestinationnode.rs create mode 100644 components/script/dom/audionode.rs create mode 100644 components/script/dom/audioparam.rs create mode 100644 components/script/dom/audioscheduledsourcenode.rs create mode 100644 components/script/dom/baseaudiocontext.rs create mode 100644 components/script/dom/oscillatornode.rs create mode 100644 components/script/dom/periodicwave.rs create mode 100644 components/script/dom/webidls/AudioContext.webidl create mode 100644 components/script/dom/webidls/AudioDestinationNode.webidl create mode 100644 components/script/dom/webidls/AudioNode.webidl create mode 100644 components/script/dom/webidls/AudioParam.webidl create mode 100644 components/script/dom/webidls/AudioScheduledSourceNode.webidl create mode 100644 components/script/dom/webidls/BaseAudioContext.webidl create mode 100644 components/script/dom/webidls/OscillatorNode.webidl create mode 100644 components/script/dom/webidls/PeriodicWave.webidl diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs new file mode 100644 index 00000000000..9b767a6da05 --- /dev/null +++ b/components/script/dom/audiocontext.rs @@ -0,0 +1,81 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioContextBinding; +use dom::bindings::codegen::Bindings::AudioContextBinding::AudioContextMethods; +use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextOptions, AudioTimestamp}; +use dom::bindings::error::Fallible; +use dom::bindings::inheritance::Castable; +use dom::bindings::num::Finite; +use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::globalscope::GlobalScope; +use dom::promise::Promise; +use dom::window::Window; +use dom_struct::dom_struct; +use std::rc::Rc; + +#[dom_struct] +pub struct AudioContext { + context: BaseAudioContext, + base_latency: f64, + output_latency: f64, +} + +impl AudioContext { + fn new_inherited(global: &GlobalScope, sample_rate: f32) -> AudioContext { + AudioContext { + context: BaseAudioContext::new_inherited(global, 2 /* channel_count */, sample_rate), + base_latency: 0., // TODO + output_latency: 0., // TODO + } + } + + #[allow(unrooted_must_root)] + pub fn new(global: &GlobalScope, + options: &AudioContextOptions) -> DomRoot { + let context = AudioContext::new_inherited( + global, + *options.sampleRate.unwrap_or(Finite::wrap(0.)), + ); // TODO + reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap) + } + + pub fn Constructor(window: &Window, + options: &AudioContextOptions) -> Fallible> { + let global = window.upcast::(); + Ok(AudioContext::new(global, options)) + } +} + +impl AudioContextMethods for AudioContext { + fn BaseLatency(&self) -> Finite { + Finite::wrap(self.base_latency) + } + + fn OutputLatency(&self) -> Finite { + Finite::wrap(self.output_latency) + } + + fn GetOutputTimestamp(&self) -> AudioTimestamp { + // TODO + AudioTimestamp { + contextTime: Some(Finite::wrap(0.)), + performanceTime: Some(Finite::wrap(0.)), + } + } + + #[allow(unrooted_must_root)] + fn Suspend(&self) -> Rc { + // TODO + Promise::new(&self.global()) + } + + #[allow(unrooted_must_root)] + fn Close(&self) -> Rc { + // TODO + Promise::new(&self.global()) + } +} diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs new file mode 100644 index 00000000000..a9e63cb2bb9 --- /dev/null +++ b/components/script/dom/audiodestinationnode.rs @@ -0,0 +1,41 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audionode::{AudioNode, MAX_CHANNEL_COUNT}; +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioDestinationNodeBinding; +use dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::AudioDestinationNodeMethods; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::DomRoot; +use dom::globalscope::GlobalScope; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct AudioDestinationNode { + node: AudioNode, +} + +impl AudioDestinationNode { + fn new_inherited(context: &BaseAudioContext, + options: &AudioNodeOptions) -> AudioDestinationNode { + AudioDestinationNode { + node: AudioNode::new_inherited(context, options, 1, 1), + } + } + + #[allow(unrooted_must_root)] + pub fn new(global: &GlobalScope, + context: &BaseAudioContext, + options: &AudioNodeOptions) -> DomRoot { + let node = AudioDestinationNode::new_inherited(context, options); + reflect_dom_object(Box::new(node), global, AudioDestinationNodeBinding::Wrap) + } +} + +impl AudioDestinationNodeMethods for AudioDestinationNode { + fn MaxChannelCount(&self) -> u32 { + MAX_CHANNEL_COUNT + } +} diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs new file mode 100644 index 00000000000..3fc64147fcd --- /dev/null +++ b/components/script/dom/audionode.rs @@ -0,0 +1,166 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioNodeBinding; +use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; +use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::error::{Error, ErrorResult, Fallible}; +use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::audioparam::AudioParam; +use dom::globalscope::GlobalScope; +use dom_struct::dom_struct; +use std::cell::Cell; + +// 32 is the minimum required by the spec for createBuffer() and +// createScriptProcessor() and matches what is used by Blink and Gecko. +// The limit protects against large memory allocations. +pub static MAX_CHANNEL_COUNT: u32 = 32; + +#[dom_struct] +pub struct AudioNode { + reflector_: Reflector, + context: DomRoot, + number_of_inputs: u32, + number_of_outputs: u32, + channel_count: Cell, + channel_count_mode: Cell, + channel_interpretation: Cell, +} + +impl AudioNode { + pub fn new_inherited(context: &BaseAudioContext, + options: &AudioNodeOptions, + number_of_inputs: u32, + number_of_outputs: u32) -> AudioNode { + AudioNode { + reflector_: Reflector::new(), + context: DomRoot::from_ref(context), + number_of_inputs, + number_of_outputs, + channel_count: Cell::new(options.channelCount.unwrap_or(2)), + channel_count_mode: Cell::new(options.channelCountMode.unwrap_or_default()), + channel_interpretation: Cell::new(options.channelInterpretation.unwrap_or_default()), + } + } + + #[allow(unrooted_must_root)] + pub fn new(global: &GlobalScope, + context: &BaseAudioContext, + options: &AudioNodeOptions) -> DomRoot { + let audio_node = AudioNode::new_inherited(context, options, 1, 1); + reflect_dom_object(Box::new(audio_node), global, AudioNodeBinding::Wrap) + } +} + +impl AudioNodeMethods for AudioNode { + // https://webaudio.github.io/web-audio-api/#dom-audionode-connect + fn Connect(&self, + _destinationNode: &AudioNode, + _output: u32, + _input: u32) -> Fallible> { + // TODO + let options = AudioNodeOptions { + channelCount: Some(self.channel_count.get()), + channelCountMode: Some(self.channel_count_mode.get()), + channelInterpretation: Some(self.channel_interpretation.get()), + }; + Ok(AudioNode::new(&self.global(), &self.context, &options)) + } + + fn Connect_(&self, + _: &AudioParam, + _: u32) -> Fallible<()> { + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect + fn Disconnect(&self) -> ErrorResult { + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect + fn Disconnect_(&self, _: u32) -> ErrorResult { + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect + fn Disconnect__(&self, _: &AudioNode) -> ErrorResult { + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect + fn Disconnect___(&self, _: &AudioNode, _: u32) -> ErrorResult{ + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect + fn Disconnect____(&self, _: &AudioNode, _: u32, _: u32) -> ErrorResult { + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect + fn Disconnect_____(&self, _: &AudioParam) -> ErrorResult { + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect + fn Disconnect______(&self, _: &AudioParam, _: u32) -> ErrorResult { + // TODO + Ok(()) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-context + fn Context(&self) -> DomRoot { + DomRoot::from_ref(&self.context) + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-numberofinputs + fn NumberOfInputs(&self) -> u32 { + self.number_of_inputs + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-numberofoutputs + fn NumberOfOutputs(&self) -> u32 { + self.number_of_outputs + } + + // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount + fn ChannelCount(&self) -> u32 { + self.channel_count.get() + } + + fn SetChannelCount(&self, value: u32) -> ErrorResult { + if value == 0 || value > MAX_CHANNEL_COUNT { + return Err(Error::NotSupported); + } + self.channel_count.set(value); + Ok(()) + } + + fn ChannelCountMode(&self) -> ChannelCountMode { + self.channel_count_mode.get() + } + + fn SetChannelCountMode(&self, value: ChannelCountMode) -> ErrorResult { + self.channel_count_mode.set(value); + Ok(()) + } + + fn ChannelInterpretation(&self) -> ChannelInterpretation { + self.channel_interpretation.get() + } + + fn SetChannelInterpretation(&self, value: ChannelInterpretation) { + self.channel_interpretation.set(value); + } +} diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs new file mode 100644 index 00000000000..1b42af0a4e5 --- /dev/null +++ b/components/script/dom/audioparam.rs @@ -0,0 +1,66 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::bindings::codegen::Bindings::AudioParamBinding; +use dom::bindings::codegen::Bindings::AudioParamBinding::AudioParamMethods; +use dom::bindings::num::Finite; +use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::globalscope::GlobalScope; +use dom_struct::dom_struct; +use std::cell::Cell; + +#[dom_struct] +pub struct AudioParam { + reflector_: Reflector, + value: Cell, + default_value: f32, + min_value: f32, + max_value: f32, +} + +impl AudioParam { + pub fn new_inherited(default_value: f32, + min_value: f32, + max_value: f32) -> AudioParam { + AudioParam { + reflector_: Reflector::new(), + value: Cell::new(default_value), + default_value, + min_value, + max_value, + } + } + + #[allow(unrooted_must_root)] + pub fn new(global: &GlobalScope, + default_value: f32, + min_value: f32, + max_value: f32) -> DomRoot { + let audio_param = AudioParam::new_inherited(default_value, min_value, max_value); + reflect_dom_object(Box::new(audio_param), global, AudioParamBinding::Wrap) + } +} + +impl AudioParamMethods for AudioParam { + fn Value(&self) -> Finite { + Finite::wrap(self.value.get()) + } + + fn SetValue(&self, value: Finite) { + self.value.set(*value); + } + + fn DefaultValue(&self) -> Finite { + Finite::wrap(self.default_value) + } + + fn MinValue(&self) -> Finite { + Finite::wrap(self.min_value) + } + + fn MaxValue(&self) -> Finite { + Finite::wrap(self.max_value) + } +} diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs new file mode 100644 index 00000000000..e25cae8fe5e --- /dev/null +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -0,0 +1,38 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::audionode::AudioNode; +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::num::Finite; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct AudioScheduledSourceNode { + node: AudioNode, +} + +impl AudioScheduledSourceNode { + pub fn new_inherited(context: &BaseAudioContext, + options: &AudioNodeOptions, + number_of_inputs: u32, + number_of_outputs: u32) -> AudioScheduledSourceNode { + AudioScheduledSourceNode { + node: AudioNode::new_inherited(context, options, number_of_inputs, number_of_outputs), + } + } +} + +impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { + // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-onended + event_handler!(ended, GetOnended, SetOnended); + + // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start + fn Start(&self, _when: Finite) { + } + + // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-stop + fn Stop(&self, _when: Finite) { + } +} diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs new file mode 100644 index 00000000000..7e23b2a3274 --- /dev/null +++ b/components/script/dom/baseaudiocontext.rs @@ -0,0 +1,79 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audiodestinationnode::AudioDestinationNode; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; +use dom::bindings::num::Finite; +use dom::bindings::reflector::{DomObject, Reflector}; +use dom::bindings::root::DomRoot; +use dom::globalscope::GlobalScope; +use dom::promise::Promise; +use dom_struct::dom_struct; +use std::rc::Rc; + +#[dom_struct] +pub struct BaseAudioContext { + reflector_: Reflector, + destination: Option>, + sample_rate: f32, + current_time: f64, + state: AudioContextState, +} + +impl BaseAudioContext { + #[allow(unrooted_must_root)] + #[allow(unsafe_code)] + pub fn new_inherited( + global: &GlobalScope, + channel_count: u32, + sample_rate: f32, + ) -> BaseAudioContext { + let mut context = BaseAudioContext { + reflector_: Reflector::new(), + destination: None, + current_time: 0., + sample_rate, + state: AudioContextState::Suspended, + }; + + let mut options = unsafe { AudioNodeOptions::empty(global.get_cx()) }; + options.channelCount = Some(channel_count); + options.channelCountMode = Some(ChannelCountMode::Explicit); + options.channelInterpretation = Some(ChannelInterpretation::Speakers); + + context.destination = Some(AudioDestinationNode::new(global, &context, &options)); + + context + } +} + +impl BaseAudioContextMethods for BaseAudioContext { + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate + fn SampleRate(&self) -> Finite { + Finite::wrap(self.sample_rate) + } + + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime + fn CurrentTime(&self) -> Finite { + Finite::wrap(self.current_time) + } + + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume + #[allow(unrooted_must_root)] + fn Resume(&self) -> Rc { + // TODO + Promise::new(&self.global()) + } + + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination + fn Destination(&self) -> DomRoot { + DomRoot::from_ref(self.destination.as_ref().unwrap()) + } + + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange + event_handler!(statechange, GetOnstatechange, SetOnstatechange); +} diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 61e7522cfcf..ed72a38be50 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -216,6 +216,12 @@ pub mod abstractworker; pub mod abstractworkerglobalscope; pub mod activation; pub mod attr; +pub mod audiocontext; +pub mod audiodestinationnode; +pub mod audionode; +pub mod audioparam; +pub mod audioscheduledsourcenode; +pub mod baseaudiocontext; pub mod beforeunloadevent; pub mod bindings; pub mod blob; @@ -392,6 +398,7 @@ pub mod navigatorinfo; pub mod node; pub mod nodeiterator; pub mod nodelist; +pub mod oscillatornode; pub mod pagetransitionevent; pub mod paintrenderingcontext2d; pub mod paintsize; @@ -404,6 +411,7 @@ pub mod performanceobserver; pub mod performanceobserverentrylist; pub mod performancepainttiming; pub mod performancetiming; +pub mod periodicwave; pub mod permissions; pub mod permissionstatus; pub mod plugin; diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs new file mode 100644 index 00000000000..558e44357a7 --- /dev/null +++ b/components/script/dom/oscillatornode.rs @@ -0,0 +1,81 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v.2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audioscheduledsourcenode::AudioScheduledSourceNode; +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::codegen::Bindings::OscillatorNodeBinding; +use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; +use dom::bindings::error::Fallible; +use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::DomRoot; +use dom::window::Window; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct OscillatorNode { + node: AudioScheduledSourceNode, + // oscillator_type: OscillatorType, + // frequency: AudioParam, + // detune: AudioParam, +} + +impl OscillatorNode { + #[allow(unrooted_must_root)] + #[allow(unsafe_code)] + pub fn new_inherited( + window: &Window, + context: &BaseAudioContext, + ) -> OscillatorNode { + let mut options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; + options.channelCount = Some(2); + options.channelCountMode = Some(ChannelCountMode::Max); + options.channelInterpretation = Some(ChannelInterpretation::Speakers); + OscillatorNode { + node: AudioScheduledSourceNode::new_inherited( + context, + &options, + 0, /* inputs */ + 1, /* outputs */ + ), + } + } + + #[allow(unrooted_must_root)] + pub fn new( + window: &Window, + context: &BaseAudioContext, + _options: &OscillatorOptions, + ) -> DomRoot { + let node = OscillatorNode::new_inherited(window, context); + reflect_dom_object(Box::new(node), window, OscillatorNodeBinding::Wrap) + } + + pub fn Constructor( + window: &Window, + context: &BaseAudioContext, + options: &OscillatorOptions, + ) -> Fallible> { + Ok(OscillatorNode::new(window, context, options)) + } +} + +/*impl OscillatorNodeMethods for OscillatorNode { + fn SetPeriodicWave(&self, periodic_wave: PeriodicWave) { + // XXX + } + + fn Type(&self) -> OscillatorType { + self.oscillator_type + } + + fn Frequency(&self) -> DomRoot { + DomRoot::from_ref(&self.frequency) + } + + fn Detune(&self) -> DomRoot { + DomRoot::from_ref(&self.detune) + } +}*/ diff --git a/components/script/dom/periodicwave.rs b/components/script/dom/periodicwave.rs new file mode 100644 index 00000000000..4158e250e5c --- /dev/null +++ b/components/script/dom/periodicwave.rs @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::PeriodicWaveBinding; +use dom::bindings::codegen::Bindings::PeriodicWaveBinding::PeriodicWaveOptions; +use dom::bindings::error::Fallible; +use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::window::Window; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct PeriodicWave { + reflector_: Reflector, +} + +impl PeriodicWave { + pub fn new_inherited() -> PeriodicWave { + PeriodicWave { + reflector_: Reflector::new(), + } + } + + #[allow(unrooted_must_root)] + pub fn new(window: &Window) -> DomRoot { + let periodic_wave = PeriodicWave::new_inherited(); + reflect_dom_object(Box::new(periodic_wave), window, PeriodicWaveBinding::Wrap) + } + + pub fn Constructor( + window: &Window, + _context: &BaseAudioContext, + _options: &PeriodicWaveOptions, + ) -> Fallible> { + // TODO. + Ok(PeriodicWave::new(&window)) + } +} diff --git a/components/script/dom/webidls/AudioContext.webidl b/components/script/dom/webidls/AudioContext.webidl new file mode 100644 index 00000000000..07de08f7ac0 --- /dev/null +++ b/components/script/dom/webidls/AudioContext.webidl @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#dom-audiocontext + */ + +enum AudioContextLatencyCategory { + "balanced", + "interactive", + "playback" +}; + +dictionary AudioContextOptions { + AudioContextLatencyCategory latencyHint = "interactive"; + float sampleRate; +}; + +dictionary AudioTimestamp { + double contextTime; + DOMHighResTimeStamp performanceTime; +}; + +[Exposed=Window, + Constructor(optional AudioContextOptions contextOptions)] +interface AudioContext : BaseAudioContext { + readonly attribute double baseLatency; + readonly attribute double outputLatency; + + AudioTimestamp getOutputTimestamp(); + + Promise suspend(); + Promise close(); + + // MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); + // MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); + // MediaStreamTrackAudioSourceNode createMediaStreamTrackSource(MediaStreamTrack mediaStreamTrack); + // MediaStreamAudioDestinationNode createMediaStreamDestination(); +}; diff --git a/components/script/dom/webidls/AudioDestinationNode.webidl b/components/script/dom/webidls/AudioDestinationNode.webidl new file mode 100644 index 00000000000..c9b2a06fb44 --- /dev/null +++ b/components/script/dom/webidls/AudioDestinationNode.webidl @@ -0,0 +1,12 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#dom-audiodestinationnode + */ + +[Exposed=Window] +interface AudioDestinationNode : AudioNode { + readonly attribute unsigned long maxChannelCount; +}; diff --git a/components/script/dom/webidls/AudioNode.webidl b/components/script/dom/webidls/AudioNode.webidl new file mode 100644 index 00000000000..78b68a6cebf --- /dev/null +++ b/components/script/dom/webidls/AudioNode.webidl @@ -0,0 +1,61 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#dom-audionode + */ + +enum ChannelCountMode { + "max", + "clamped-max", + "explicit" +}; + +enum ChannelInterpretation { + "speakers", + "discrete" +}; + +dictionary AudioNodeOptions { + unsigned long channelCount; + ChannelCountMode channelCountMode; + ChannelInterpretation channelInterpretation; +}; + +[Exposed=Window] +interface AudioNode : EventTarget { + [Throws] + AudioNode connect(AudioNode destinationNode, + optional unsigned long output = 0, + optional unsigned long input = 0); + [Throws] + void connect(AudioParam destinationParam, + optional unsigned long output = 0); + [Throws] + void disconnect(); + [Throws] + void disconnect(unsigned long output); + [Throws] + void disconnect(AudioNode destination); + [Throws] + void disconnect(AudioNode destination, unsigned long output); + [Throws] + void disconnect(AudioNode destination, + unsigned long output, + unsigned long input); + [Throws] + void disconnect(AudioParam destination); + [Throws] + void disconnect(AudioParam destination, unsigned long output); + + readonly attribute BaseAudioContext context; + readonly attribute unsigned long numberOfInputs; + readonly attribute unsigned long numberOfOutputs; + + [SetterThrows] + attribute unsigned long channelCount; + [SetterThrows] + attribute ChannelCountMode channelCountMode; + attribute ChannelInterpretation channelInterpretation; +}; diff --git a/components/script/dom/webidls/AudioParam.webidl b/components/script/dom/webidls/AudioParam.webidl new file mode 100644 index 00000000000..3c0c4870c2b --- /dev/null +++ b/components/script/dom/webidls/AudioParam.webidl @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#dom-audioparam + */ + +[Exposed=Window] +interface AudioParam { + attribute float value; + readonly attribute float defaultValue; + readonly attribute float minValue; + readonly attribute float maxValue; +// AudioParam setValueAtTime(float value, double startTime); +// AudioParam linearRampToValueAtTime(float value, double endTime); +// AudioParam exponentialRampToValueAtTime(float value, double endTime); +// AudioParam setTargetAtTime(float target, +// double startTime, +// float timeConstant); +// AudioParam setValueCurveAtTime(sequence values, +// double startTime, +// double duration); +// AudioParam cancelScheduledValues(double cancelTime); +// AudioParam cancelAndHoldAtTime(double cancelTime); +}; diff --git a/components/script/dom/webidls/AudioScheduledSourceNode.webidl b/components/script/dom/webidls/AudioScheduledSourceNode.webidl new file mode 100644 index 00000000000..8e058b129cc --- /dev/null +++ b/components/script/dom/webidls/AudioScheduledSourceNode.webidl @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#AudioScheduledSourceNode + */ + +[Exposed=Window] +interface AudioScheduledSourceNode : AudioNode { + attribute EventHandler onended; + void start(optional double when = 0); + void stop(optional double when = 0); +}; diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl new file mode 100644 index 00000000000..288b5771fdc --- /dev/null +++ b/components/script/dom/webidls/BaseAudioContext.webidl @@ -0,0 +1,55 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#BaseAudioContext + */ + +enum AudioContextState { + "suspended", + "running", + "closed" +}; + +// callback DecodeErrorCallback = void (DOMException error); +// callback DecodeSuccessCallback = void (AudioBuffer decodedData); + +[Exposed=Window] +interface BaseAudioContext : EventTarget { + readonly attribute AudioDestinationNode destination; + readonly attribute float sampleRate; + readonly attribute double currentTime; + // readonly attribute AudioListener listener; + // readonly attribute AudioContextState state; + Promise resume(); + attribute EventHandler onstatechange; + // AudioBuffer createBuffer(unsigned long numberOfChannels, + // unsigned long length, + // float sampleRate); + // Promise decodeAudioData(ArrayBuffer audioData, + // optional DecodeSuccessCallback successCallback, + // optional DecodeErrorCallback errorCallback); + // AudioBufferSourceNode createBufferSource(); + // ConstantSourceNode createConstantSource(); + // ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, + // optional unsigned long numberOfInputChannels = 2, + // optional unsigned long numberOfOutputChannels = 2); + // AnalyserNode createAnalyser(); + // GainNode createGain(); + // DelayNode createDelay(optional double maxDelayTime = 1); + // BiquadFilterNode createBiquadFilter(); + // IIRFilterNode createIIRFilter(sequence feedforward, + // sequence feedback); + // WaveShaperNode createWaveShaper(); + // PannerNode createPanner(); + // StereoPannerNode createStereoPanner(); + // ConvolverNode createConvolver(); + // ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); + // ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); + // DynamicsCompressorNode createDynamicsCompressor(); + // OscillatorNode createOscillator(); + // PeriodicWave createPeriodicWave(sequence real, + // sequence imag, + // optional PeriodicWaveConstraints constraints); +}; diff --git a/components/script/dom/webidls/OscillatorNode.webidl b/components/script/dom/webidls/OscillatorNode.webidl new file mode 100644 index 00000000000..30197d2248c --- /dev/null +++ b/components/script/dom/webidls/OscillatorNode.webidl @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#oscillatornode + */ + +enum OscillatorType { + "sine", + "square", + "sawtooth", + "triangle", + "custom" +}; + +dictionary OscillatorOptions : AudioNodeOptions { + OscillatorType type = "sine"; + float frequency = 440; + float detune = 0; + PeriodicWave periodicWave; +}; + +[Exposed=Window, + Constructor (BaseAudioContext context, optional OscillatorOptions options)] +interface OscillatorNode : AudioScheduledSourceNode { +/* [SetterThrows] + attribute OscillatorType type; + + readonly attribute AudioParam frequency; + readonly attribute AudioParam detune; + + void setPeriodicWave (PeriodicWave periodicWave);*/ +}; diff --git a/components/script/dom/webidls/PeriodicWave.webidl b/components/script/dom/webidls/PeriodicWave.webidl new file mode 100644 index 00000000000..63ec5981235 --- /dev/null +++ b/components/script/dom/webidls/PeriodicWave.webidl @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#periodicwave + */ + +dictionary PeriodicWaveConstraints { + boolean disableNormalization = false; +}; + +dictionary PeriodicWaveOptions : PeriodicWaveConstraints { + sequence real; + sequence imag; +}; + +[Exposed=Window, + Constructor(BaseAudioContext context, optional PeriodicWaveOptions options)] +interface PeriodicWave { +}; From e9c40665baefc387fa42be4030b5fd2da7a1c140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 26 Mar 2018 14:00:53 +0200 Subject: [PATCH 02/87] Add servo-media --- components/script/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index ebc0ebd25b9..f4048fb6523 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -87,6 +87,7 @@ servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} servo_config = {path = "../config"} servo_geometry = {path = "../geometry" } +servo_media = {git = "https://github.com/ferjm/media"} servo_rand = {path = "../rand"} servo_url = {path = "../url"} smallvec = "0.6" From d8365111c91696011883fd4d313f36929ebc2b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 26 Mar 2018 19:04:33 +0200 Subject: [PATCH 03/87] Test OscillatorNode with servo_media --- components/script/Cargo.toml | 2 +- components/script/dom/audioscheduledsourcenode.rs | 13 +++++++++++++ components/script/dom/baseaudiocontext.rs | 10 ++++++++++ .../script/dom/webidls/BaseAudioContext.webidl | 2 +- components/script/lib.rs | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index f4048fb6523..71d0456d679 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -87,7 +87,7 @@ servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} servo_config = {path = "../config"} servo_geometry = {path = "../geometry" } -servo_media = {git = "https://github.com/ferjm/media"} +servo_media = {path = "../../../media/servo-media"} servo_rand = {path = "../rand"} servo_url = {path = "../url"} smallvec = "0.6" diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index e25cae8fe5e..ca506374964 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -7,6 +7,7 @@ use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioSche use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::num::Finite; use dom_struct::dom_struct; +use servo_media::ServoMedia; #[dom_struct] pub struct AudioScheduledSourceNode { @@ -30,6 +31,18 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start fn Start(&self, _when: Finite) { + // XXX This is just here to test servo_media from servo. + // ServoMedia needs to expose a way to feed the audio stream and + // we need to implement all the AudioContext logic to connect + // AudioNodes. + match ServoMedia::get().get_audio_stream() { + Ok(stream) => { + stream.play(); + }, + Err(_) => { + println!("OH NOES"); + } + }; } // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-stop diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 7e23b2a3274..2bc1cb5343c 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -7,11 +7,13 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; +use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector}; use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom::promise::Promise; +use dom::oscillatornode::OscillatorNode; use dom_struct::dom_struct; use std::rc::Rc; @@ -76,4 +78,12 @@ impl BaseAudioContextMethods for BaseAudioContext { // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange event_handler!(statechange, GetOnstatechange, SetOnstatechange); + + #[allow(unsafe_code)] + fn CreateOscillator(&self) -> DomRoot { + let global = self.global(); + let window = global.as_window(); + let options = unsafe { OscillatorOptions::empty(window.get_cx()) }; + OscillatorNode::new(&window, &self, &options) + } } diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl index 288b5771fdc..61ec03346c2 100644 --- a/components/script/dom/webidls/BaseAudioContext.webidl +++ b/components/script/dom/webidls/BaseAudioContext.webidl @@ -48,7 +48,7 @@ interface BaseAudioContext : EventTarget { // ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); // ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); // DynamicsCompressorNode createDynamicsCompressor(); - // OscillatorNode createOscillator(); + OscillatorNode createOscillator(); // PeriodicWave createPeriodicWave(sequence real, // sequence imag, // optional PeriodicWaveConstraints constraints); diff --git a/components/script/lib.rs b/components/script/lib.rs index d151734da80..5125607219b 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -86,6 +86,7 @@ extern crate servo_arc; #[macro_use] extern crate servo_atoms; extern crate servo_config; extern crate servo_geometry; +extern crate servo_media; extern crate servo_rand; extern crate servo_url; extern crate smallvec; From 53d4933a40039822c14af9ff5d3cd1d79d6537c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 23 May 2018 15:39:41 +0200 Subject: [PATCH 04/87] Update to use latest servo-media API --- components/script/dom/audiodestinationnode.rs | 6 +- components/script/dom/audionode.rs | 27 ++---- .../script/dom/audioscheduledsourcenode.rs | 19 +--- components/script/dom/baseaudiocontext.rs | 10 +++ components/script/dom/bindings/trace.rs | 2 + components/script/dom/oscillatornode.rs | 86 ++++++++++++------- 6 files changed, 84 insertions(+), 66 deletions(-) diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs index a9e63cb2bb9..0d3b5798c87 100644 --- a/components/script/dom/audiodestinationnode.rs +++ b/components/script/dom/audiodestinationnode.rs @@ -4,13 +4,13 @@ use dom::audionode::{AudioNode, MAX_CHANNEL_COUNT}; use dom::baseaudiocontext::BaseAudioContext; -use dom::bindings::codegen::Bindings::AudioDestinationNodeBinding; -use dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::AudioDestinationNodeMethods; +use dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::{self, AudioDestinationNodeMethods}; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; +use servo_media::audio::node::AudioNodeType; #[dom_struct] pub struct AudioDestinationNode { @@ -21,7 +21,7 @@ impl AudioDestinationNode { fn new_inherited(context: &BaseAudioContext, options: &AudioNodeOptions) -> AudioDestinationNode { AudioDestinationNode { - node: AudioNode::new_inherited(context, options, 1, 1), + node: AudioNode::new_inherited(AudioNodeType::DestinationNode, context, options, 1, 1), } } diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 3fc64147fcd..56e3bdd25ba 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -3,15 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::baseaudiocontext::BaseAudioContext; -use dom::bindings::codegen::Bindings::AudioNodeBinding; use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::reflector::Reflector; use dom::bindings::root::DomRoot; use dom::audioparam::AudioParam; -use dom::globalscope::GlobalScope; use dom_struct::dom_struct; +use servo_media::audio::node::AudioNodeType; use std::cell::Cell; // 32 is the minimum required by the spec for createBuffer() and @@ -22,6 +21,7 @@ pub static MAX_CHANNEL_COUNT: u32 = 32; #[dom_struct] pub struct AudioNode { reflector_: Reflector, + engine_id: usize, context: DomRoot, number_of_inputs: u32, number_of_outputs: u32, @@ -31,12 +31,14 @@ pub struct AudioNode { } impl AudioNode { - pub fn new_inherited(context: &BaseAudioContext, + pub fn new_inherited(node_type: AudioNodeType, + context: &BaseAudioContext, options: &AudioNodeOptions, number_of_inputs: u32, number_of_outputs: u32) -> AudioNode { AudioNode { reflector_: Reflector::new(), + engine_id: context.create_node_engine(node_type), context: DomRoot::from_ref(context), number_of_inputs, number_of_outputs, @@ -45,29 +47,16 @@ impl AudioNode { channel_interpretation: Cell::new(options.channelInterpretation.unwrap_or_default()), } } - - #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope, - context: &BaseAudioContext, - options: &AudioNodeOptions) -> DomRoot { - let audio_node = AudioNode::new_inherited(context, options, 1, 1); - reflect_dom_object(Box::new(audio_node), global, AudioNodeBinding::Wrap) - } } impl AudioNodeMethods for AudioNode { // https://webaudio.github.io/web-audio-api/#dom-audionode-connect fn Connect(&self, - _destinationNode: &AudioNode, + destination: &AudioNode, _output: u32, _input: u32) -> Fallible> { // TODO - let options = AudioNodeOptions { - channelCount: Some(self.channel_count.get()), - channelCountMode: Some(self.channel_count_mode.get()), - channelInterpretation: Some(self.channel_interpretation.get()), - }; - Ok(AudioNode::new(&self.global(), &self.context, &options)) + Ok(DomRoot::from_ref(destination)) } fn Connect_(&self, diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index ca506374964..523ac633fb1 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioSche use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::num::Finite; use dom_struct::dom_struct; -use servo_media::ServoMedia; +use servo_media::audio::node::AudioNodeType; #[dom_struct] pub struct AudioScheduledSourceNode { @@ -15,12 +15,13 @@ pub struct AudioScheduledSourceNode { } impl AudioScheduledSourceNode { - pub fn new_inherited(context: &BaseAudioContext, + pub fn new_inherited(node_type: AudioNodeType, + context: &BaseAudioContext, options: &AudioNodeOptions, number_of_inputs: u32, number_of_outputs: u32) -> AudioScheduledSourceNode { AudioScheduledSourceNode { - node: AudioNode::new_inherited(context, options, number_of_inputs, number_of_outputs), + node: AudioNode::new_inherited(node_type, context, options, number_of_inputs, number_of_outputs), } } } @@ -31,18 +32,6 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start fn Start(&self, _when: Finite) { - // XXX This is just here to test servo_media from servo. - // ServoMedia needs to expose a way to feed the audio stream and - // we need to implement all the AudioContext logic to connect - // AudioNodes. - match ServoMedia::get().get_audio_stream() { - Ok(stream) => { - stream.play(); - }, - Err(_) => { - println!("OH NOES"); - } - }; } // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-stop diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 2bc1cb5343c..8fc25940d7f 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -15,11 +15,16 @@ use dom::globalscope::GlobalScope; use dom::promise::Promise; use dom::oscillatornode::OscillatorNode; use dom_struct::dom_struct; +use servo_media::ServoMedia; +use servo_media::audio::graph::AudioGraph; +use servo_media::audio::node::AudioNodeType; use std::rc::Rc; #[dom_struct] pub struct BaseAudioContext { reflector_: Reflector, + #[ignore_malloc_size_of = "XXX"] + audio_graph: AudioGraph, destination: Option>, sample_rate: f32, current_time: f64, @@ -36,6 +41,7 @@ impl BaseAudioContext { ) -> BaseAudioContext { let mut context = BaseAudioContext { reflector_: Reflector::new(), + audio_graph: ServoMedia::get().unwrap().create_audio_graph().unwrap(), destination: None, current_time: 0., sample_rate, @@ -51,6 +57,10 @@ impl BaseAudioContext { context } + + pub fn create_node_engine(&self, node_type: AudioNodeType) -> usize { + self.audio_graph.create_node(node_type) + } } impl BaseAudioContextMethods for BaseAudioContext { diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index cbce5f53f17..c8f26a8ba5a 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -80,6 +80,7 @@ use offscreen_gl_context::GLLimits; use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; +use servo_media::AudioGraph; use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; @@ -429,6 +430,7 @@ unsafe_no_jsmanaged_fields!(InteractiveMetrics); unsafe_no_jsmanaged_fields!(InteractiveWindow); unsafe_no_jsmanaged_fields!(CanvasId); unsafe_no_jsmanaged_fields!(SourceSet); +unsafe_no_jsmanaged_fields!(AudioGraph); unsafe impl<'a> JSTraceable for &'a str { #[inline] diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 558e44357a7..a6e65260ce1 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -6,18 +6,20 @@ use dom::audioscheduledsourcenode::AudioScheduledSourceNode; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; -use dom::bindings::codegen::Bindings::OscillatorNodeBinding; -use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; +use dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOptions, OscillatorType}; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; +use servo_media::audio::node::AudioNodeType; +use servo_media::audio::oscillator_node::OscillatorNodeOptions as ServoMediaOscillatorOptions; +use servo_media::audio::oscillator_node::OscillatorType as ServoMediaOscillatorType; #[dom_struct] pub struct OscillatorNode { node: AudioScheduledSourceNode, - // oscillator_type: OscillatorType, + oscillator_type: OscillatorType, // frequency: AudioParam, // detune: AudioParam, } @@ -28,18 +30,21 @@ impl OscillatorNode { pub fn new_inherited( window: &Window, context: &BaseAudioContext, - ) -> OscillatorNode { - let mut options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; - options.channelCount = Some(2); - options.channelCountMode = Some(ChannelCountMode::Max); - options.channelInterpretation = Some(ChannelInterpretation::Speakers); + oscillator_options: &OscillatorOptions, + ) -> OscillatorNode { + let mut node_options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; + node_options.channelCount = Some(2); + node_options.channelCountMode = Some(ChannelCountMode::Max); + node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); OscillatorNode { node: AudioScheduledSourceNode::new_inherited( - context, - &options, - 0, /* inputs */ - 1, /* outputs */ - ), + AudioNodeType::OscillatorNode(oscillator_options.into()), + context, + &node_options, + 0, /* inputs */ + 1, /* outputs */ + ), + oscillator_type: oscillator_options.type_, } } @@ -47,9 +52,9 @@ impl OscillatorNode { pub fn new( window: &Window, context: &BaseAudioContext, - _options: &OscillatorOptions, - ) -> DomRoot { - let node = OscillatorNode::new_inherited(window, context); + options: &OscillatorOptions, + ) -> DomRoot { + let node = OscillatorNode::new_inherited(window, context, options); reflect_dom_object(Box::new(node), window, OscillatorNodeBinding::Wrap) } @@ -57,25 +62,48 @@ impl OscillatorNode { window: &Window, context: &BaseAudioContext, options: &OscillatorOptions, - ) -> Fallible> { + ) -> Fallible> { Ok(OscillatorNode::new(window, context, options)) } } /*impl OscillatorNodeMethods for OscillatorNode { - fn SetPeriodicWave(&self, periodic_wave: PeriodicWave) { - // XXX - } + fn SetPeriodicWave(&self, periodic_wave: PeriodicWave) { +// XXX +} - fn Type(&self) -> OscillatorType { - self.oscillator_type - } +fn Type(&self) -> OscillatorType { +self.oscillator_type +} - fn Frequency(&self) -> DomRoot { - DomRoot::from_ref(&self.frequency) - } +fn Frequency(&self) -> DomRoot { +DomRoot::from_ref(&self.frequency) +} - fn Detune(&self) -> DomRoot { - DomRoot::from_ref(&self.detune) - } +fn Detune(&self) -> DomRoot { +DomRoot::from_ref(&self.detune) +} }*/ + +impl<'a> From<&'a OscillatorOptions> for ServoMediaOscillatorOptions { + fn from(options: &'a OscillatorOptions) -> Self { + Self { + oscillator_type: options.type_.into(), + freq: *options.frequency, + detune: *options.detune, + periodic_wave_options: None, // XXX + } + } +} + +impl From for ServoMediaOscillatorType { + fn from(oscillator_type: OscillatorType) -> Self { + match oscillator_type { + OscillatorType::Sine => ServoMediaOscillatorType::Sine, + OscillatorType::Square => ServoMediaOscillatorType::Square, + OscillatorType::Sawtooth => ServoMediaOscillatorType::Sawtooth, + OscillatorType::Triangle => ServoMediaOscillatorType::Triangle, + OscillatorType::Custom => ServoMediaOscillatorType::Custom, + } + } +} From 460295165603b74cf8c77c53be6fb8fd813be943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 31 May 2018 12:20:41 +0200 Subject: [PATCH 05/87] Update to use latest servo-media --- components/script/dom/baseaudiocontext.rs | 2 +- components/script/dom/bindings/trace.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 8fc25940d7f..0820b7eec67 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -41,7 +41,7 @@ impl BaseAudioContext { ) -> BaseAudioContext { let mut context = BaseAudioContext { reflector_: Reflector::new(), - audio_graph: ServoMedia::get().unwrap().create_audio_graph().unwrap(), + audio_graph: ServoMedia::get().unwrap().create_audio_graph(), destination: None, current_time: 0., sample_rate, diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index c8f26a8ba5a..1f39f33f209 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -80,7 +80,7 @@ use offscreen_gl_context::GLLimits; use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; -use servo_media::AudioGraph; +use servo_media::audio::graph::AudioGraph; use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; From ba9dfb0293c6385753221ab7a1515a1c552594ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 21 Jun 2018 10:34:06 +0200 Subject: [PATCH 06/87] Trace and malloc_size_of workarounds for servo_media types --- components/script/dom/audionode.rs | 8 +++++--- components/script/dom/baseaudiocontext.rs | 5 +++-- components/script/dom/bindings/trace.rs | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 56e3bdd25ba..2ef9b0635e6 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -10,10 +10,11 @@ use dom::bindings::reflector::Reflector; use dom::bindings::root::DomRoot; use dom::audioparam::AudioParam; use dom_struct::dom_struct; +use servo_media::audio::graph_impl::NodeId; use servo_media::audio::node::AudioNodeType; use std::cell::Cell; -// 32 is the minimum required by the spec for createBuffer() and +// 32 is the minimum required by the spec for createBuffer() and the deprecated // createScriptProcessor() and matches what is used by Blink and Gecko. // The limit protects against large memory allocations. pub static MAX_CHANNEL_COUNT: u32 = 32; @@ -21,7 +22,8 @@ pub static MAX_CHANNEL_COUNT: u32 = 32; #[dom_struct] pub struct AudioNode { reflector_: Reflector, - engine_id: usize, + #[ignore_malloc_size_of = "servo_media"] + node_id: NodeId, context: DomRoot, number_of_inputs: u32, number_of_outputs: u32, @@ -38,7 +40,7 @@ impl AudioNode { number_of_outputs: u32) -> AudioNode { AudioNode { reflector_: Reflector::new(), - engine_id: context.create_node_engine(node_type), + node_id: context.create_node_engine(node_type), context: DomRoot::from_ref(context), number_of_inputs, number_of_outputs, diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 0820b7eec67..f8fa01bd0f4 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -17,13 +17,14 @@ use dom::oscillatornode::OscillatorNode; use dom_struct::dom_struct; use servo_media::ServoMedia; use servo_media::audio::graph::AudioGraph; +use servo_media::audio::graph_impl::NodeId; use servo_media::audio::node::AudioNodeType; use std::rc::Rc; #[dom_struct] pub struct BaseAudioContext { reflector_: Reflector, - #[ignore_malloc_size_of = "XXX"] + #[ignore_malloc_size_of = "servo_media"] audio_graph: AudioGraph, destination: Option>, sample_rate: f32, @@ -58,7 +59,7 @@ impl BaseAudioContext { context } - pub fn create_node_engine(&self, node_type: AudioNodeType) -> usize { + pub fn create_node_engine(&self, node_type: AudioNodeType) -> NodeId { self.audio_graph.create_node(node_type) } } diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 1f39f33f209..4724f2a8c3a 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -81,6 +81,7 @@ use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; use servo_media::audio::graph::AudioGraph; +use servo_media::audio::graph_impl::NodeId; use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; @@ -431,6 +432,7 @@ unsafe_no_jsmanaged_fields!(InteractiveWindow); unsafe_no_jsmanaged_fields!(CanvasId); unsafe_no_jsmanaged_fields!(SourceSet); unsafe_no_jsmanaged_fields!(AudioGraph); +unsafe_no_jsmanaged_fields!(NodeId); unsafe impl<'a> JSTraceable for &'a str { #[inline] From db52d1f65c6fe154812b682a604b00db3a78eed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 22 Jun 2018 11:04:01 +0200 Subject: [PATCH 07/87] Audio context options --- components/script/dom/audiocontext.rs | 32 ++++++++++++++++++----- components/script/dom/baseaudiocontext.rs | 20 ++++++++++---- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 9b767a6da05..3ed6f3947ad 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::baseaudiocontext::BaseAudioContext; +use dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; use dom::bindings::codegen::Bindings::AudioContextBinding; -use dom::bindings::codegen::Bindings::AudioContextBinding::AudioContextMethods; -use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextOptions, AudioTimestamp}; +use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextMethods, AudioContextOptions}; +use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextLatencyCategory, AudioTimestamp}; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; @@ -15,6 +15,7 @@ use dom::globalscope::GlobalScope; use dom::promise::Promise; use dom::window::Window; use dom_struct::dom_struct; +use servo_media::audio::graph::{LatencyCategory, RealTimeAudioGraphOptions}; use std::rc::Rc; #[dom_struct] @@ -25,9 +26,9 @@ pub struct AudioContext { } impl AudioContext { - fn new_inherited(global: &GlobalScope, sample_rate: f32) -> AudioContext { + fn new_inherited(global: &GlobalScope, options: &AudioContextOptions) -> AudioContext { AudioContext { - context: BaseAudioContext::new_inherited(global, 2 /* channel_count */, sample_rate), + context: BaseAudioContext::new_inherited(global, BaseAudioContextOptions::AudioContext(options.into())), base_latency: 0., // TODO output_latency: 0., // TODO } @@ -38,7 +39,7 @@ impl AudioContext { options: &AudioContextOptions) -> DomRoot { let context = AudioContext::new_inherited( global, - *options.sampleRate.unwrap_or(Finite::wrap(0.)), + options, ); // TODO reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap) } @@ -79,3 +80,22 @@ impl AudioContextMethods for AudioContext { Promise::new(&self.global()) } } + +impl From for LatencyCategory { + fn from(category: AudioContextLatencyCategory) -> Self { + match category { + AudioContextLatencyCategory::Balanced => LatencyCategory::Balanced, + AudioContextLatencyCategory::Interactive => LatencyCategory::Interactive, + AudioContextLatencyCategory::Playback => LatencyCategory::Playback, + } + } +} + +impl<'a> From<&'a AudioContextOptions> for RealTimeAudioGraphOptions { + fn from(options: &AudioContextOptions) -> Self { + Self { + sample_rate: *options.sampleRate.unwrap_or(Finite::wrap(48000.)), + latency_hint: options.latencyHint.into(), + } + } +} diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index f8fa01bd0f4..554b4e67b4e 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -17,10 +17,16 @@ use dom::oscillatornode::OscillatorNode; use dom_struct::dom_struct; use servo_media::ServoMedia; use servo_media::audio::graph::AudioGraph; +use servo_media::audio::graph::{OfflineAudioGraphOptions, RealTimeAudioGraphOptions}; use servo_media::audio::graph_impl::NodeId; use servo_media::audio::node::AudioNodeType; use std::rc::Rc; +pub enum BaseAudioContextOptions { + AudioContext(RealTimeAudioGraphOptions), + OfflineAudioContext(OfflineAudioGraphOptions), +} + #[dom_struct] pub struct BaseAudioContext { reflector_: Reflector, @@ -37,12 +43,16 @@ impl BaseAudioContext { #[allow(unsafe_code)] pub fn new_inherited( global: &GlobalScope, - channel_count: u32, - sample_rate: f32, - ) -> BaseAudioContext { + options: BaseAudioContextOptions, + ) -> BaseAudioContext { + let options = match options { + BaseAudioContextOptions::AudioContext(options) => options, + BaseAudioContextOptions::OfflineAudioContext(_) => unimplemented!(), + }; + let sample_rate = options.sample_rate; let mut context = BaseAudioContext { reflector_: Reflector::new(), - audio_graph: ServoMedia::get().unwrap().create_audio_graph(), + audio_graph: ServoMedia::get().unwrap().create_audio_graph(Some(options.into())), destination: None, current_time: 0., sample_rate, @@ -50,7 +60,7 @@ impl BaseAudioContext { }; let mut options = unsafe { AudioNodeOptions::empty(global.get_cx()) }; - options.channelCount = Some(channel_count); + options.channelCount = Some(2); options.channelCountMode = Some(ChannelCountMode::Explicit); options.channelInterpretation = Some(ChannelInterpretation::Speakers); From 7e04031a9502f210782cac4a42ff090ea16e56bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 22 Jun 2018 11:15:36 +0200 Subject: [PATCH 08/87] Expose BaseAudioContext.state --- components/script/dom/baseaudiocontext.rs | 7 +++++++ components/script/dom/webidls/BaseAudioContext.webidl | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 554b4e67b4e..7c2dfff78a9 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -49,7 +49,9 @@ impl BaseAudioContext { BaseAudioContextOptions::AudioContext(options) => options, BaseAudioContextOptions::OfflineAudioContext(_) => unimplemented!(), }; + let sample_rate = options.sample_rate; + let mut context = BaseAudioContext { reflector_: Reflector::new(), audio_graph: ServoMedia::get().unwrap().create_audio_graph(Some(options.into())), @@ -85,6 +87,11 @@ impl BaseAudioContextMethods for BaseAudioContext { Finite::wrap(self.current_time) } + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state + fn State(&self) -> AudioContextState { + self.state + } + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume #[allow(unrooted_must_root)] fn Resume(&self) -> Rc { diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl index 61ec03346c2..81e0817c8cd 100644 --- a/components/script/dom/webidls/BaseAudioContext.webidl +++ b/components/script/dom/webidls/BaseAudioContext.webidl @@ -21,7 +21,7 @@ interface BaseAudioContext : EventTarget { readonly attribute float sampleRate; readonly attribute double currentTime; // readonly attribute AudioListener listener; - // readonly attribute AudioContextState state; + readonly attribute AudioContextState state; Promise resume(); attribute EventHandler onstatechange; // AudioBuffer createBuffer(unsigned long numberOfChannels, From 98741ddf8422fe4759e3d2578bc05f92f7b5bb31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 22 Jun 2018 12:47:19 +0200 Subject: [PATCH 09/87] AudioContext construction --- components/script/dom/audiocontext.rs | 25 +++++++++++- components/script/dom/baseaudiocontext.rs | 46 +++++++++++++++++++++-- 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 3ed6f3947ad..525943caec7 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -21,14 +21,36 @@ use std::rc::Rc; #[dom_struct] pub struct AudioContext { context: BaseAudioContext, + latency_hint: AudioContextLatencyCategory, + /// https://webaudio.github.io/web-audio-api/#dom-audiocontext-baselatency base_latency: f64, + /// https://webaudio.github.io/web-audio-api/#dom-audiocontext-outputlatency output_latency: f64, } impl AudioContext { + #[allow(unrooted_must_root)] + // https://webaudio.github.io/web-audio-api/#AudioContext-constructors fn new_inherited(global: &GlobalScope, options: &AudioContextOptions) -> AudioContext { + // Steps 1-3. + let context = BaseAudioContext::new_inherited(global, BaseAudioContextOptions::AudioContext(options.into())); + + // Step 4.1. + let latency_hint = options.latencyHint; + + // Step 4.2. The sample rate is set during the creation of the BaseAudioContext. + // servo-media takes care of setting the default sample rate of the output device + // and of resampling the audio output if needed. + + // Step 5. + if context.is_allowed_to_start() { + // Step 6. + context.resume(); + } + AudioContext { - context: BaseAudioContext::new_inherited(global, BaseAudioContextOptions::AudioContext(options.into())), + context, + latency_hint, base_latency: 0., // TODO output_latency: 0., // TODO } @@ -44,6 +66,7 @@ impl AudioContext { reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap) } + // https://webaudio.github.io/web-audio-api/#AudioContext-constructors pub fn Constructor(window: &Window, options: &AudioContextOptions) -> Fallible> { let global = window.upcast::(); diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 7c2dfff78a9..63a996ba165 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -3,24 +3,30 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audiodestinationnode::AudioDestinationNode; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; +use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; +use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector}; use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; -use dom::promise::Promise; use dom::oscillatornode::OscillatorNode; +use dom::promise::Promise; +use dom::window::Window; use dom_struct::dom_struct; use servo_media::ServoMedia; use servo_media::audio::graph::AudioGraph; use servo_media::audio::graph::{OfflineAudioGraphOptions, RealTimeAudioGraphOptions}; use servo_media::audio::graph_impl::NodeId; use servo_media::audio::node::AudioNodeType; +use std::cell::Cell; use std::rc::Rc; +use task_source::TaskSource; pub enum BaseAudioContextOptions { AudioContext(RealTimeAudioGraphOptions), @@ -32,10 +38,17 @@ pub struct BaseAudioContext { reflector_: Reflector, #[ignore_malloc_size_of = "servo_media"] audio_graph: AudioGraph, + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination destination: Option>, + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate sample_rate: f32, + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime current_time: f64, - state: AudioContextState, + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state + state: Cell, + /// https://webaudio.github.io/web-audio-api/#pendingresumepromises + #[ignore_malloc_size_of = "promises are hard"] + pending_resume_promises: DomRefCell>>, } impl BaseAudioContext { @@ -58,7 +71,8 @@ impl BaseAudioContext { destination: None, current_time: 0., sample_rate, - state: AudioContextState::Suspended, + state: Cell::new(AudioContextState::Suspended), + pending_resume_promises: Default::default(), }; let mut options = unsafe { AudioNodeOptions::empty(global.get_cx()) }; @@ -74,6 +88,30 @@ impl BaseAudioContext { pub fn create_node_engine(&self, node_type: AudioNodeType) -> NodeId { self.audio_graph.create_node(node_type) } + + // https://webaudio.github.io/web-audio-api/#allowed-to-start + pub fn is_allowed_to_start(&self) -> bool { + self.state.get() == AudioContextState::Suspended + } + + pub fn resume(&self) { + let window = DomRoot::downcast::(self.global()).unwrap(); + let task_source = window.dom_manipulation_task_source(); + + // Set the state attribute to `running`. + let this = Trusted::new(self); + task_source.queue(task!(set_state: move || { + let this = this.root(); + this.state.set(AudioContextState::Running); + }), window.upcast()).unwrap(); + + // Queue a task to fire a simple event named `statechange` at the AudioContext. + task_source.queue_simple_event( + self.upcast(), + atom!("statechange"), + &window, + ); + } } impl BaseAudioContextMethods for BaseAudioContext { @@ -89,7 +127,7 @@ impl BaseAudioContextMethods for BaseAudioContext { // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state fn State(&self) -> AudioContextState { - self.state + self.state.get() } // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume From 03dede3abbaa216fa93aa29584ee6affa021525a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 22 Jun 2018 13:00:15 +0200 Subject: [PATCH 10/87] Get audio context current time from audio graph --- components/script/dom/baseaudiocontext.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 63a996ba165..2884a7c5b92 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -42,8 +42,6 @@ pub struct BaseAudioContext { destination: Option>, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate sample_rate: f32, - /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime - current_time: f64, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state state: Cell, /// https://webaudio.github.io/web-audio-api/#pendingresumepromises @@ -69,7 +67,6 @@ impl BaseAudioContext { reflector_: Reflector::new(), audio_graph: ServoMedia::get().unwrap().create_audio_graph(Some(options.into())), destination: None, - current_time: 0., sample_rate, state: Cell::new(AudioContextState::Suspended), pending_resume_promises: Default::default(), @@ -122,7 +119,8 @@ impl BaseAudioContextMethods for BaseAudioContext { // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime fn CurrentTime(&self) -> Finite { - Finite::wrap(self.current_time) + let current_time = self.audio_graph.current_time(); + Finite::wrap(current_time) } // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state From 547e6e84b0279af19a3a4df6017d6354d71511fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 22 Jun 2018 14:54:39 +0200 Subject: [PATCH 11/87] Use audio graph processing state --- components/script/dom/baseaudiocontext.rs | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 2884a7c5b92..3f91fee3a43 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -20,11 +20,10 @@ use dom::promise::Promise; use dom::window::Window; use dom_struct::dom_struct; use servo_media::ServoMedia; -use servo_media::audio::graph::AudioGraph; +use servo_media::audio::graph::{AudioGraph, ProcessingState}; use servo_media::audio::graph::{OfflineAudioGraphOptions, RealTimeAudioGraphOptions}; use servo_media::audio::graph_impl::NodeId; use servo_media::audio::node::AudioNodeType; -use std::cell::Cell; use std::rc::Rc; use task_source::TaskSource; @@ -42,8 +41,6 @@ pub struct BaseAudioContext { destination: Option>, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate sample_rate: f32, - /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state - state: Cell, /// https://webaudio.github.io/web-audio-api/#pendingresumepromises #[ignore_malloc_size_of = "promises are hard"] pending_resume_promises: DomRefCell>>, @@ -68,7 +65,6 @@ impl BaseAudioContext { audio_graph: ServoMedia::get().unwrap().create_audio_graph(Some(options.into())), destination: None, sample_rate, - state: Cell::new(AudioContextState::Suspended), pending_resume_promises: Default::default(), }; @@ -88,18 +84,19 @@ impl BaseAudioContext { // https://webaudio.github.io/web-audio-api/#allowed-to-start pub fn is_allowed_to_start(&self) -> bool { - self.state.get() == AudioContextState::Suspended + let state: AudioContextState = self.audio_graph.state().into(); + state == AudioContextState::Suspended } pub fn resume(&self) { let window = DomRoot::downcast::(self.global()).unwrap(); let task_source = window.dom_manipulation_task_source(); - // Set the state attribute to `running`. + // Set the state attribute to `running` and start rendering audio. let this = Trusted::new(self); - task_source.queue(task!(set_state: move || { + task_source.queue(task!(resume: move || { let this = this.root(); - this.state.set(AudioContextState::Running); + this.audio_graph.resume(); }), window.upcast()).unwrap(); // Queue a task to fire a simple event named `statechange` at the AudioContext. @@ -125,7 +122,7 @@ impl BaseAudioContextMethods for BaseAudioContext { // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state fn State(&self) -> AudioContextState { - self.state.get() + self.audio_graph.state().into() } // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume @@ -151,3 +148,13 @@ impl BaseAudioContextMethods for BaseAudioContext { OscillatorNode::new(&window, &self, &options) } } + +impl From for AudioContextState { + fn from(state: ProcessingState) -> Self { + match state { + ProcessingState::Suspended => AudioContextState::Suspended, + ProcessingState::Running => AudioContextState::Running, + ProcessingState::Closed => AudioContextState::Closed, + } + } +} From 01f3951c662294e0f76244546373425826c3e156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 22 Jun 2018 15:24:09 +0200 Subject: [PATCH 12/87] AudioContext.resume() implementation --- components/script/dom/baseaudiocontext.rs | 33 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 3f91fee3a43..75b1f055bc2 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -9,6 +9,7 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, Chann use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; +use dom::bindings::error::Error; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; @@ -84,8 +85,7 @@ impl BaseAudioContext { // https://webaudio.github.io/web-audio-api/#allowed-to-start pub fn is_allowed_to_start(&self) -> bool { - let state: AudioContextState = self.audio_graph.state().into(); - state == AudioContextState::Suspended + self.audio_graph.state() == ProcessingState::Suspended } pub fn resume(&self) { @@ -128,8 +128,33 @@ impl BaseAudioContextMethods for BaseAudioContext { // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume #[allow(unrooted_must_root)] fn Resume(&self) -> Rc { - // TODO - Promise::new(&self.global()) + // Step 1. + let promise = Promise::new(&self.global()); + + // Step 2. + let state = self.audio_graph.state(); + if state == ProcessingState::Closed { + promise.reject_error(Error::InvalidState); + return promise; + } + + // Step 3. + if state == ProcessingState::Running { + promise.resolve_native(&()); + return promise; + } + + // Step 4. + if !self.is_allowed_to_start() { + self.pending_resume_promises.borrow_mut().push(promise.clone()); + return promise; + } + + // Steps 5 and 6. + self.resume(); + + // Step 7. + promise } // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination From 9f15bdd6ccea0d4151be7365a2e39cf33cb92472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 25 Jun 2018 13:00:11 +0200 Subject: [PATCH 13/87] AudioContext.suspend() implementation --- components/script/dom/audiocontext.rs | 48 +++++++++++++++++++---- components/script/dom/baseaudiocontext.rs | 6 ++- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 525943caec7..f3d98c59028 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -6,9 +6,12 @@ use dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; use dom::bindings::codegen::Bindings::AudioContextBinding; use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextMethods, AudioContextOptions}; use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextLatencyCategory, AudioTimestamp}; -use dom::bindings::error::Fallible; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::BaseAudioContextMethods; +use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; +use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; @@ -17,6 +20,7 @@ use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::graph::{LatencyCategory, RealTimeAudioGraphOptions}; use std::rc::Rc; +use task_source::TaskSource; #[dom_struct] pub struct AudioContext { @@ -59,10 +63,7 @@ impl AudioContext { #[allow(unrooted_must_root)] pub fn new(global: &GlobalScope, options: &AudioContextOptions) -> DomRoot { - let context = AudioContext::new_inherited( - global, - options, - ); // TODO + let context = AudioContext::new_inherited(global, options); reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap) } @@ -91,10 +92,43 @@ impl AudioContextMethods for AudioContext { } } + /// https://webaudio.github.io/web-audio-api/#dom-audiocontext-suspend #[allow(unrooted_must_root)] fn Suspend(&self) -> Rc { - // TODO - Promise::new(&self.global()) + // Step 1. + let promise = Promise::new(&self.global()); + + // Step 2. + let state = self.context.State(); + if state == AudioContextState::Closed { + promise.reject_error(Error::InvalidState); + return promise; + } + + // Step 3. + if state == AudioContextState::Suspended { + promise.resolve_native(&()); + return promise; + } + + // Steps 4 and 5. + let window = DomRoot::downcast::(self.global()).unwrap(); + let task_source = window.dom_manipulation_task_source(); + + let this = Trusted::new(self); + task_source.queue(task!(suspend: move || { + let this = this.root(); + this.context.audio_graph().suspend(); + }), window.upcast()).unwrap(); + + task_source.queue_simple_event( + self.upcast(), + atom!("statechange"), + &window + ); + + // Step 6. + promise } #[allow(unrooted_must_root)] diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 75b1f055bc2..4cf33b52e0d 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -79,6 +79,10 @@ impl BaseAudioContext { context } + pub fn audio_graph(&self) -> &AudioGraph { + &self.audio_graph + } + pub fn create_node_engine(&self, node_type: AudioNodeType) -> NodeId { self.audio_graph.create_node(node_type) } @@ -103,7 +107,7 @@ impl BaseAudioContext { task_source.queue_simple_event( self.upcast(), atom!("statechange"), - &window, + &window ); } } From aed57252b130446efba63daf1df7f46d5afaca40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 26 Jun 2018 11:51:57 +0200 Subject: [PATCH 14/87] Properly implement audio context state changes --- components/script/dom/audiocontext.rs | 107 ++++++++++++--- components/script/dom/audionode.rs | 2 +- components/script/dom/baseaudiocontext.rs | 156 +++++++++++++++++----- components/script/dom/bindings/trace.rs | 5 +- 4 files changed, 214 insertions(+), 56 deletions(-) diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index f3d98c59028..2dd357ca2ec 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -11,14 +11,14 @@ use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextB use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; -use dom::bindings::refcounted::Trusted; +use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom::promise::Promise; use dom::window::Window; use dom_struct::dom_struct; -use servo_media::audio::graph::{LatencyCategory, RealTimeAudioGraphOptions}; +use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions}; use std::rc::Rc; use task_source::TaskSource; @@ -99,14 +99,13 @@ impl AudioContextMethods for AudioContext { let promise = Promise::new(&self.global()); // Step 2. - let state = self.context.State(); - if state == AudioContextState::Closed { + if self.context.control_thread_state() == ProcessingState::Closed { promise.reject_error(Error::InvalidState); return promise; } // Step 3. - if state == AudioContextState::Suspended { + if self.context.State() == AudioContextState::Suspended { promise.resolve_native(&()); return promise; } @@ -114,18 +113,36 @@ impl AudioContextMethods for AudioContext { // Steps 4 and 5. let window = DomRoot::downcast::(self.global()).unwrap(); let task_source = window.dom_manipulation_task_source(); - - let this = Trusted::new(self); - task_source.queue(task!(suspend: move || { - let this = this.root(); - this.context.audio_graph().suspend(); - }), window.upcast()).unwrap(); - - task_source.queue_simple_event( - self.upcast(), - atom!("statechange"), - &window - ); + let trusted_promise = TrustedPromise::new(promise.clone()); + match self.context.audio_context_impl().suspend() { + Ok(_) => { + let base_context = Trusted::new(&self.context); + let context = Trusted::new(self); + let _ = task_source.queue(task!(suspend_ok: move || { + let base_context = base_context.root(); + let context = context.root(); + let promise = trusted_promise.root(); + promise.resolve_native(&()); + if base_context.State() != AudioContextState::Suspended { + base_context.set_state_attribute(AudioContextState::Suspended); + let window = DomRoot::downcast::(context.global()).unwrap(); + window.dom_manipulation_task_source().queue_simple_event( + context.upcast(), + atom!("statechange"), + &window + ); + } + }), window.upcast()); + }, + Err(_) => { + // The spec does not define the error case and `suspend` should + // never fail, but we handle the case here for completion. + let _ = task_source.queue(task!(suspend_error: move || { + let promise = trusted_promise.root(); + promise.reject_error(Error::Type("Something went wrong".to_owned())); + }), window.upcast()); + }, + }; // Step 6. promise @@ -133,8 +150,58 @@ impl AudioContextMethods for AudioContext { #[allow(unrooted_must_root)] fn Close(&self) -> Rc { - // TODO - Promise::new(&self.global()) + // Step 1. + let promise = Promise::new(&self.global()); + + // Step 2. + if self.context.control_thread_state() == ProcessingState::Closed { + promise.reject_error(Error::InvalidState); + return promise; + } + + // Step 3. + if self.context.State() == AudioContextState::Closed { + promise.resolve_native(&()); + return promise; + } + + // Steps 4 and 5. + let window = DomRoot::downcast::(self.global()).unwrap(); + let task_source = window.dom_manipulation_task_source(); + let trusted_promise = TrustedPromise::new(promise.clone()); + match self.context.audio_context_impl().close() { + Ok(_) => { + let base_context = Trusted::new(&self.context); + let context = Trusted::new(self); + let _ = task_source.queue(task!(suspend_ok: move || { + let base_context = base_context.root(); + let context = context.root(); + let promise = trusted_promise.root(); + promise.resolve_native(&()); + if base_context.State() != AudioContextState::Closed { + base_context.set_state_attribute(AudioContextState::Closed); + let window = DomRoot::downcast::(context.global()).unwrap(); + window.dom_manipulation_task_source().queue_simple_event( + context.upcast(), + atom!("statechange"), + &window + ); + } + }), window.upcast()); + }, + Err(_) => { + // The spec does not define the error case and `suspend` should + // never fail, but we handle the case here for completion. + let _ = task_source.queue(task!(suspend_error: move || { + let promise = trusted_promise.root(); + promise.reject_error(Error::Type("Something went wrong".to_owned())); + }), window.upcast()); + }, + }; + + + // Step 6. + promise } } @@ -148,7 +215,7 @@ impl From for LatencyCategory { } } -impl<'a> From<&'a AudioContextOptions> for RealTimeAudioGraphOptions { +impl<'a> From<&'a AudioContextOptions> for RealTimeAudioContextOptions { fn from(options: &AudioContextOptions) -> Self { Self { sample_rate: *options.sampleRate.unwrap_or(Finite::wrap(48000.)), diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 2ef9b0635e6..7b4cff4ee7f 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -10,7 +10,7 @@ use dom::bindings::reflector::Reflector; use dom::bindings::root::DomRoot; use dom::audioparam::AudioParam; use dom_struct::dom_struct; -use servo_media::audio::graph_impl::NodeId; +use servo_media::audio::graph::NodeId; use servo_media::audio::node::AudioNodeType; use std::cell::Cell; diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 4cf33b52e0d..d8ddb2b93a5 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, Chann use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; -use dom::bindings::error::Error; +use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; @@ -21,30 +21,42 @@ use dom::promise::Promise; use dom::window::Window; use dom_struct::dom_struct; use servo_media::ServoMedia; -use servo_media::audio::graph::{AudioGraph, ProcessingState}; -use servo_media::audio::graph::{OfflineAudioGraphOptions, RealTimeAudioGraphOptions}; -use servo_media::audio::graph_impl::NodeId; +use servo_media::audio::context::{AudioContext, ProcessingState}; +use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions}; +use servo_media::audio::graph::NodeId; use servo_media::audio::node::AudioNodeType; +use std::cell::Cell; +use std::collections::VecDeque; +use std::mem; use std::rc::Rc; use task_source::TaskSource; pub enum BaseAudioContextOptions { - AudioContext(RealTimeAudioGraphOptions), - OfflineAudioContext(OfflineAudioGraphOptions), + AudioContext(RealTimeAudioContextOptions), + OfflineAudioContext(OfflineAudioContextOptions), } #[dom_struct] pub struct BaseAudioContext { reflector_: Reflector, #[ignore_malloc_size_of = "servo_media"] - audio_graph: AudioGraph, + audio_context_impl: AudioContext, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination destination: Option>, - /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate - sample_rate: f32, + /// Resume promises which are soon to be fulfilled by a queued task. + #[ignore_malloc_size_of = "promises are hard"] + in_flight_resume_promises_queue: DomRefCell]>, ErrorResult)>>, /// https://webaudio.github.io/web-audio-api/#pendingresumepromises #[ignore_malloc_size_of = "promises are hard"] pending_resume_promises: DomRefCell>>, + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate + sample_rate: f32, + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state + /// Although servo-media already keeps track of the control thread state, + /// we keep a state flag here as well. This is so that we can synchronously + /// throw when trying to do things on the context when the context has just + /// been "closed()". + state: Cell, } impl BaseAudioContext { @@ -63,10 +75,12 @@ impl BaseAudioContext { let mut context = BaseAudioContext { reflector_: Reflector::new(), - audio_graph: ServoMedia::get().unwrap().create_audio_graph(Some(options.into())), + audio_context_impl: ServoMedia::get().unwrap().create_audio_context(options.into()), destination: None, - sample_rate, + in_flight_resume_promises_queue: Default::default(), pending_resume_promises: Default::default(), + sample_rate, + state: Cell::new(AudioContextState::Suspended), }; let mut options = unsafe { AudioNodeOptions::empty(global.get_cx()) }; @@ -79,36 +93,110 @@ impl BaseAudioContext { context } - pub fn audio_graph(&self) -> &AudioGraph { - &self.audio_graph + pub fn audio_context_impl(&self) -> &AudioContext { + &self.audio_context_impl } pub fn create_node_engine(&self, node_type: AudioNodeType) -> NodeId { - self.audio_graph.create_node(node_type) + self.audio_context_impl.create_node(node_type) } // https://webaudio.github.io/web-audio-api/#allowed-to-start pub fn is_allowed_to_start(&self) -> bool { - self.audio_graph.state() == ProcessingState::Suspended + self.state.get() == AudioContextState::Suspended + } + + /// Takes the pending resume promises. + /// + /// The result with which these promises will be fulfilled is passed here + /// and this method returns nothing because we actually just move the + /// current list of pending resume promises to the + /// `in_flight_resume_promises_queue` field. + /// + /// Each call to this method must be followed by a call to + /// `fulfill_in_flight_resume_promises`, to actually fulfill the promises + /// which were taken and moved to the in-flight queue. + #[allow(unrooted_must_root)] + fn take_pending_resume_promises(&self, result: ErrorResult) { + let pending_resume_promises = mem::replace( + &mut *self.pending_resume_promises.borrow_mut(), + vec![], + ); + self.in_flight_resume_promises_queue.borrow_mut().push_back(( + pending_resume_promises.into(), + result, + )); + } + + /// Fulfills the next in-flight resume promises queue after running a closure. + /// + /// See the comment on `take_pending_resume_promises` for why this method + /// does not take a list of promises to fulfill. Callers cannot just pop + /// the front list off of `in_flight_resume_promises_queue` and later fulfill + /// the promises because that would mean putting + /// `#[allow(unrooted_must_root)]` on even more functions, potentially + /// hiding actual safety bugs. + #[allow(unrooted_must_root)] + fn fulfill_in_flight_resume_promises(&self, f: F) + where + F: FnOnce(), + { + let (promises, result) = self.in_flight_resume_promises_queue + .borrow_mut() + .pop_front() + .expect("there should be at least one list of in flight resume promises"); + f(); + for promise in &*promises { + match result { + Ok(ref value) => promise.resolve_native(value), + Err(ref error) => promise.reject_error(error.clone()), + } + } + } + + /// Control thread processing state + pub fn control_thread_state(&self) -> ProcessingState { + self.audio_context_impl.state() + } + + /// Set audio context state + pub fn set_state_attribute(&self, state: AudioContextState) { + self.state.set(state); } pub fn resume(&self) { let window = DomRoot::downcast::(self.global()).unwrap(); let task_source = window.dom_manipulation_task_source(); - - // Set the state attribute to `running` and start rendering audio. let this = Trusted::new(self); - task_source.queue(task!(resume: move || { - let this = this.root(); - this.audio_graph.resume(); - }), window.upcast()).unwrap(); - // Queue a task to fire a simple event named `statechange` at the AudioContext. - task_source.queue_simple_event( - self.upcast(), - atom!("statechange"), - &window - ); + // Set the rendering thread state to 'running' and start + // rendering the audio graph. + match self.audio_context_impl.resume() { + Ok(()) => { + self.take_pending_resume_promises(Ok(())); + let _ = task_source.queue(task!(resume_success: move || { + let this = this.root(); + this.fulfill_in_flight_resume_promises(|| { + if this.state.get() != AudioContextState::Running { + this.state.set(AudioContextState::Running); + let window = DomRoot::downcast::(this.global()).unwrap(); + window.dom_manipulation_task_source().queue_simple_event( + this.upcast(), + atom!("statechange"), + &window + ); + } + }); + }), window.upcast()); + }, + Err(()) => { + self.take_pending_resume_promises(Err(Error::Type("Something went wrong".to_owned()))); + let _ = task_source.queue(task!(resume_error: move || { + let this = this.root(); + this.fulfill_in_flight_resume_promises(|| {}); + }), window.upcast()); + } + } } } @@ -120,13 +208,13 @@ impl BaseAudioContextMethods for BaseAudioContext { // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime fn CurrentTime(&self) -> Finite { - let current_time = self.audio_graph.current_time(); + let current_time = self.audio_context_impl.current_time(); Finite::wrap(current_time) } // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state fn State(&self) -> AudioContextState { - self.audio_graph.state().into() + self.state.get() } // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume @@ -136,21 +224,23 @@ impl BaseAudioContextMethods for BaseAudioContext { let promise = Promise::new(&self.global()); // Step 2. - let state = self.audio_graph.state(); - if state == ProcessingState::Closed { + if self.audio_context_impl.state() == ProcessingState::Closed { promise.reject_error(Error::InvalidState); return promise; } // Step 3. - if state == ProcessingState::Running { + if self.state.get() == AudioContextState::Running { promise.resolve_native(&()); return promise; } + // Push the promise into the queue to avoid passing a reference to + // `resume()`. This way we limit the usage of #[allow(unrooted_must_root)] + self.pending_resume_promises.borrow_mut().push(promise.clone()); + // Step 4. if !self.is_allowed_to_start() { - self.pending_resume_promises.borrow_mut().push(promise.clone()); return promise; } diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 4724f2a8c3a..1adfa2d0f23 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -80,8 +80,8 @@ use offscreen_gl_context::GLLimits; use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; -use servo_media::audio::graph::AudioGraph; -use servo_media::audio::graph_impl::NodeId; +use servo_media::audio::context::AudioContext; +use servo_media::audio::graph::NodeId; use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; @@ -432,6 +432,7 @@ unsafe_no_jsmanaged_fields!(InteractiveWindow); unsafe_no_jsmanaged_fields!(CanvasId); unsafe_no_jsmanaged_fields!(SourceSet); unsafe_no_jsmanaged_fields!(AudioGraph); +unsafe_no_jsmanaged_fields!(AudioContext); unsafe_no_jsmanaged_fields!(NodeId); unsafe impl<'a> JSTraceable for &'a str { From 9eebcb31c515d758b01630a27d7920dd14211da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 27 Jun 2018 10:04:01 +0200 Subject: [PATCH 15/87] AudioNode connection --- components/script/dom/audionode.rs | 30 +++++++++++++++++++---- components/script/dom/baseaudiocontext.rs | 6 ----- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 7b4cff4ee7f..f31c2808716 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -11,7 +11,7 @@ use dom::bindings::root::DomRoot; use dom::audioparam::AudioParam; use dom_struct::dom_struct; use servo_media::audio::graph::NodeId; -use servo_media::audio::node::AudioNodeType; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; use std::cell::Cell; // 32 is the minimum required by the spec for createBuffer() and the deprecated @@ -40,7 +40,7 @@ impl AudioNode { number_of_outputs: u32) -> AudioNode { AudioNode { reflector_: Reflector::new(), - node_id: context.create_node_engine(node_type), + node_id: context.audio_context_impl().create_node(node_type), context: DomRoot::from_ref(context), number_of_inputs, number_of_outputs, @@ -49,15 +49,35 @@ impl AudioNode { channel_interpretation: Cell::new(options.channelInterpretation.unwrap_or_default()), } } + + pub fn message(&self, message: AudioNodeMessage) { + self.context.audio_context_impl().message_node(self.node_id, message); + } + + pub fn node(&self) -> NodeId { + self.node_id + } } impl AudioNodeMethods for AudioNode { // https://webaudio.github.io/web-audio-api/#dom-audionode-connect fn Connect(&self, destination: &AudioNode, - _output: u32, - _input: u32) -> Fallible> { - // TODO + output: u32, + input: u32) -> Fallible> { + if self.context != destination.Context() { + return Err(Error::InvalidAccess); + } + + if output >= self.NumberOfOutputs() || + input >= destination.NumberOfInputs() { + return Err(Error::IndexSize); + } + + self.context.audio_context_impl().connect_ports( + self.node().output(output), destination.node().input(input) + ); + Ok(DomRoot::from_ref(destination)) } diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index d8ddb2b93a5..2a0ea434dd9 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -23,8 +23,6 @@ use dom_struct::dom_struct; use servo_media::ServoMedia; use servo_media::audio::context::{AudioContext, ProcessingState}; use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions}; -use servo_media::audio::graph::NodeId; -use servo_media::audio::node::AudioNodeType; use std::cell::Cell; use std::collections::VecDeque; use std::mem; @@ -97,10 +95,6 @@ impl BaseAudioContext { &self.audio_context_impl } - pub fn create_node_engine(&self, node_type: AudioNodeType) -> NodeId { - self.audio_context_impl.create_node(node_type) - } - // https://webaudio.github.io/web-audio-api/#allowed-to-start pub fn is_allowed_to_start(&self) -> bool { self.state.get() == AudioContextState::Suspended From cdd7995d34250b94aca4e5a76130b5f8c43086f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 27 Jun 2018 10:04:31 +0200 Subject: [PATCH 16/87] AudioScheduledSourceNode start and stop --- components/script/dom/audioscheduledsourcenode.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index 523ac633fb1..c6d495f90a1 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioSche use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::num::Finite; use dom_struct::dom_struct; -use servo_media::audio::node::AudioNodeType; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeType, AudioScheduledSourceNodeMessage}; #[dom_struct] pub struct AudioScheduledSourceNode { @@ -31,10 +31,16 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { event_handler!(ended, GetOnended, SetOnended); // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start - fn Start(&self, _when: Finite) { + fn Start(&self, when: Finite) { + self.node.message( + AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(*when)) + ); } // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-stop - fn Stop(&self, _when: Finite) { + fn Stop(&self, when: Finite) { + self.node.message( + AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Stop(*when)) + ); } } From 1c2d872e33adfaab5c06f54904b523d0ba23e948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 28 Jun 2018 10:24:59 +0200 Subject: [PATCH 17/87] Workaround resume issues --- components/script/dom/audiocontext.rs | 19 +++++++++++++------ components/script/dom/audionode.rs | 6 ++++-- components/script/dom/baseaudiocontext.rs | 22 ++++++++++------------ 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 2dd357ca2ec..6eb9cc781a9 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -46,11 +46,8 @@ impl AudioContext { // servo-media takes care of setting the default sample rate of the output device // and of resampling the audio output if needed. - // Step 5. - if context.is_allowed_to_start() { - // Step 6. - context.resume(); - } + // Steps 5 and 6 of the construction algorithm will happen in `resume`, + // after reflecting dom object. AudioContext { context, @@ -64,7 +61,9 @@ impl AudioContext { pub fn new(global: &GlobalScope, options: &AudioContextOptions) -> DomRoot { let context = AudioContext::new_inherited(global, options); - reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap) + let context = reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap); + context.resume(); + context } // https://webaudio.github.io/web-audio-api/#AudioContext-constructors @@ -73,6 +72,14 @@ impl AudioContext { let global = window.upcast::(); Ok(AudioContext::new(global, options)) } + + fn resume(&self) { + // Step 5. + if self.context.is_allowed_to_start() { + // Step 6. + self.context.resume(); + } + } } impl AudioContextMethods for AudioContext { diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index f31c2808716..c0c6668106b 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -65,8 +65,8 @@ impl AudioNodeMethods for AudioNode { destination: &AudioNode, output: u32, input: u32) -> Fallible> { - if self.context != destination.Context() { - return Err(Error::InvalidAccess); + if *(self.context) != *(destination.Context()) { + //XXX return Err(Error::InvalidAccess); } if output >= self.NumberOfOutputs() || @@ -74,6 +74,8 @@ impl AudioNodeMethods for AudioNode { return Err(Error::IndexSize); } + // XXX Check previous connections. + self.context.audio_context_impl().connect_ports( self.node().output(output), destination.node().input(input) ); diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 2a0ea434dd9..50092b81ebd 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -15,6 +15,7 @@ use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector}; use dom::bindings::root::DomRoot; +use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; use dom::oscillatornode::OscillatorNode; use dom::promise::Promise; @@ -100,6 +101,11 @@ impl BaseAudioContext { self.state.get() == AudioContextState::Suspended } + #[allow(unrooted_must_root)] + fn push_pending_resume_promise(&self, promise: &Rc) { + self.pending_resume_promises.borrow_mut().push(promise.clone()); + } + /// Takes the pending resume promises. /// /// The result with which these promises will be fulfilled is passed here @@ -162,7 +168,6 @@ impl BaseAudioContext { let window = DomRoot::downcast::(self.global()).unwrap(); let task_source = window.dom_manipulation_task_source(); let this = Trusted::new(self); - // Set the rendering thread state to 'running' and start // rendering the audio graph. match self.audio_context_impl.resume() { @@ -173,21 +178,16 @@ impl BaseAudioContext { this.fulfill_in_flight_resume_promises(|| { if this.state.get() != AudioContextState::Running { this.state.set(AudioContextState::Running); - let window = DomRoot::downcast::(this.global()).unwrap(); - window.dom_manipulation_task_source().queue_simple_event( - this.upcast(), - atom!("statechange"), - &window - ); + //XXX this.upcast::().fire_event(atom!("statechange")); } + }); }), window.upcast()); }, Err(()) => { self.take_pending_resume_promises(Err(Error::Type("Something went wrong".to_owned()))); let _ = task_source.queue(task!(resume_error: move || { - let this = this.root(); - this.fulfill_in_flight_resume_promises(|| {}); + this.root().fulfill_in_flight_resume_promises(|| {}) }), window.upcast()); } } @@ -229,9 +229,7 @@ impl BaseAudioContextMethods for BaseAudioContext { return promise; } - // Push the promise into the queue to avoid passing a reference to - // `resume()`. This way we limit the usage of #[allow(unrooted_must_root)] - self.pending_resume_promises.borrow_mut().push(promise.clone()); + self.push_pending_resume_promise(&promise); // Step 4. if !self.is_allowed_to_start() { From 07c0450e290ad7fa3f12977940bfe6c61f283fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 28 Jun 2018 10:39:04 +0200 Subject: [PATCH 18/87] Get destination node engine from context --- components/script/dom/audiodestinationnode.rs | 4 +++- components/script/dom/audionode.rs | 6 +++++- components/script/dom/audioscheduledsourcenode.rs | 3 ++- components/script/dom/baseaudiocontext.rs | 5 +++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs index 0d3b5798c87..83cfedb8584 100644 --- a/components/script/dom/audiodestinationnode.rs +++ b/components/script/dom/audiodestinationnode.rs @@ -21,7 +21,9 @@ impl AudioDestinationNode { fn new_inherited(context: &BaseAudioContext, options: &AudioNodeOptions) -> AudioDestinationNode { AudioDestinationNode { - node: AudioNode::new_inherited(AudioNodeType::DestinationNode, context, options, 1, 1), + node: AudioNode::new_inherited(AudioNodeType::DestinationNode, + Some(context.destination_node()), + context, options, 1, 1), } } diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index c0c6668106b..e8c03fbd625 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -34,13 +34,17 @@ pub struct AudioNode { impl AudioNode { pub fn new_inherited(node_type: AudioNodeType, + node_id: Option, context: &BaseAudioContext, options: &AudioNodeOptions, number_of_inputs: u32, number_of_outputs: u32) -> AudioNode { + let node_id = node_id.unwrap_or_else(|| { + context.audio_context_impl().create_node(node_type) + }); AudioNode { reflector_: Reflector::new(), - node_id: context.audio_context_impl().create_node(node_type), + node_id, context: DomRoot::from_ref(context), number_of_inputs, number_of_outputs, diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index c6d495f90a1..6e430cf8fed 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -21,7 +21,8 @@ impl AudioScheduledSourceNode { number_of_inputs: u32, number_of_outputs: u32) -> AudioScheduledSourceNode { AudioScheduledSourceNode { - node: AudioNode::new_inherited(node_type, context, options, number_of_inputs, number_of_outputs), + node: AudioNode::new_inherited(node_type, None /* node_id */, + context, options, number_of_inputs, number_of_outputs), } } } diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 50092b81ebd..e0172b84d1c 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -24,6 +24,7 @@ use dom_struct::dom_struct; use servo_media::ServoMedia; use servo_media::audio::context::{AudioContext, ProcessingState}; use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions}; +use servo_media::audio::graph::NodeId; use std::cell::Cell; use std::collections::VecDeque; use std::mem; @@ -96,6 +97,10 @@ impl BaseAudioContext { &self.audio_context_impl } + pub fn destination_node(&self) -> NodeId { + self.audio_context_impl.dest_node() + } + // https://webaudio.github.io/web-audio-api/#allowed-to-start pub fn is_allowed_to_start(&self) -> bool { self.state.get() == AudioContextState::Suspended From 885addfaaeb6002c0f77e0b0d6ea640a1a69053c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 29 Jun 2018 00:09:29 -0700 Subject: [PATCH 19/87] Fix inheritance of DOM structs (#1) The incorrect inheritance ends up overlapping EventTarget fields with other fields causing some DOMRefCells to start out broken and panic. --- components/script/dom/audionode.rs | 6 +++--- components/script/dom/baseaudiocontext.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index e8c03fbd625..39685b5db87 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -6,9 +6,9 @@ use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::reflector::Reflector; use dom::bindings::root::DomRoot; use dom::audioparam::AudioParam; +use dom::eventtarget::EventTarget; use dom_struct::dom_struct; use servo_media::audio::graph::NodeId; use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; @@ -21,7 +21,7 @@ pub static MAX_CHANNEL_COUNT: u32 = 32; #[dom_struct] pub struct AudioNode { - reflector_: Reflector, + eventtarget: EventTarget, #[ignore_malloc_size_of = "servo_media"] node_id: NodeId, context: DomRoot, @@ -43,7 +43,7 @@ impl AudioNode { context.audio_context_impl().create_node(node_type) }); AudioNode { - reflector_: Reflector::new(), + eventtarget: EventTarget::new_inherited(), node_id, context: DomRoot::from_ref(context), number_of_inputs, diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index e0172b84d1c..16fd60c02f9 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -13,7 +13,7 @@ use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::{DomObject, Reflector}; +use dom::bindings::reflector::DomObject; use dom::bindings::root::DomRoot; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; @@ -38,7 +38,7 @@ pub enum BaseAudioContextOptions { #[dom_struct] pub struct BaseAudioContext { - reflector_: Reflector, + eventtarget: EventTarget, #[ignore_malloc_size_of = "servo_media"] audio_context_impl: AudioContext, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination @@ -74,7 +74,7 @@ impl BaseAudioContext { let sample_rate = options.sample_rate; let mut context = BaseAudioContext { - reflector_: Reflector::new(), + eventtarget: EventTarget::new_inherited(), audio_context_impl: ServoMedia::get().unwrap().create_audio_context(options.into()), destination: None, in_flight_resume_promises_queue: Default::default(), From 7380f69f77608372e16659fc74b45ad8c5a72b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 29 Jun 2018 09:11:11 +0200 Subject: [PATCH 20/87] Initial AudioParam bindings --- components/script/dom/audionode.rs | 4 +- components/script/dom/audioparam.rs | 75 ++++++++++++++++--- .../script/dom/audioscheduledsourcenode.rs | 5 ++ components/script/dom/baseaudiocontext.rs | 11 ++- components/script/dom/macros.rs | 53 +++++++++++++ components/script/dom/oscillatornode.rs | 68 ++++++++++------- .../script/dom/webidls/AudioParam.webidl | 18 +++-- .../script/dom/webidls/OscillatorNode.webidl | 8 +- 8 files changed, 187 insertions(+), 55 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 39685b5db87..e6eea52d5f5 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -58,7 +58,7 @@ impl AudioNode { self.context.audio_context_impl().message_node(self.node_id, message); } - pub fn node(&self) -> NodeId { + pub fn node_id(&self) -> NodeId { self.node_id } } @@ -81,7 +81,7 @@ impl AudioNodeMethods for AudioNode { // XXX Check previous connections. self.context.audio_context_impl().connect_ports( - self.node().output(output), destination.node().input(input) + self.node_id().output(output), destination.node_id().input(input) ); Ok(DomRoot::from_ref(destination)) diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index 1b42af0a4e5..b5bad9fcb9b 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -3,30 +3,44 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::AudioParamBinding; -use dom::bindings::codegen::Bindings::AudioParamBinding::AudioParamMethods; +use dom::bindings::codegen::Bindings::AudioParamBinding::{AudioParamMethods, AutomationRate}; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::root::DomRoot; -use dom::globalscope::GlobalScope; +use dom::bindings::trace::JSTraceable; +use dom::window::Window; use dom_struct::dom_struct; +use malloc_size_of::MallocSizeOf; +use servo_media::audio::param::RampKind; use std::cell::Cell; +pub trait AudioParamImpl: JSTraceable + MallocSizeOf { + fn set_value(&self, value: f32); + fn set_value_at_time(&self, value: f32, start_time: f64); + fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64); + fn set_target_at_time(&self, value: f32, start_time: f64, time_constant: f32); +} + #[dom_struct] pub struct AudioParam { reflector_: Reflector, - value: Cell, + param_impl: Box, + automation_rate: Cell, default_value: f32, min_value: f32, max_value: f32, } impl AudioParam { - pub fn new_inherited(default_value: f32, + pub fn new_inherited(param_impl: Box, + automation_rate: AutomationRate, + default_value: f32, min_value: f32, max_value: f32) -> AudioParam { AudioParam { reflector_: Reflector::new(), - value: Cell::new(default_value), + param_impl, + automation_rate: Cell::new(automation_rate), default_value, min_value, max_value, @@ -34,22 +48,35 @@ impl AudioParam { } #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope, + pub fn new(window: &Window, + param_impl: Box, + automation_rate: AutomationRate, default_value: f32, min_value: f32, max_value: f32) -> DomRoot { - let audio_param = AudioParam::new_inherited(default_value, min_value, max_value); - reflect_dom_object(Box::new(audio_param), global, AudioParamBinding::Wrap) + let audio_param = AudioParam::new_inherited(param_impl, automation_rate, + default_value, min_value, max_value); + reflect_dom_object(Box::new(audio_param), window, AudioParamBinding::Wrap) } } impl AudioParamMethods for AudioParam { + fn AutomationRate(&self) -> AutomationRate { + self.automation_rate.get() + } + + fn SetAutomationRate(&self, automation_rate: AutomationRate) { + self.automation_rate.set(automation_rate); + // XXX set servo-media param automation rate + } + fn Value(&self) -> Finite { - Finite::wrap(self.value.get()) + // XXX + Finite::wrap(0.) } fn SetValue(&self, value: Finite) { - self.value.set(*value); + self.param_impl.set_value(*value); } fn DefaultValue(&self) -> Finite { @@ -63,4 +90,32 @@ impl AudioParamMethods for AudioParam { fn MaxValue(&self) -> Finite { Finite::wrap(self.max_value) } + + fn SetValueAtTime(&self, value: Finite, start_time: Finite) + -> DomRoot + { + self.param_impl.set_value_at_time(*value, *start_time); + DomRoot::from_ref(self) + } + + fn LinearRampToValueAtTime(&self, value: Finite, end_time: Finite) + -> DomRoot + { + self.param_impl.ramp_to_value_at_time(RampKind::Linear, *value, *end_time); + DomRoot::from_ref(self) + } + + fn ExponentialRampToValueAtTime(&self, value: Finite, end_time: Finite) + -> DomRoot + { + self.param_impl.ramp_to_value_at_time(RampKind::Exponential, *value, *end_time); + DomRoot::from_ref(self) + } + + fn SetTargetAtTime(&self, target: Finite, start_time: Finite, time_constant: Finite) + -> DomRoot + { + self.param_impl.set_target_at_time(*target, *start_time, *time_constant); + DomRoot::from_ref(self) + } } diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index 6e430cf8fed..8c8240fdf67 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -7,6 +7,7 @@ use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioSche use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::num::Finite; use dom_struct::dom_struct; +use servo_media::audio::graph::NodeId; use servo_media::audio::node::{AudioNodeMessage, AudioNodeType, AudioScheduledSourceNodeMessage}; #[dom_struct] @@ -25,6 +26,10 @@ impl AudioScheduledSourceNode { context, options, number_of_inputs, number_of_outputs), } } + + pub fn node_id(&self) -> NodeId { + self.node.node_id() + } } impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 16fd60c02f9..61bdbe03770 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -40,7 +40,7 @@ pub enum BaseAudioContextOptions { pub struct BaseAudioContext { eventtarget: EventTarget, #[ignore_malloc_size_of = "servo_media"] - audio_context_impl: AudioContext, + audio_context_impl: Rc, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination destination: Option>, /// Resume promises which are soon to be fulfilled by a queued task. @@ -75,7 +75,7 @@ impl BaseAudioContext { let mut context = BaseAudioContext { eventtarget: EventTarget::new_inherited(), - audio_context_impl: ServoMedia::get().unwrap().create_audio_context(options.into()), + audio_context_impl: Rc::new(ServoMedia::get().unwrap().create_audio_context(options.into())), destination: None, in_flight_resume_promises_queue: Default::default(), pending_resume_promises: Default::default(), @@ -93,8 +93,8 @@ impl BaseAudioContext { context } - pub fn audio_context_impl(&self) -> &AudioContext { - &self.audio_context_impl + pub fn audio_context_impl(&self) -> Rc { + self.audio_context_impl.clone() } pub fn destination_node(&self) -> NodeId { @@ -183,9 +183,8 @@ impl BaseAudioContext { this.fulfill_in_flight_resume_promises(|| { if this.state.get() != AudioContextState::Running { this.state.set(AudioContextState::Running); - //XXX this.upcast::().fire_event(atom!("statechange")); + this.upcast::().fire_event(atom!("statechange")); } - }); }), window.upcast()); }, diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index b2963305aa6..1d8ea2f371d 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -629,3 +629,56 @@ macro_rules! handle_potential_webgl_error { handle_potential_webgl_error!($context, $call, ()); }; } + +macro_rules! audio_param_impl( + ($struct:ident, $node_type:ident, $message_type:ident, $setter:ident) => ( + #[derive(JSTraceable, MallocSizeOf)] + struct $struct { + #[ignore_malloc_size_of = "Rc"] + context: Rc, + #[ignore_malloc_size_of = "servo_media"] + node: NodeId, + } + + impl $struct { + pub fn new(context: Rc, + node: NodeId) -> Self { + Self { + context, + node, + } + } + } + + impl AudioParamImpl for $struct { + fn set_value(&self, _value: f32) {} + + fn set_value_at_time(&self, value: f32, start_time: f64) { + self.context.message_node( + self.node, + AudioNodeMessage::$node_type($message_type::$setter( + UserAutomationEvent::SetValueAtTime(value, start_time), + )), + ); + } + + fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64) { + self.context.message_node( + self.node, + AudioNodeMessage::$node_type($message_type::$setter( + UserAutomationEvent::RampToValueAtTime(ramp_kind, value, end_time), + )), + ); + } + + fn set_target_at_time(&self, target: f32, start_time: f64, time_constant: f32) { + self.context.message_node( + self.node, + AudioNodeMessage::$node_type($message_type::$setter( + UserAutomationEvent::SetTargetAtTime(target, start_time, time_constant.into()), + )), + ); + } + } + ); +); diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index a6e65260ce1..77d169feac8 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -2,26 +2,38 @@ * License, v.2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::audioparam::{AudioParam, AudioParamImpl}; use dom::audioscheduledsourcenode::AudioScheduledSourceNode; use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOptions, OscillatorType}; +use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; -use servo_media::audio::node::AudioNodeType; +use servo_media::audio::context::AudioContext; +use servo_media::audio::graph::NodeId; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; use servo_media::audio::oscillator_node::OscillatorNodeOptions as ServoMediaOscillatorOptions; use servo_media::audio::oscillator_node::OscillatorType as ServoMediaOscillatorType; +use servo_media::audio::oscillator_node::OscillatorNodeMessage; +use servo_media::audio::param::{UserAutomationEvent, RampKind}; +use std::f32; +use std::rc::Rc; + +audio_param_impl!(Frequency, OscillatorNode, OscillatorNodeMessage, SetFrequency); +//XXX audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); #[dom_struct] pub struct OscillatorNode { node: AudioScheduledSourceNode, oscillator_type: OscillatorType, - // frequency: AudioParam, - // detune: AudioParam, + frequency: DomRoot, + //XXX detune: DomRoot, } impl OscillatorNode { @@ -36,15 +48,29 @@ impl OscillatorNode { node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); + let node = AudioScheduledSourceNode::new_inherited( + AudioNodeType::OscillatorNode(oscillator_options.into()), + context, + &node_options, + 0, /* inputs */ + 1, /* outputs */ + ); + let frequency = Frequency::new(context.audio_context_impl(), node.node_id()); + let frequency = AudioParam::new(window, + Box::new(frequency), + AutomationRate::A_rate, + 440., f32::MIN, f32::MAX); + /*XXX let detune = Detune::new(context.audio_context_impl(), node.node_id()); + let detune = AudioParam::new(window, + Box::new(detune), + AutomationRate::A_rate, + 0., -440. / 2., 440. / 2.);*/ + OscillatorNode { - node: AudioScheduledSourceNode::new_inherited( - AudioNodeType::OscillatorNode(oscillator_options.into()), - context, - &node_options, - 0, /* inputs */ - 1, /* outputs */ - ), - oscillator_type: oscillator_options.type_, + node, + oscillator_type: oscillator_options.type_, + frequency, + //XXX detune, } } @@ -67,24 +93,12 @@ impl OscillatorNode { } } -/*impl OscillatorNodeMethods for OscillatorNode { - fn SetPeriodicWave(&self, periodic_wave: PeriodicWave) { -// XXX +impl OscillatorNodeMethods for OscillatorNode { + fn Frequency(&self) -> DomRoot { + DomRoot::from_ref(&self.frequency) + } } -fn Type(&self) -> OscillatorType { -self.oscillator_type -} - -fn Frequency(&self) -> DomRoot { -DomRoot::from_ref(&self.frequency) -} - -fn Detune(&self) -> DomRoot { -DomRoot::from_ref(&self.detune) -} -}*/ - impl<'a> From<&'a OscillatorOptions> for ServoMediaOscillatorOptions { fn from(options: &'a OscillatorOptions) -> Self { Self { diff --git a/components/script/dom/webidls/AudioParam.webidl b/components/script/dom/webidls/AudioParam.webidl index 3c0c4870c2b..4e6c6acea04 100644 --- a/components/script/dom/webidls/AudioParam.webidl +++ b/components/script/dom/webidls/AudioParam.webidl @@ -6,18 +6,24 @@ * https://webaudio.github.io/web-audio-api/#dom-audioparam */ +enum AutomationRate { + "a-rate", + "k-rate" +}; + [Exposed=Window] interface AudioParam { attribute float value; + attribute AutomationRate automationRate; readonly attribute float defaultValue; readonly attribute float minValue; readonly attribute float maxValue; -// AudioParam setValueAtTime(float value, double startTime); -// AudioParam linearRampToValueAtTime(float value, double endTime); -// AudioParam exponentialRampToValueAtTime(float value, double endTime); -// AudioParam setTargetAtTime(float target, -// double startTime, -// float timeConstant); + AudioParam setValueAtTime(float value, double startTime); + AudioParam linearRampToValueAtTime(float value, double endTime); + AudioParam exponentialRampToValueAtTime(float value, double endTime); + AudioParam setTargetAtTime(float target, + double startTime, + float timeConstant); // AudioParam setValueCurveAtTime(sequence values, // double startTime, // double duration); diff --git a/components/script/dom/webidls/OscillatorNode.webidl b/components/script/dom/webidls/OscillatorNode.webidl index 30197d2248c..c4fc2d01c22 100644 --- a/components/script/dom/webidls/OscillatorNode.webidl +++ b/components/script/dom/webidls/OscillatorNode.webidl @@ -24,11 +24,11 @@ dictionary OscillatorOptions : AudioNodeOptions { [Exposed=Window, Constructor (BaseAudioContext context, optional OscillatorOptions options)] interface OscillatorNode : AudioScheduledSourceNode { -/* [SetterThrows] - attribute OscillatorType type; +// [SetterThrows] +// attribute OscillatorType type; readonly attribute AudioParam frequency; - readonly attribute AudioParam detune; +// readonly attribute AudioParam detune; - void setPeriodicWave (PeriodicWave periodicWave);*/ +// void setPeriodicWave (PeriodicWave periodicWave); }; From 97aa1429938a5468dbbd8578a7e8ed0e17bfd64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 29 Jun 2018 09:53:48 +0200 Subject: [PATCH 21/87] Queue statechange event --- components/script/dom/baseaudiocontext.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 61bdbe03770..c6b43fcee8e 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -183,7 +183,12 @@ impl BaseAudioContext { this.fulfill_in_flight_resume_promises(|| { if this.state.get() != AudioContextState::Running { this.state.set(AudioContextState::Running); - this.upcast::().fire_event(atom!("statechange")); + let window = DomRoot::downcast::(this.global()).unwrap(); + window.dom_manipulation_task_source().queue_simple_event( + this.upcast(), + atom!("statechange"), + &window + ); } }); }), window.upcast()); From 986c2f78424c88dcbab23c2f985ec48a5853407d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 29 Jun 2018 11:55:45 +0200 Subject: [PATCH 22/87] Expose more AudioParam methods --- components/script/dom/audioparam.rs | 12 ++++++++++ components/script/dom/macros.rs | 22 ++++++++++++++++++- .../script/dom/webidls/AudioParam.webidl | 4 ++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index b5bad9fcb9b..b21ee86b57b 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -19,6 +19,8 @@ pub trait AudioParamImpl: JSTraceable + MallocSizeOf { fn set_value_at_time(&self, value: f32, start_time: f64); fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64); fn set_target_at_time(&self, value: f32, start_time: f64, time_constant: f32); + fn cancel_scheduled_values(&self, cancel_time: f64); + fn cancel_and_hold_at_time(&self, cancel_time: f64); } #[dom_struct] @@ -118,4 +120,14 @@ impl AudioParamMethods for AudioParam { self.param_impl.set_target_at_time(*target, *start_time, *time_constant); DomRoot::from_ref(self) } + + fn CancelScheduledValues(&self, cancel_time: Finite) -> DomRoot { + self.param_impl.cancel_scheduled_values(*cancel_time); + DomRoot::from_ref(self) + } + + fn CancelAndHoldAtTime(&self, cancel_time: Finite) -> DomRoot { + self.param_impl.cancel_and_hold_at_time(*cancel_time); + DomRoot::from_ref(self) + } } diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 1d8ea2f371d..923d0bb9873 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -651,7 +651,9 @@ macro_rules! audio_param_impl( } impl AudioParamImpl for $struct { - fn set_value(&self, _value: f32) {} + fn set_value(&self, value: f32) { + self.set_value_at_time(value, self.context.current_time()); + } fn set_value_at_time(&self, value: f32, start_time: f64) { self.context.message_node( @@ -679,6 +681,24 @@ macro_rules! audio_param_impl( )), ); } + + fn cancel_scheduled_values(&self, cancel_time: f64) { + self.context.message_node( + self.node, + AudioNodeMessage::$node_type($message_type::$setter( + UserAutomationEvent::CancelScheduledValues(cancel_time), + )), + ); + } + + fn cancel_and_hold_at_time(&self, cancel_time: f64) { + self.context.message_node( + self.node, + AudioNodeMessage::$node_type($message_type::$setter( + UserAutomationEvent::CancelAndHoldAtTime(cancel_time), + )), + ); + } } ); ); diff --git a/components/script/dom/webidls/AudioParam.webidl b/components/script/dom/webidls/AudioParam.webidl index 4e6c6acea04..506a0b18082 100644 --- a/components/script/dom/webidls/AudioParam.webidl +++ b/components/script/dom/webidls/AudioParam.webidl @@ -27,6 +27,6 @@ interface AudioParam { // AudioParam setValueCurveAtTime(sequence values, // double startTime, // double duration); -// AudioParam cancelScheduledValues(double cancelTime); -// AudioParam cancelAndHoldAtTime(double cancelTime); + AudioParam cancelScheduledValues(double cancelTime); + AudioParam cancelAndHoldAtTime(double cancelTime); }; From 02c39eb9efd7baa30f801cba414c76e066885adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 29 Jun 2018 14:41:58 +0200 Subject: [PATCH 23/87] GainNode --- components/script/dom/gainnode.rs | 97 +++++++++++++++++++ components/script/dom/mod.rs | 1 + components/script/dom/webidls/GainNode.webidl | 17 ++++ 3 files changed, 115 insertions(+) create mode 100644 components/script/dom/gainnode.rs create mode 100644 components/script/dom/webidls/GainNode.webidl diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs new file mode 100644 index 00000000000..ab146b42a4f --- /dev/null +++ b/components/script/dom/gainnode.rs @@ -0,0 +1,97 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v.2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audionode::AudioNode; +use dom::audioparam::{AudioParam, AudioParamImpl}; +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::codegen::Bindings::GainNodeBinding::{self, GainNodeMethods, GainOptions}; +use dom::bindings::error::Fallible; +use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::DomRoot; +use dom::window::Window; +use dom_struct::dom_struct; +use servo_media::audio::context::AudioContext; +use servo_media::audio::gain_node::{GainNodeMessage, GainNodeOptions}; +use servo_media::audio::graph::NodeId; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; +use servo_media::audio::param::{UserAutomationEvent, RampKind}; +use std::f32; +use std::rc::Rc; + +audio_param_impl!(Gain, GainNode, GainNodeMessage, SetGain); + +#[dom_struct] +pub struct GainNode { + node: AudioNode, + gain: DomRoot, +} + +impl GainNode { + #[allow(unsafe_code)] + #[allow(unrooted_must_root)] + pub fn new_inherited( + window: &Window, + context: &BaseAudioContext, + gain_options: &GainOptions, + ) -> GainNode { + let mut node_options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; + node_options.channelCount = Some(2); + node_options.channelCountMode = Some(ChannelCountMode::Max); + node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); + let node = AudioNode::new_inherited( + AudioNodeType::GainNode(gain_options.into()), + None, + context, + &node_options, + 1, // inputs + 1, // outputs + ); + let gain = Gain::new(context.audio_context_impl(), node.node_id()); + let gain = AudioParam::new(window, + Box::new(gain), + AutomationRate::A_rate, + 1., // default value + f32::MIN, // min value + f32::MAX, // max value + ); + GainNode { + node, + gain + } + } + + #[allow(unrooted_must_root)] + pub fn new(window: &Window, + context: &BaseAudioContext, + options: &GainOptions + ) -> DomRoot { + let node = GainNode::new_inherited(window, context, options); + reflect_dom_object(Box::new(node), window, GainNodeBinding::Wrap) + } + + pub fn Constructor( + window: &Window, + context: &BaseAudioContext, + options: &GainOptions, + ) -> Fallible> { + Ok(GainNode::new(window, context, options)) + } +} + +impl GainNodeMethods for GainNode { + fn Gain(&self) -> DomRoot { + DomRoot::from_ref(&self.gain) + } +} + +impl<'a> From<&'a GainOptions> for GainNodeOptions { + fn from(options: &'a GainOptions) -> Self { + Self { + gain: *options.gain, + } + } +} diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index ed72a38be50..794d0c65a4d 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -296,6 +296,7 @@ pub mod filereader; pub mod filereadersync; pub mod focusevent; pub mod formdata; +pub mod gainnode; pub mod gamepad; pub mod gamepadbutton; pub mod gamepadbuttonlist; diff --git a/components/script/dom/webidls/GainNode.webidl b/components/script/dom/webidls/GainNode.webidl new file mode 100644 index 00000000000..45021aac1dc --- /dev/null +++ b/components/script/dom/webidls/GainNode.webidl @@ -0,0 +1,17 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#gainnode + */ + +dictionary GainOptions : AudioNodeOptions { + float gain = 1.0; +}; + +[Exposed=Window, + Constructor (BaseAudioContext context, optional GainOptions options)] + interface GainNode : AudioNode { + readonly attribute AudioParam gain; + }; From 0e92efbb79cfeb92a9e64cea378457b489517cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 29 Jun 2018 16:41:55 +0200 Subject: [PATCH 24/87] BaseAudioContext.CreateGain() --- components/script/dom/baseaudiocontext.rs | 10 ++++++++++ components/script/dom/webidls/BaseAudioContext.webidl | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index c6b43fcee8e..9152fad8b3e 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -8,6 +8,7 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; +use dom::bindings::codegen::Bindings::GainNodeBinding::GainOptions; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; @@ -16,6 +17,7 @@ use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; use dom::bindings::root::DomRoot; use dom::eventtarget::EventTarget; +use dom::gainnode::GainNode; use dom::globalscope::GlobalScope; use dom::oscillatornode::OscillatorNode; use dom::promise::Promise; @@ -267,6 +269,14 @@ impl BaseAudioContextMethods for BaseAudioContext { let options = unsafe { OscillatorOptions::empty(window.get_cx()) }; OscillatorNode::new(&window, &self, &options) } + + #[allow(unsafe_code)] + fn CreateGain(&self) -> DomRoot { + let global = self.global(); + let window = global.as_window(); + let options = unsafe { GainOptions::empty(window.get_cx()) }; + GainNode::new(&window, &self, &options) + } } impl From for AudioContextState { diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl index 81e0817c8cd..9adb5600fbb 100644 --- a/components/script/dom/webidls/BaseAudioContext.webidl +++ b/components/script/dom/webidls/BaseAudioContext.webidl @@ -36,7 +36,7 @@ interface BaseAudioContext : EventTarget { // optional unsigned long numberOfInputChannels = 2, // optional unsigned long numberOfOutputChannels = 2); // AnalyserNode createAnalyser(); - // GainNode createGain(); + GainNode createGain(); // DelayNode createDelay(optional double maxDelayTime = 1); // BiquadFilterNode createBiquadFilter(); // IIRFilterNode createIIRFilter(sequence feedforward, From 93990d437e013c42a991e68d082c7d2c0f018ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 29 Jun 2018 18:07:23 +0200 Subject: [PATCH 25/87] OscillatorNode detune param --- components/script/dom/oscillatornode.rs | 14 +++++++++----- .../script/dom/webidls/OscillatorNode.webidl | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 77d169feac8..7a771916834 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -26,14 +26,14 @@ use std::f32; use std::rc::Rc; audio_param_impl!(Frequency, OscillatorNode, OscillatorNodeMessage, SetFrequency); -//XXX audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); +audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); #[dom_struct] pub struct OscillatorNode { node: AudioScheduledSourceNode, oscillator_type: OscillatorType, frequency: DomRoot, - //XXX detune: DomRoot, + detune: DomRoot, } impl OscillatorNode { @@ -60,17 +60,17 @@ impl OscillatorNode { Box::new(frequency), AutomationRate::A_rate, 440., f32::MIN, f32::MAX); - /*XXX let detune = Detune::new(context.audio_context_impl(), node.node_id()); + let detune = Detune::new(context.audio_context_impl(), node.node_id()); let detune = AudioParam::new(window, Box::new(detune), AutomationRate::A_rate, - 0., -440. / 2., 440. / 2.);*/ + 0., -440. / 2., 440. / 2.); OscillatorNode { node, oscillator_type: oscillator_options.type_, frequency, - //XXX detune, + detune, } } @@ -97,6 +97,10 @@ impl OscillatorNodeMethods for OscillatorNode { fn Frequency(&self) -> DomRoot { DomRoot::from_ref(&self.frequency) } + + fn Detune(&self) -> DomRoot { + DomRoot::from_ref(&self.detune) + } } impl<'a> From<&'a OscillatorOptions> for ServoMediaOscillatorOptions { diff --git a/components/script/dom/webidls/OscillatorNode.webidl b/components/script/dom/webidls/OscillatorNode.webidl index c4fc2d01c22..84c6de45967 100644 --- a/components/script/dom/webidls/OscillatorNode.webidl +++ b/components/script/dom/webidls/OscillatorNode.webidl @@ -28,7 +28,7 @@ interface OscillatorNode : AudioScheduledSourceNode { // attribute OscillatorType type; readonly attribute AudioParam frequency; -// readonly attribute AudioParam detune; + readonly attribute AudioParam detune; // void setPeriodicWave (PeriodicWave periodicWave); }; From 3fe38a99ad39769ae676bec16ffd5b1063acae39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Sat, 30 Jun 2018 10:45:40 +0200 Subject: [PATCH 26/87] AudioBuffer stub --- components/script/dom/audiobuffer.rs | 82 +++++++++++++++++++ components/script/dom/audionode.rs | 2 +- components/script/dom/mod.rs | 1 + .../script/dom/webidls/AudioBuffer.webidl | 29 +++++++ 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 components/script/dom/audiobuffer.rs create mode 100644 components/script/dom/webidls/AudioBuffer.webidl diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs new file mode 100644 index 00000000000..b5a8f43ca9a --- /dev/null +++ b/components/script/dom/audiobuffer.rs @@ -0,0 +1,82 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audionode::MAX_CHANNEL_COUNT; +use dom::bindings::codegen::Bindings::AudioBufferBinding::{self, AudioBufferMethods, AudioBufferOptions}; +use dom::bindings::error::{Error, Fallible}; +use dom::bindings::num::Finite; +use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::window::Window; +use dom_struct::dom_struct; +use smallvec::SmallVec; + +#[derive(JSTraceable, MallocSizeOf)] +struct AudioChannel(pub Vec); + +impl AudioChannel { + pub fn new(capacity: usize) -> AudioChannel { + AudioChannel(Vec::with_capacity(capacity)) + } +} + +#[dom_struct] +pub struct AudioBuffer { + reflector_: Reflector, + internal_data: SmallVec<[AudioChannel; MAX_CHANNEL_COUNT as usize]>, + sample_rate: f32, + length: u32, + duration: f64, + number_of_channels: u32, +} + +impl AudioBuffer { + #[allow(unrooted_must_root)] + #[allow(unsafe_code)] + pub fn new_inherited(options: &AudioBufferOptions) -> AudioBuffer { + let mut internal_data = SmallVec::new(); + unsafe { internal_data.set_len(options.numberOfChannels as usize); } + AudioBuffer { + reflector_: Reflector::new(), + internal_data, + sample_rate: *options.sampleRate, + length: options.length, + duration: options.length as f64 / *options.sampleRate as f64, + number_of_channels: options.numberOfChannels, + } + } + + #[allow(unrooted_must_root)] + pub fn new(global: &Window, + options: &AudioBufferOptions) -> DomRoot { + let buffer = AudioBuffer::new_inherited(options); + reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) + } + + pub fn Constructor(window: &Window, + options: &AudioBufferOptions) -> Fallible> { + if options.numberOfChannels > MAX_CHANNEL_COUNT { + return Err(Error::NotSupported); + } + Ok(AudioBuffer::new(window, options)) + } +} + +impl AudioBufferMethods for AudioBuffer { + fn SampleRate(&self) -> Finite { + Finite::wrap(self.sample_rate) + } + + fn Length(&self) -> u32 { + self.length + } + + fn Duration(&self) -> Finite { + Finite::wrap(self.duration) + } + + fn NumberOfChannels(&self) -> u32 { + self.number_of_channels + } +} diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index e6eea52d5f5..f3b26937497 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -17,7 +17,7 @@ use std::cell::Cell; // 32 is the minimum required by the spec for createBuffer() and the deprecated // createScriptProcessor() and matches what is used by Blink and Gecko. // The limit protects against large memory allocations. -pub static MAX_CHANNEL_COUNT: u32 = 32; +pub const MAX_CHANNEL_COUNT: u32 = 32; #[dom_struct] pub struct AudioNode { diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 794d0c65a4d..f616922fce6 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -216,6 +216,7 @@ pub mod abstractworker; pub mod abstractworkerglobalscope; pub mod activation; pub mod attr; +pub mod audiobuffer; pub mod audiocontext; pub mod audiodestinationnode; pub mod audionode; diff --git a/components/script/dom/webidls/AudioBuffer.webidl b/components/script/dom/webidls/AudioBuffer.webidl new file mode 100644 index 00000000000..7ec015ecb2f --- /dev/null +++ b/components/script/dom/webidls/AudioBuffer.webidl @@ -0,0 +1,29 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#audiobuffer + */ + +dictionary AudioBufferOptions { + unsigned long numberOfChannels = 1; + required unsigned long length; + required float sampleRate; +}; + +[Exposed=Window, + Constructor (AudioBufferOptions options)] +interface AudioBuffer { + readonly attribute float sampleRate; + readonly attribute unsigned long length; + readonly attribute double duration; + readonly attribute unsigned long numberOfChannels; +// Float32Array getChannelData(unsigned long channel); +// void copyFromChannel(Float32Array destination, +// unsigned long channelNumber, +// optional unsigned long startInChannel = 0); +// void copyToChannel (Float32Array source, +// unsigned long channelNumber, +// optional unsigned long startInChannel = 0); +}; From 0cb053ad4c984d1b6b8dcfbf95eadaacc1ddc01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Sun, 1 Jul 2018 17:26:54 +0200 Subject: [PATCH 27/87] AudioBufferSourceNode stubs --- .../script/dom/audiobuffersourcenode.rs | 155 ++++++++++++++++++ components/script/dom/mod.rs | 1 + .../dom/webidls/AudioBufferSourceNode.webidl | 30 ++++ 3 files changed, 186 insertions(+) create mode 100644 components/script/dom/audiobuffersourcenode.rs create mode 100644 components/script/dom/webidls/AudioBufferSourceNode.webidl diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs new file mode 100644 index 00000000000..931e86ad21c --- /dev/null +++ b/components/script/dom/audiobuffersourcenode.rs @@ -0,0 +1,155 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audiobuffer::AudioBuffer; +use dom::audioparam::{AudioParam, AudioParamImpl}; +use dom::audioscheduledsourcenode::AudioScheduledSourceNode; +use dom::baseaudiocontext::BaseAudioContext; +use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding; +use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; +use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceNodeMethods; +use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::error::Fallible; +use dom::bindings::num::Finite; +use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::DomRoot; +use dom::window::Window; +use dom_struct::dom_struct; +use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage; +use servo_media::audio::buffer_source_node::AudioBufferSourceNodeOptions; +use servo_media::audio::context::AudioContext; +use servo_media::audio::graph::NodeId; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; +use servo_media::audio::param::{UserAutomationEvent, RampKind}; +use std::cell::Cell; +use std::f32; +use std::rc::Rc; + +audio_param_impl!(PlaybackRate, AudioBufferSourceNode, AudioBufferSourceNodeMessage, SetPlaybackRate); +audio_param_impl!(Detune, AudioBufferSourceNode, AudioBufferSourceNodeMessage, SetDetune); + +#[dom_struct] +pub struct AudioBufferSourceNode { + node: AudioScheduledSourceNode, + // buffer: Option>, + playback_rate: DomRoot, + detune: DomRoot, + loop_enabled: Cell, + loop_start: Cell, + loop_end: Cell, +} + +impl AudioBufferSourceNode { + #[allow(unrooted_must_root)] + #[allow(unsafe_code)] + fn new_inherited( + window: &Window, + context: &BaseAudioContext, + options: &AudioBufferSourceOptions, + ) -> AudioBufferSourceNode { + let mut node_options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; + node_options.channelCount = Some(2); + node_options.channelCountMode = Some(ChannelCountMode::Max); + node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); + let node = AudioScheduledSourceNode::new_inherited( + AudioNodeType::AudioBufferSourceNode(options.into()), + context, + &node_options, + 0 /* inputs */, + 1 /* outputs */, + ); + let playback_rate = PlaybackRate::new(context.audio_context_impl(), node.node_id()); + let playback_rate = AudioParam::new(&window, + Box::new(playback_rate), + AutomationRate::K_rate, + *options.playbackRate, + f32::MIN, f32::MAX); + let detune = Detune::new(context.audio_context_impl(), node.node_id()); + let detune = AudioParam::new(&window, + Box::new(detune), + AutomationRate::K_rate, + *options.detune, + f32::MIN, f32::MAX); + AudioBufferSourceNode { + node, + // buffer: options.buffer, + playback_rate, + detune, + loop_enabled: Cell::new(options.loop_), + loop_start: Cell::new(*options.loopStart), + loop_end: Cell::new(*options.loopEnd), + } + } + + #[allow(unrooted_must_root)] + pub fn new( + window: &Window, + context: &BaseAudioContext, + options: &AudioBufferSourceOptions, + ) -> DomRoot { + let node = AudioBufferSourceNode::new_inherited(window, context, options); + reflect_dom_object(Box::new(node), window, AudioBufferSourceNodeBinding::Wrap) + } + + pub fn Constructor( + window: &Window, + context: &BaseAudioContext, + options: &AudioBufferSourceOptions, + ) -> Fallible> { + Ok(AudioBufferSourceNode::new(window, context, options)) + } +} + +impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { + fn PlaybackRate(&self) -> DomRoot { + DomRoot::from_ref(&self.playback_rate) + } + + fn Detune(&self) -> DomRoot { + DomRoot::from_ref(&self.detune) + } + + fn Loop(&self) -> bool { + self.loop_enabled.get() + } + + fn SetLoop(&self, should_loop: bool) { + self.loop_enabled.set(should_loop); + } + + fn LoopStart(&self) -> Finite { + Finite::wrap(self.loop_start.get()) + } + + fn SetLoopStart(&self, loop_start: Finite) { + self.loop_start.set(*loop_start); + } + + fn LoopEnd(&self) -> Finite { + Finite::wrap(self.loop_end.get()) + } + + fn SetLoopEnd(&self, loop_end: Finite) { + self.loop_end.set(*loop_end) + } + + fn Start(&self, when: Finite, offset: Option>, duration: Option>) { + // XXX + } +} + +impl<'a> From<&'a AudioBufferSourceOptions> for AudioBufferSourceNodeOptions { + fn from(options: &'a AudioBufferSourceOptions) -> Self { + Self { + buffer: None, + detune: *options.detune, + loop_enabled: options.loop_, + loop_end: Some(*options.loopEnd), + loop_start: Some(*options.loopStart), + playback_rate: *options.playbackRate, + } + } +} diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index f616922fce6..39273745417 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -217,6 +217,7 @@ pub mod abstractworkerglobalscope; pub mod activation; pub mod attr; pub mod audiobuffer; +pub mod audiobuffersourcenode; pub mod audiocontext; pub mod audiodestinationnode; pub mod audionode; diff --git a/components/script/dom/webidls/AudioBufferSourceNode.webidl b/components/script/dom/webidls/AudioBufferSourceNode.webidl new file mode 100644 index 00000000000..45358fbaad8 --- /dev/null +++ b/components/script/dom/webidls/AudioBufferSourceNode.webidl @@ -0,0 +1,30 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#AudioBufferSourceNode + */ + +dictionary AudioBufferSourceOptions { +// AudioBuffer? buffer; + float detune = 0; + boolean loop = false; + double loopEnd = 0; + double loopStart = 0; + float playbackRate = 1; +}; + +[Exposed=Window, + Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options)] +interface AudioBufferSourceNode : AudioScheduledSourceNode { + // attribute AudioBuffer? buffer; + readonly attribute AudioParam playbackRate; + readonly attribute AudioParam detune; + attribute boolean loop; + attribute double loopStart; + attribute double loopEnd; + void start(optional double when = 0, + optional double offset, + optional double duration); +}; From cb16c596b3ed3492ca327fa6033f1121e4e379fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 3 Jul 2018 18:53:11 +0200 Subject: [PATCH 28/87] AudioBuffer.GetChannelData and internal storage --- components/script/dom/audiobuffer.rs | 102 +++++++++++++++--- .../script/dom/webidls/AudioBuffer.webidl | 14 +-- 2 files changed, 95 insertions(+), 21 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index b5a8f43ca9a..5e6855ae689 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -3,28 +3,27 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audionode::MAX_CHANNEL_COUNT; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AudioBufferBinding::{self, AudioBufferMethods, AudioBufferOptions}; use dom::bindings::error::{Error, Fallible}; use dom::bindings::num::Finite; -use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; -use smallvec::SmallVec; +use js::conversions::ToJSValConvertible; +use js::jsapi::{Heap, JSContext, JSObject, JS_StealArrayBufferContents}; +use js::typedarray::{CreateWith, Float32Array}; +use std::ptr::{self, NonNull}; +use std::slice; -#[derive(JSTraceable, MallocSizeOf)] -struct AudioChannel(pub Vec); - -impl AudioChannel { - pub fn new(capacity: usize) -> AudioChannel { - AudioChannel(Vec::with_capacity(capacity)) - } -} +type JSAudioChannel = Heap<*mut JSObject>; #[dom_struct] pub struct AudioBuffer { reflector_: Reflector, - internal_data: SmallVec<[AudioChannel; MAX_CHANNEL_COUNT as usize]>, + js_channels: Vec, + shared_channels: DomRefCell>>>, sample_rate: f32, length: u32, duration: f64, @@ -35,11 +34,10 @@ impl AudioBuffer { #[allow(unrooted_must_root)] #[allow(unsafe_code)] pub fn new_inherited(options: &AudioBufferOptions) -> AudioBuffer { - let mut internal_data = SmallVec::new(); - unsafe { internal_data.set_len(options.numberOfChannels as usize); } AudioBuffer { reflector_: Reflector::new(), - internal_data, + js_channels: Vec::with_capacity(options.numberOfChannels as usize), + shared_channels: DomRefCell::new(None), sample_rate: *options.sampleRate, length: options.length, duration: options.length as f64 / *options.sampleRate as f64, @@ -61,22 +59,98 @@ impl AudioBuffer { } Ok(AudioBuffer::new(window, options)) } + + #[allow(unsafe_code)] + fn restore_js_channel_data(&self, cx: *mut JSContext) -> bool { + for (i, channel) in self.js_channels.iter().enumerate() { + if !channel.get().is_null() { + // Already have data in JS array. + continue; + } + + match *self.shared_channels.borrow_mut() { + Some(ref mut shared_channels) => { + // Step 4 of https://webaudio.github.io/web-audio-api/#acquire-the-content + // "Attach ArrayBuffers containing copies of the data of the AudioBuffer, to + // be returned by the next call to getChannelData()". + rooted!(in (cx) let mut array = ptr::null_mut::()); + let shared_channel = shared_channels.remove(i); + if unsafe { + Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) + }.is_err() { + return false; + } + channel.set(array.get()); + }, + None => return false, + } + } + + *self.shared_channels.borrow_mut() = None; + + true + } + + /// https://webaudio.github.io/web-audio-api/#acquire-the-content + #[allow(unsafe_code)] + pub fn acquire_contents(&self) { + let cx = self.global().get_cx(); + for (i, channel) in self.js_channels.iter().enumerate() { + // Step 1. + if channel.get().is_null() { + return; + } + + // Step 2. + let channel_data = unsafe { + slice::from_raw_parts( + JS_StealArrayBufferContents(cx, channel.handle()) as *mut f32, + self.length as usize + ).to_vec() + }; + + // Step 3. + let mut shared_channels = self.shared_channels.borrow_mut(); + if shared_channels.is_none() { + *shared_channels = Some(Vec::with_capacity(self.number_of_channels as usize)); + } + (*shared_channels).as_mut().unwrap()[i] = channel_data; + } + } } impl AudioBufferMethods for AudioBuffer { + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-samplerate fn SampleRate(&self) -> Finite { Finite::wrap(self.sample_rate) } + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-length fn Length(&self) -> u32 { self.length } + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-duration fn Duration(&self) -> Finite { Finite::wrap(self.duration) } + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-numberofchannels fn NumberOfChannels(&self) -> u32 { self.number_of_channels } + + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-getchanneldata + #[allow(unsafe_code)] + unsafe fn GetChannelData(&self, cx: *mut JSContext, channel: u32) -> Fallible> { + if channel >= self.number_of_channels { + return Err(Error::IndexSize); + } + + if !self.restore_js_channel_data(cx) { + return Err(Error::JSFailed); + } + + Ok(NonNull::new_unchecked(self.js_channels[channel as usize].get())) + } } diff --git a/components/script/dom/webidls/AudioBuffer.webidl b/components/script/dom/webidls/AudioBuffer.webidl index 7ec015ecb2f..f5290a36aea 100644 --- a/components/script/dom/webidls/AudioBuffer.webidl +++ b/components/script/dom/webidls/AudioBuffer.webidl @@ -19,11 +19,11 @@ interface AudioBuffer { readonly attribute unsigned long length; readonly attribute double duration; readonly attribute unsigned long numberOfChannels; -// Float32Array getChannelData(unsigned long channel); -// void copyFromChannel(Float32Array destination, -// unsigned long channelNumber, -// optional unsigned long startInChannel = 0); -// void copyToChannel (Float32Array source, -// unsigned long channelNumber, -// optional unsigned long startInChannel = 0); + [Throws] Float32Array getChannelData(unsigned long channel); +//[Throws] void copyFromChannel(Float32Array destination, +// unsigned long channelNumber, +// optional unsigned long startInChannel = 0); +//[Throws] void copyToChannel(Float32Array source, +// unsigned long channelNumber, +// optional unsigned long startInChannel = 0); }; From 25a74a75eaca196b1bd7a999aba42f8ac54202f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 4 Jul 2018 15:39:40 +0200 Subject: [PATCH 29/87] Create AudioBuffer from BaseAudioContext --- components/script/dom/audiobuffer.rs | 110 +++++++++++------- components/script/dom/baseaudiocontext.rs | 9 ++ components/script/dom/bindings/trace.rs | 6 +- .../script/dom/webidls/AudioBuffer.webidl | 12 +- .../dom/webidls/BaseAudioContext.webidl | 58 ++++----- 5 files changed, 115 insertions(+), 80 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 5e6855ae689..8f0a72a440c 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -11,19 +11,21 @@ use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; -use js::conversions::ToJSValConvertible; use js::jsapi::{Heap, JSContext, JSObject, JS_StealArrayBufferContents}; +use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use std::ptr::{self, NonNull}; use std::slice; +use std::sync::{Arc, Mutex}; type JSAudioChannel = Heap<*mut JSObject>; #[dom_struct] pub struct AudioBuffer { reflector_: Reflector, - js_channels: Vec, - shared_channels: DomRefCell>>>, + js_channels: DomRefCell>, + #[ignore_malloc_size_of = "Arc"] + shared_channels: Arc>>>, sample_rate: f32, length: u32, duration: f64, @@ -33,22 +35,38 @@ pub struct AudioBuffer { impl AudioBuffer { #[allow(unrooted_must_root)] #[allow(unsafe_code)] - pub fn new_inherited(options: &AudioBufferOptions) -> AudioBuffer { + pub fn new_inherited(cx: *mut JSContext, + number_of_channels: u32, + length: u32, + sample_rate: f32) -> AudioBuffer { + let initial_data = vec![0.; length as usize]; + let mut js_channels: Vec = Vec::with_capacity(number_of_channels as usize); + for _ in 0..number_of_channels { + rooted!(in (cx) let mut array = ptr::null_mut::()); + let _ = unsafe { + Float32Array::create(cx, CreateWith::Slice(initial_data.as_slice()), array.handle_mut()) + }; + let js_channel = Heap::default(); + js_channel.set(array.get()); + js_channels.push(js_channel); + } AudioBuffer { reflector_: Reflector::new(), - js_channels: Vec::with_capacity(options.numberOfChannels as usize), - shared_channels: DomRefCell::new(None), - sample_rate: *options.sampleRate, - length: options.length, - duration: options.length as f64 / *options.sampleRate as f64, - number_of_channels: options.numberOfChannels, + js_channels: DomRefCell::new(js_channels), + shared_channels: Arc::new(Mutex::new(vec![vec![0.; length as usize]; number_of_channels as usize])), + sample_rate: sample_rate, + length: length, + duration: length as f64 / sample_rate as f64, + number_of_channels: number_of_channels, } } #[allow(unrooted_must_root)] pub fn new(global: &Window, - options: &AudioBufferOptions) -> DomRoot { - let buffer = AudioBuffer::new_inherited(options); + number_of_channels: u32, + length: u32, + sample_rate: f32) -> DomRoot { + let buffer = AudioBuffer::new_inherited(global.get_cx(), number_of_channels, length, sample_rate); reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) } @@ -57,48 +75,39 @@ impl AudioBuffer { if options.numberOfChannels > MAX_CHANNEL_COUNT { return Err(Error::NotSupported); } - Ok(AudioBuffer::new(window, options)) + Ok(AudioBuffer::new(window, options.numberOfChannels, options.length, *options.sampleRate)) } #[allow(unsafe_code)] fn restore_js_channel_data(&self, cx: *mut JSContext) -> bool { - for (i, channel) in self.js_channels.iter().enumerate() { + for (i, channel) in self.js_channels.borrow_mut().iter().enumerate() { if !channel.get().is_null() { // Already have data in JS array. continue; } - match *self.shared_channels.borrow_mut() { - Some(ref mut shared_channels) => { - // Step 4 of https://webaudio.github.io/web-audio-api/#acquire-the-content - // "Attach ArrayBuffers containing copies of the data of the AudioBuffer, to - // be returned by the next call to getChannelData()". - rooted!(in (cx) let mut array = ptr::null_mut::()); - let shared_channel = shared_channels.remove(i); - if unsafe { - Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) - }.is_err() { - return false; - } - channel.set(array.get()); - }, - None => return false, + // Move the channel data from shared_channels to js_channels. + rooted!(in (cx) let mut array = ptr::null_mut::()); + let shared_channel = (*self.shared_channels.lock().unwrap()).remove(i); + if unsafe { + Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) + }.is_err() { + return false; } + channel.set(array.get()); } - *self.shared_channels.borrow_mut() = None; - true } /// https://webaudio.github.io/web-audio-api/#acquire-the-content #[allow(unsafe_code)] - pub fn acquire_contents(&self) { + pub fn acquire_contents(&self) -> Option>>>> { let cx = self.global().get_cx(); - for (i, channel) in self.js_channels.iter().enumerate() { + for (i, channel) in self.js_channels.borrow_mut().iter().enumerate() { // Step 1. if channel.get().is_null() { - return; + return None; } // Step 2. @@ -106,16 +115,19 @@ impl AudioBuffer { slice::from_raw_parts( JS_StealArrayBufferContents(cx, channel.handle()) as *mut f32, self.length as usize - ).to_vec() + ).to_vec() }; - // Step 3. - let mut shared_channels = self.shared_channels.borrow_mut(); - if shared_channels.is_none() { - *shared_channels = Some(Vec::with_capacity(self.number_of_channels as usize)); - } - (*shared_channels).as_mut().unwrap()[i] = channel_data; + channel.set(ptr::null_mut()); + + // Step 3 and part of 4 (which will complete turning shared_channels + // data into js_channels ArrayBuffers in restore_js_channel_data). + (*self.shared_channels.lock().unwrap())[i] = channel_data; } + + self.js_channels.borrow_mut().clear(); + + Some(self.shared_channels.clone()) } } @@ -151,6 +163,20 @@ impl AudioBufferMethods for AudioBuffer { return Err(Error::JSFailed); } - Ok(NonNull::new_unchecked(self.js_channels[channel as usize].get())) + Ok(NonNull::new_unchecked(self.js_channels.borrow()[channel as usize].get())) + } + + fn CopyFromChannel(&self, + destination: CustomAutoRooterGuard, + channel_number: u32, + start_in_channel: u32) -> Fallible<()> { + Ok(()) + } + + fn CopyToChannel(&self, + source: CustomAutoRooterGuard, + channel_number: u32, + start_in_channel: u32) -> Fallible<()> { + Ok(()) } } diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 9152fad8b3e..401da6bc4d3 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::audiobuffer::AudioBuffer; use dom::audiodestinationnode::AudioDestinationNode; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; @@ -277,6 +278,14 @@ impl BaseAudioContextMethods for BaseAudioContext { let options = unsafe { GainOptions::empty(window.get_cx()) }; GainNode::new(&window, &self, &options) } + + fn CreateBuffer(&self, + number_of_channels: u32, + length: u32, + sample_rate: Finite) -> DomRoot { + let global = self.global(); + AudioBuffer::new(&global.as_window(), number_of_channels, length, *sample_rate) + } } impl From for AudioContextState { diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 1adfa2d0f23..b84651c8c8a 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -590,9 +590,9 @@ unsafe impl JSTraceable for TypedSize2D { } } -unsafe impl JSTraceable for Mutex> { - unsafe fn trace(&self, _trc: *mut JSTracer) { - // Do nothing. +unsafe impl JSTraceable for Mutex { + unsafe fn trace(&self, trc: *mut JSTracer) { + self.lock().unwrap().trace(trc); } } diff --git a/components/script/dom/webidls/AudioBuffer.webidl b/components/script/dom/webidls/AudioBuffer.webidl index f5290a36aea..46ad142ed84 100644 --- a/components/script/dom/webidls/AudioBuffer.webidl +++ b/components/script/dom/webidls/AudioBuffer.webidl @@ -20,10 +20,10 @@ interface AudioBuffer { readonly attribute double duration; readonly attribute unsigned long numberOfChannels; [Throws] Float32Array getChannelData(unsigned long channel); -//[Throws] void copyFromChannel(Float32Array destination, -// unsigned long channelNumber, -// optional unsigned long startInChannel = 0); -//[Throws] void copyToChannel(Float32Array source, -// unsigned long channelNumber, -// optional unsigned long startInChannel = 0); + [Throws] void copyFromChannel(Float32Array destination, + unsigned long channelNumber, + optional unsigned long startInChannel = 0); + [Throws] void copyToChannel(Float32Array source, + unsigned long channelNumber, + optional unsigned long startInChannel = 0); }; diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl index 9adb5600fbb..92564b29a5f 100644 --- a/components/script/dom/webidls/BaseAudioContext.webidl +++ b/components/script/dom/webidls/BaseAudioContext.webidl @@ -20,36 +20,36 @@ interface BaseAudioContext : EventTarget { readonly attribute AudioDestinationNode destination; readonly attribute float sampleRate; readonly attribute double currentTime; - // readonly attribute AudioListener listener; - readonly attribute AudioContextState state; + // readonly attribute AudioListener listener; + readonly attribute AudioContextState state; Promise resume(); attribute EventHandler onstatechange; - // AudioBuffer createBuffer(unsigned long numberOfChannels, - // unsigned long length, - // float sampleRate); - // Promise decodeAudioData(ArrayBuffer audioData, - // optional DecodeSuccessCallback successCallback, - // optional DecodeErrorCallback errorCallback); - // AudioBufferSourceNode createBufferSource(); - // ConstantSourceNode createConstantSource(); - // ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, - // optional unsigned long numberOfInputChannels = 2, - // optional unsigned long numberOfOutputChannels = 2); - // AnalyserNode createAnalyser(); - GainNode createGain(); - // DelayNode createDelay(optional double maxDelayTime = 1); - // BiquadFilterNode createBiquadFilter(); - // IIRFilterNode createIIRFilter(sequence feedforward, - // sequence feedback); - // WaveShaperNode createWaveShaper(); - // PannerNode createPanner(); - // StereoPannerNode createStereoPanner(); - // ConvolverNode createConvolver(); - // ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); - // ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); + AudioBuffer createBuffer(unsigned long numberOfChannels, + unsigned long length, + float sampleRate); + // Promise decodeAudioData(ArrayBuffer audioData, + // optional DecodeSuccessCallback successCallback, + // optional DecodeErrorCallback errorCallback); + // AudioBufferSourceNode createBufferSource(); + // ConstantSourceNode createConstantSource(); + // ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, + // optional unsigned long numberOfInputChannels = 2, + // optional unsigned long numberOfOutputChannels = 2); + // AnalyserNode createAnalyser(); + GainNode createGain(); + // DelayNode createDelay(optional double maxDelayTime = 1); + // BiquadFilterNode createBiquadFilter(); + // IIRFilterNode createIIRFilter(sequence feedforward, + // sequence feedback); + // WaveShaperNode createWaveShaper(); + // PannerNode createPanner(); + // StereoPannerNode createStereoPanner(); + // ConvolverNode createConvolver(); + // ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); + // ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); // DynamicsCompressorNode createDynamicsCompressor(); - OscillatorNode createOscillator(); - // PeriodicWave createPeriodicWave(sequence real, - // sequence imag, - // optional PeriodicWaveConstraints constraints); + OscillatorNode createOscillator(); + // PeriodicWave createPeriodicWave(sequence real, + // sequence imag, + // optional PeriodicWaveConstraints constraints); }; From 356d7fd7a678c63477c0d53263e0fd7f05bd7bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 5 Jul 2018 11:43:31 +0200 Subject: [PATCH 30/87] createBufferSource and buffer setter on buffer source node --- components/script/dom/audiobuffer.rs | 55 ++++++++++------- .../script/dom/audiobuffersourcenode.rs | 59 +++++++++++++++---- .../script/dom/audioscheduledsourcenode.rs | 29 +++++++-- components/script/dom/baseaudiocontext.rs | 38 +++++++++--- components/script/dom/bindings/trace.rs | 2 + components/script/dom/oscillatornode.rs | 11 ++-- .../dom/webidls/AudioBufferSourceNode.webidl | 8 +-- .../webidls/AudioScheduledSourceNode.webidl | 4 +- .../dom/webidls/BaseAudioContext.webidl | 8 +-- 9 files changed, 152 insertions(+), 62 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 8f0a72a440c..5d028cc3cd9 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -14,8 +14,8 @@ use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject, JS_StealArrayBufferContents}; use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; +use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; use std::ptr::{self, NonNull}; -use std::slice; use std::sync::{Arc, Mutex}; type JSAudioChannel = Heap<*mut JSObject>; @@ -25,7 +25,7 @@ pub struct AudioBuffer { reflector_: Reflector, js_channels: DomRefCell>, #[ignore_malloc_size_of = "Arc"] - shared_channels: Arc>>>, + shared_channels: Arc>, sample_rate: f32, length: u32, duration: f64, @@ -53,11 +53,12 @@ impl AudioBuffer { AudioBuffer { reflector_: Reflector::new(), js_channels: DomRefCell::new(js_channels), - shared_channels: Arc::new(Mutex::new(vec![vec![0.; length as usize]; number_of_channels as usize])), - sample_rate: sample_rate, - length: length, - duration: length as f64 / sample_rate as f64, - number_of_channels: number_of_channels, + shared_channels: Arc::new(Mutex::new( + ServoMediaAudioBuffer::new(number_of_channels as u8, length as usize))), + sample_rate: sample_rate, + length: length, + duration: length as f64 / sample_rate as f64, + number_of_channels: number_of_channels, } } @@ -88,7 +89,7 @@ impl AudioBuffer { // Move the channel data from shared_channels to js_channels. rooted!(in (cx) let mut array = ptr::null_mut::()); - let shared_channel = (*self.shared_channels.lock().unwrap()).remove(i); + let shared_channel = (*self.shared_channels.lock().unwrap()).buffers.remove(i); if unsafe { Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) }.is_err() { @@ -102,7 +103,7 @@ impl AudioBuffer { /// https://webaudio.github.io/web-audio-api/#acquire-the-content #[allow(unsafe_code)] - pub fn acquire_contents(&self) -> Option>>>> { + pub fn acquire_contents(&self) -> Option>> { let cx = self.global().get_cx(); for (i, channel) in self.js_channels.borrow_mut().iter().enumerate() { // Step 1. @@ -112,17 +113,25 @@ impl AudioBuffer { // Step 2. let channel_data = unsafe { - slice::from_raw_parts( - JS_StealArrayBufferContents(cx, channel.handle()) as *mut f32, - self.length as usize - ).to_vec() + typedarray!(in(cx) let array: Float32Array = channel.get()); + if let Ok(array) = array { + // XXX TypedArrays API does not expose a way to steal the buffer's + // content. + let data = array.to_vec(); + let _ = JS_StealArrayBufferContents(cx, channel.handle()); + data + } else { + return None; + } }; channel.set(ptr::null_mut()); - // Step 3 and part of 4 (which will complete turning shared_channels - // data into js_channels ArrayBuffers in restore_js_channel_data). - (*self.shared_channels.lock().unwrap())[i] = channel_data; + // Step 3. + (*self.shared_channels.lock().unwrap()).buffers[i] = channel_data; + + // Step 4 will complete turning shared_channels + // data into js_channels ArrayBuffers in restore_js_channel_data. } self.js_channels.borrow_mut().clear(); @@ -167,16 +176,18 @@ impl AudioBufferMethods for AudioBuffer { } fn CopyFromChannel(&self, - destination: CustomAutoRooterGuard, - channel_number: u32, - start_in_channel: u32) -> Fallible<()> { + _destination: CustomAutoRooterGuard, + _channel_number: u32, + _start_in_channel: u32) -> Fallible<()> { + // XXX Ok(()) } fn CopyToChannel(&self, - source: CustomAutoRooterGuard, - channel_number: u32, - start_in_channel: u32) -> Fallible<()> { + _source: CustomAutoRooterGuard, + _channel_number: u32, + _start_in_channel: u32) -> Fallible<()> { + // XXX Ok(()) } } diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 931e86ad21c..6eefe8c9ad5 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -12,10 +12,12 @@ use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferS use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; -use dom::bindings::error::Fallible; +use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; +use dom::bindings::error::{Error, Fallible}; +use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage; @@ -33,8 +35,8 @@ audio_param_impl!(Detune, AudioBufferSourceNode, AudioBufferSourceNodeMessage, S #[dom_struct] pub struct AudioBufferSourceNode { - node: AudioScheduledSourceNode, - // buffer: Option>, + source_node: AudioScheduledSourceNode, + buffer: MutNullableDom, playback_rate: DomRoot, detune: DomRoot, loop_enabled: Cell, @@ -54,28 +56,29 @@ impl AudioBufferSourceNode { node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); - let node = AudioScheduledSourceNode::new_inherited( + let source_node = AudioScheduledSourceNode::new_inherited( AudioNodeType::AudioBufferSourceNode(options.into()), context, &node_options, 0 /* inputs */, 1 /* outputs */, ); - let playback_rate = PlaybackRate::new(context.audio_context_impl(), node.node_id()); + let node_id = source_node.node().node_id(); + let playback_rate = PlaybackRate::new(context.audio_context_impl(), node_id); let playback_rate = AudioParam::new(&window, Box::new(playback_rate), AutomationRate::K_rate, *options.playbackRate, f32::MIN, f32::MAX); - let detune = Detune::new(context.audio_context_impl(), node.node_id()); + let detune = Detune::new(context.audio_context_impl(), node_id); let detune = AudioParam::new(&window, Box::new(detune), AutomationRate::K_rate, *options.detune, f32::MIN, f32::MAX); AudioBufferSourceNode { - node, - // buffer: options.buffer, + source_node, + buffer: Default::default(), playback_rate, detune, loop_enabled: Cell::new(options.loop_), @@ -104,6 +107,31 @@ impl AudioBufferSourceNode { } impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer + fn GetBuffer(&self) -> Fallible>> { + Ok(self.buffer.get()) + } + + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer + fn SetBuffer(&self, new_buffer: Option<&AudioBuffer>) -> Fallible<()> { + if new_buffer.is_some() && self.buffer.get().is_some() { + return Err(Error::InvalidState); + } + + self.buffer.set(new_buffer); + + if self.source_node.started() { + if let Some(buffer) = self.buffer.get() { + let buffer = buffer.acquire_contents(); + self.source_node.node().message( + AudioNodeMessage::AudioBufferSourceNode( + AudioBufferSourceNodeMessage::SetBuffer(buffer))); + } + } + + Ok(()) + } + fn PlaybackRate(&self) -> DomRoot { DomRoot::from_ref(&self.playback_rate) } @@ -136,8 +164,17 @@ impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { self.loop_end.set(*loop_end) } - fn Start(&self, when: Finite, offset: Option>, duration: Option>) { - // XXX + fn Start(&self, + when: Finite, + _offset: Option>, + _duration: Option>) -> Fallible<()> { + if let Some(buffer) = self.buffer.get() { + let buffer = buffer.acquire_contents(); + self.source_node.node().message( + AudioNodeMessage::AudioBufferSourceNode( + AudioBufferSourceNodeMessage::SetBuffer(buffer))); + } + self.source_node.upcast::().Start(when) } } diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index 8c8240fdf67..da284e02910 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -5,14 +5,17 @@ use dom::audionode::AudioNode; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::error::{Error, Fallible}; use dom::bindings::num::Finite; use dom_struct::dom_struct; -use servo_media::audio::graph::NodeId; use servo_media::audio::node::{AudioNodeMessage, AudioNodeType, AudioScheduledSourceNodeMessage}; +use std::cell::Cell; #[dom_struct] pub struct AudioScheduledSourceNode { node: AudioNode, + started: Cell, + stopped: Cell, } impl AudioScheduledSourceNode { @@ -24,11 +27,17 @@ impl AudioScheduledSourceNode { AudioScheduledSourceNode { node: AudioNode::new_inherited(node_type, None /* node_id */, context, options, number_of_inputs, number_of_outputs), + started: Cell::new(false), + stopped: Cell::new(false), } } - pub fn node_id(&self) -> NodeId { - self.node.node_id() + pub fn node(&self) -> &AudioNode { + &self.node + } + + pub fn started(&self) -> bool { + self.started.get() } } @@ -37,16 +46,26 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { event_handler!(ended, GetOnended, SetOnended); // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start - fn Start(&self, when: Finite) { + fn Start(&self, when: Finite) -> Fallible<()> { + if self.started.get() || self.stopped.get() { + return Err(Error::InvalidState); + } + self.started.set(true); self.node.message( AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(*when)) ); + Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-stop - fn Stop(&self, when: Finite) { + fn Stop(&self, when: Finite) -> Fallible<()> { + if !self.started.get() { + return Err(Error::InvalidState); + } + self.stopped.set(true); self.node.message( AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Stop(*when)) ); + Ok(()) } } diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 401da6bc4d3..59247516659 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -3,15 +3,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audiobuffer::AudioBuffer; +use dom::audiobuffersourcenode::AudioBufferSourceNode; use dom::audiodestinationnode::AudioDestinationNode; +use dom::audionode::MAX_CHANNEL_COUNT; use dom::bindings::cell::DomRefCell; +use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use dom::bindings::codegen::Bindings::GainNodeBinding::GainOptions; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; -use dom::bindings::error::{Error, ErrorResult}; +use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; @@ -207,23 +210,23 @@ impl BaseAudioContext { } impl BaseAudioContextMethods for BaseAudioContext { - // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate fn SampleRate(&self) -> Finite { Finite::wrap(self.sample_rate) } - // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime fn CurrentTime(&self) -> Finite { let current_time = self.audio_context_impl.current_time(); Finite::wrap(current_time) } - // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state fn State(&self) -> AudioContextState { self.state.get() } - // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume #[allow(unrooted_must_root)] fn Resume(&self) -> Rc { // Step 1. @@ -255,14 +258,15 @@ impl BaseAudioContextMethods for BaseAudioContext { promise } - // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination fn Destination(&self) -> DomRoot { DomRoot::from_ref(self.destination.as_ref().unwrap()) } - // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange event_handler!(statechange, GetOnstatechange, SetOnstatechange); + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createoscillator #[allow(unsafe_code)] fn CreateOscillator(&self) -> DomRoot { let global = self.global(); @@ -271,6 +275,7 @@ impl BaseAudioContextMethods for BaseAudioContext { OscillatorNode::new(&window, &self, &options) } + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-creategain #[allow(unsafe_code)] fn CreateGain(&self) -> DomRoot { let global = self.global(); @@ -279,12 +284,27 @@ impl BaseAudioContextMethods for BaseAudioContext { GainNode::new(&window, &self, &options) } + /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer fn CreateBuffer(&self, number_of_channels: u32, length: u32, - sample_rate: Finite) -> DomRoot { + sample_rate: Finite) -> Fallible> { + if number_of_channels <= 0 || + number_of_channels > MAX_CHANNEL_COUNT || + length <= 0 || + *sample_rate <= 0. { + return Err(Error::NotSupported); + } let global = self.global(); - AudioBuffer::new(&global.as_window(), number_of_channels, length, *sample_rate) + Ok(AudioBuffer::new(&global.as_window(), number_of_channels, length, *sample_rate)) + } + + #[allow(unsafe_code)] + fn CreateBufferSource(&self) -> DomRoot { + let global = self.global(); + // XXX Can we do this implementing Default? + let options = unsafe { AudioBufferSourceOptions::empty(global.get_cx()) }; + AudioBufferSourceNode::new(&global.as_window(), &self, &options) } } diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index b84651c8c8a..7a9d4d7358f 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -80,6 +80,7 @@ use offscreen_gl_context::GLLimits; use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; +use servo_media::audio::buffer_source_node::AudioBuffer; use servo_media::audio::context::AudioContext; use servo_media::audio::graph::NodeId; use script_layout_interface::OpaqueStyleAndLayoutData; @@ -432,6 +433,7 @@ unsafe_no_jsmanaged_fields!(InteractiveWindow); unsafe_no_jsmanaged_fields!(CanvasId); unsafe_no_jsmanaged_fields!(SourceSet); unsafe_no_jsmanaged_fields!(AudioGraph); +unsafe_no_jsmanaged_fields!(AudioBuffer); unsafe_no_jsmanaged_fields!(AudioContext); unsafe_no_jsmanaged_fields!(NodeId); diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 7a771916834..71580e20e17 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -30,7 +30,7 @@ audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); #[dom_struct] pub struct OscillatorNode { - node: AudioScheduledSourceNode, + source_node: AudioScheduledSourceNode, oscillator_type: OscillatorType, frequency: DomRoot, detune: DomRoot, @@ -48,26 +48,27 @@ impl OscillatorNode { node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); - let node = AudioScheduledSourceNode::new_inherited( + let source_node = AudioScheduledSourceNode::new_inherited( AudioNodeType::OscillatorNode(oscillator_options.into()), context, &node_options, 0, /* inputs */ 1, /* outputs */ ); - let frequency = Frequency::new(context.audio_context_impl(), node.node_id()); + let node_id = source_node.node().node_id(); + let frequency = Frequency::new(context.audio_context_impl(), node_id); let frequency = AudioParam::new(window, Box::new(frequency), AutomationRate::A_rate, 440., f32::MIN, f32::MAX); - let detune = Detune::new(context.audio_context_impl(), node.node_id()); + let detune = Detune::new(context.audio_context_impl(), node_id); let detune = AudioParam::new(window, Box::new(detune), AutomationRate::A_rate, 0., -440. / 2., 440. / 2.); OscillatorNode { - node, + source_node, oscillator_type: oscillator_options.type_, frequency, detune, diff --git a/components/script/dom/webidls/AudioBufferSourceNode.webidl b/components/script/dom/webidls/AudioBufferSourceNode.webidl index 45358fbaad8..a91a6afc393 100644 --- a/components/script/dom/webidls/AudioBufferSourceNode.webidl +++ b/components/script/dom/webidls/AudioBufferSourceNode.webidl @@ -18,13 +18,13 @@ dictionary AudioBufferSourceOptions { [Exposed=Window, Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options)] interface AudioBufferSourceNode : AudioScheduledSourceNode { - // attribute AudioBuffer? buffer; + [Throws] attribute AudioBuffer? buffer; readonly attribute AudioParam playbackRate; readonly attribute AudioParam detune; attribute boolean loop; attribute double loopStart; attribute double loopEnd; - void start(optional double when = 0, - optional double offset, - optional double duration); + [Throws] void start(optional double when = 0, + optional double offset, + optional double duration); }; diff --git a/components/script/dom/webidls/AudioScheduledSourceNode.webidl b/components/script/dom/webidls/AudioScheduledSourceNode.webidl index 8e058b129cc..a1ca3fc8a8c 100644 --- a/components/script/dom/webidls/AudioScheduledSourceNode.webidl +++ b/components/script/dom/webidls/AudioScheduledSourceNode.webidl @@ -9,6 +9,6 @@ [Exposed=Window] interface AudioScheduledSourceNode : AudioNode { attribute EventHandler onended; - void start(optional double when = 0); - void stop(optional double when = 0); + [Throws] void start(optional double when = 0); + [Throws] void stop(optional double when = 0); }; diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl index 92564b29a5f..9147ca5ed58 100644 --- a/components/script/dom/webidls/BaseAudioContext.webidl +++ b/components/script/dom/webidls/BaseAudioContext.webidl @@ -24,13 +24,13 @@ interface BaseAudioContext : EventTarget { readonly attribute AudioContextState state; Promise resume(); attribute EventHandler onstatechange; - AudioBuffer createBuffer(unsigned long numberOfChannels, - unsigned long length, - float sampleRate); + [Throws] AudioBuffer createBuffer(unsigned long numberOfChannels, + unsigned long length, + float sampleRate); // Promise decodeAudioData(ArrayBuffer audioData, // optional DecodeSuccessCallback successCallback, // optional DecodeErrorCallback errorCallback); - // AudioBufferSourceNode createBufferSource(); + AudioBufferSourceNode createBufferSource(); // ConstantSourceNode createConstantSource(); // ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, // optional unsigned long numberOfInputChannels = 2, From 23f7a736222588bd5c443a077b1e0fdddbb48ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 6 Jul 2018 10:12:51 +0200 Subject: [PATCH 31/87] Copy AudioBufferSourceNode buffer --- components/script/dom/audiobuffer.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 5d028cc3cd9..f732d39ea63 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -16,7 +16,6 @@ use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; use std::ptr::{self, NonNull}; -use std::sync::{Arc, Mutex}; type JSAudioChannel = Heap<*mut JSObject>; @@ -24,8 +23,8 @@ type JSAudioChannel = Heap<*mut JSObject>; pub struct AudioBuffer { reflector_: Reflector, js_channels: DomRefCell>, - #[ignore_malloc_size_of = "Arc"] - shared_channels: Arc>, + #[ignore_malloc_size_of = "servo_media"] + shared_channels: DomRefCell, sample_rate: f32, length: u32, duration: f64, @@ -53,12 +52,11 @@ impl AudioBuffer { AudioBuffer { reflector_: Reflector::new(), js_channels: DomRefCell::new(js_channels), - shared_channels: Arc::new(Mutex::new( - ServoMediaAudioBuffer::new(number_of_channels as u8, length as usize))), - sample_rate: sample_rate, - length: length, - duration: length as f64 / sample_rate as f64, - number_of_channels: number_of_channels, + shared_channels: DomRefCell::new(ServoMediaAudioBuffer::new(number_of_channels as u8, length as usize)), + sample_rate, + length, + duration: length as f64 / sample_rate as f64, + number_of_channels, } } @@ -89,7 +87,7 @@ impl AudioBuffer { // Move the channel data from shared_channels to js_channels. rooted!(in (cx) let mut array = ptr::null_mut::()); - let shared_channel = (*self.shared_channels.lock().unwrap()).buffers.remove(i); + let shared_channel = (*self.shared_channels.borrow_mut()).buffers.remove(i); if unsafe { Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) }.is_err() { @@ -103,7 +101,7 @@ impl AudioBuffer { /// https://webaudio.github.io/web-audio-api/#acquire-the-content #[allow(unsafe_code)] - pub fn acquire_contents(&self) -> Option>> { + pub fn acquire_contents(&self) -> Option { let cx = self.global().get_cx(); for (i, channel) in self.js_channels.borrow_mut().iter().enumerate() { // Step 1. @@ -128,7 +126,7 @@ impl AudioBuffer { channel.set(ptr::null_mut()); // Step 3. - (*self.shared_channels.lock().unwrap()).buffers[i] = channel_data; + (*self.shared_channels.borrow_mut()).buffers[i] = channel_data; // Step 4 will complete turning shared_channels // data into js_channels ArrayBuffers in restore_js_channel_data. @@ -136,7 +134,7 @@ impl AudioBuffer { self.js_channels.borrow_mut().clear(); - Some(self.shared_channels.clone()) + Some((*self.shared_channels.borrow()).clone()) } } From f3bc183dba86fc26bb5807747ba867ec39e6b0f9 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 7 Jul 2018 11:11:43 -0700 Subject: [PATCH 32/87] Add disconnect methods; cleanup DOM stuff (#2) * Add disconnect methods * Use Dom, not DomRoot DomRoot will keep it permanently rooted, it should only be used in values not on the JS heap --- .../script/dom/audiobuffersourcenode.rs | 10 ++--- components/script/dom/audionode.rs | 37 +++++++++++-------- components/script/dom/gainnode.rs | 6 +-- components/script/dom/oscillatornode.rs | 10 ++--- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 6eefe8c9ad5..3a1bcf6e914 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -17,7 +17,7 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{DomRoot, MutNullableDom}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage; @@ -37,8 +37,8 @@ audio_param_impl!(Detune, AudioBufferSourceNode, AudioBufferSourceNodeMessage, S pub struct AudioBufferSourceNode { source_node: AudioScheduledSourceNode, buffer: MutNullableDom, - playback_rate: DomRoot, - detune: DomRoot, + playback_rate: Dom, + detune: Dom, loop_enabled: Cell, loop_start: Cell, loop_end: Cell, @@ -79,8 +79,8 @@ impl AudioBufferSourceNode { AudioBufferSourceNode { source_node, buffer: Default::default(), - playback_rate, - detune, + playback_rate: Dom::from_ref(&playback_rate), + detune: Dom::from_ref(&detune), loop_enabled: Cell::new(options.loop_), loop_start: Cell::new(*options.loopStart), loop_end: Cell::new(*options.loopEnd), diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index f3b26937497..a4b0dfecc34 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -6,7 +6,7 @@ use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{Dom, DomRoot}; use dom::audioparam::AudioParam; use dom::eventtarget::EventTarget; use dom_struct::dom_struct; @@ -24,7 +24,7 @@ pub struct AudioNode { eventtarget: EventTarget, #[ignore_malloc_size_of = "servo_media"] node_id: NodeId, - context: DomRoot, + context: Dom, number_of_inputs: u32, number_of_outputs: u32, channel_count: Cell, @@ -45,7 +45,7 @@ impl AudioNode { AudioNode { eventtarget: EventTarget::new_inherited(), node_id, - context: DomRoot::from_ref(context), + context: Dom::from_ref(context), number_of_inputs, number_of_outputs, channel_count: Cell::new(options.channelCount.unwrap_or(2)), @@ -96,31 +96,36 @@ impl AudioNodeMethods for AudioNode { // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect fn Disconnect(&self) -> ErrorResult { - // TODO + self.context.audio_context_impl() + .disconnect_all_from(self.node_id()); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect_(&self, _: u32) -> ErrorResult { - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-output + fn Disconnect_(&self, out: u32) -> ErrorResult { + self.context.audio_context_impl() + .disconnect_output(self.node_id().output(out)); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect__(&self, _: &AudioNode) -> ErrorResult { - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode + fn Disconnect__(&self, to: &AudioNode) -> ErrorResult { + self.context.audio_context_impl() + .disconnect_between(self.node_id(), to.node_id()); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect___(&self, _: &AudioNode, _: u32) -> ErrorResult{ - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output + fn Disconnect___(&self, to: &AudioNode, out: u32) -> ErrorResult{ + self.context.audio_context_impl() + .disconnect_output_between(self.node_id().output(out), to.node_id()); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect____(&self, _: &AudioNode, _: u32, _: u32) -> ErrorResult { - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output-input + fn Disconnect____(&self, to: &AudioNode, out: u32, inp: u32) -> ErrorResult { + self.context.audio_context_impl() + .disconnect_output_between_to(self.node_id().output(out), to.node_id().input(inp)); Ok(()) } diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index ab146b42a4f..6b43651231d 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, Chann use dom::bindings::codegen::Bindings::GainNodeBinding::{self, GainNodeMethods, GainOptions}; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::context::AudioContext; @@ -27,7 +27,7 @@ audio_param_impl!(Gain, GainNode, GainNodeMessage, SetGain); #[dom_struct] pub struct GainNode { node: AudioNode, - gain: DomRoot, + gain: Dom, } impl GainNode { @@ -60,7 +60,7 @@ impl GainNode { ); GainNode { node, - gain + gain: Dom::from_ref(&gain), } } diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 71580e20e17..0440111410a 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOp use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::context::AudioContext; @@ -32,8 +32,8 @@ audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); pub struct OscillatorNode { source_node: AudioScheduledSourceNode, oscillator_type: OscillatorType, - frequency: DomRoot, - detune: DomRoot, + frequency: Dom, + detune: Dom, } impl OscillatorNode { @@ -70,8 +70,8 @@ impl OscillatorNode { OscillatorNode { source_node, oscillator_type: oscillator_options.type_, - frequency, - detune, + frequency: Dom::from_ref(&frequency), + detune: Dom::from_ref(&detune), } } From 4cadc336a967e21d9cda2dd13a05acbe41e73c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Sat, 7 Jul 2018 10:55:05 +0200 Subject: [PATCH 33/87] AudioBuffer CopyFromChannel and CopyToChannel --- components/script/dom/audiobuffer.rs | 84 +++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 14 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index f732d39ea63..050df8251db 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -15,6 +15,7 @@ use js::jsapi::{Heap, JSContext, JSObject, JS_StealArrayBufferContents}; use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; +use std::cmp::min; use std::ptr::{self, NonNull}; type JSAudioChannel = Heap<*mut JSObject>; @@ -99,7 +100,7 @@ impl AudioBuffer { true } - /// https://webaudio.github.io/web-audio-api/#acquire-the-content + // https://webaudio.github.io/web-audio-api/#acquire-the-content #[allow(unsafe_code)] pub fn acquire_contents(&self) -> Option { let cx = self.global().get_cx(); @@ -139,27 +140,27 @@ impl AudioBuffer { } impl AudioBufferMethods for AudioBuffer { - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-samplerate + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-samplerate fn SampleRate(&self) -> Finite { Finite::wrap(self.sample_rate) } - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-length + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-length fn Length(&self) -> u32 { self.length } - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-duration + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-duration fn Duration(&self) -> Finite { Finite::wrap(self.duration) } - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-numberofchannels + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-numberofchannels fn NumberOfChannels(&self) -> u32 { self.number_of_channels } - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-getchanneldata + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-getchanneldata #[allow(unsafe_code)] unsafe fn GetChannelData(&self, cx: *mut JSContext, channel: u32) -> Fallible> { if channel >= self.number_of_channels { @@ -173,19 +174,74 @@ impl AudioBufferMethods for AudioBuffer { Ok(NonNull::new_unchecked(self.js_channels.borrow()[channel as usize].get())) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-copyfromchannel + #[allow(unsafe_code)] fn CopyFromChannel(&self, - _destination: CustomAutoRooterGuard, - _channel_number: u32, - _start_in_channel: u32) -> Fallible<()> { - // XXX + mut destination: CustomAutoRooterGuard, + channel_number: u32, + start_in_channel: u32) -> Fallible<()> { + if channel_number >= self.number_of_channels || start_in_channel > self.length { + return Err(Error::IndexSize); + } + + let bytes_to_copy = min(self.length - start_in_channel, destination.len() as u32) as usize; + let cx = self.global().get_cx(); + let channel_number = channel_number as usize; + let offset = start_in_channel as usize; + let mut dest = Vec::with_capacity(destination.len()); + // let destination = unsafe { destination.as_mut_slice() }; + + // We either copy form js_channels or shared_channels. + + let js_channel = self.js_channels.borrow()[channel_number].get(); + if !js_channel.is_null() { + typedarray!(in(cx) let array: Float32Array = js_channel); + if let Ok(array) = array { + let data = unsafe { array.as_slice() }; + dest.extend_from_slice(&data[offset..offset + bytes_to_copy]); + return Ok(()); + } + } + + if let Some(shared_channel) = self.shared_channels.borrow().buffers.get(channel_number) { + dest.extend_from_slice(&shared_channel.as_slice()[offset..offset + bytes_to_copy]); + } + + unsafe { destination.update(&dest); } + Ok(()) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-copytochannel + #[allow(unsafe_code)] fn CopyToChannel(&self, - _source: CustomAutoRooterGuard, - _channel_number: u32, - _start_in_channel: u32) -> Fallible<()> { - // XXX + source: CustomAutoRooterGuard, + channel_number: u32, + start_in_channel: u32) -> Fallible<()> { + if channel_number >= self.number_of_channels || start_in_channel > (source.len() as u32) { + return Err(Error::IndexSize); + } + + let cx = self.global().get_cx(); + if !self.restore_js_channel_data(cx) { + return Err(Error::JSFailed); + } + + let js_channel = self.js_channels.borrow()[channel_number as usize].get(); + if js_channel.is_null() { + // The array buffer was detached. + return Err(Error::IndexSize); + } + + typedarray!(in(cx) let array: Float32Array = js_channel); + if let Ok(mut array) = array { + let bytes_to_copy = min(self.length - start_in_channel, source.len() as u32) as usize; + let offset = start_in_channel as usize; + unsafe { array.update(&source.as_slice()[offset..offset + bytes_to_copy]); } + } else { + return Err(Error::IndexSize); + } + Ok(()) } } From e0e1141e74ec8729b68e3362eab753137543f40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Sat, 7 Jul 2018 11:04:49 +0200 Subject: [PATCH 34/87] Undo trace impl for Mutex --- components/script/dom/bindings/trace.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 7a9d4d7358f..898bb9fe490 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -592,9 +592,9 @@ unsafe impl JSTraceable for TypedSize2D { } } -unsafe impl JSTraceable for Mutex { - unsafe fn trace(&self, trc: *mut JSTracer) { - self.lock().unwrap().trace(trc); +unsafe impl JSTraceable for Mutex> { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. } } From b87fc17b4b14898835014a26053fb93f13a47ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 9 Jul 2018 13:32:26 +0200 Subject: [PATCH 35/87] decodeAudioData --- components/script/dom/audiobuffer.rs | 27 +++-- components/script/dom/baseaudiocontext.rs | 108 ++++++++++++++++-- .../dom/webidls/BaseAudioContext.webidl | 10 +- 3 files changed, 125 insertions(+), 20 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 050df8251db..569de5baec3 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -38,13 +38,25 @@ impl AudioBuffer { pub fn new_inherited(cx: *mut JSContext, number_of_channels: u32, length: u32, - sample_rate: f32) -> AudioBuffer { - let initial_data = vec![0.; length as usize]; + sample_rate: f32, + initial_data: Option<&[f32]>) -> AudioBuffer { + let initial_data = match initial_data { + Some(initial_data) => { + let mut data = vec![]; + data.extend_from_slice(initial_data); + data + }, + None => vec![0.; (length * number_of_channels) as usize] + }; let mut js_channels: Vec = Vec::with_capacity(number_of_channels as usize); - for _ in 0..number_of_channels { + for channel in 0..number_of_channels { rooted!(in (cx) let mut array = ptr::null_mut::()); + let offset = (channel * length) as usize; let _ = unsafe { - Float32Array::create(cx, CreateWith::Slice(initial_data.as_slice()), array.handle_mut()) + Float32Array::create( + cx, + CreateWith::Slice(&initial_data.as_slice()[offset..offset + (length as usize)]), + array.handle_mut()) }; let js_channel = Heap::default(); js_channel.set(array.get()); @@ -65,8 +77,9 @@ impl AudioBuffer { pub fn new(global: &Window, number_of_channels: u32, length: u32, - sample_rate: f32) -> DomRoot { - let buffer = AudioBuffer::new_inherited(global.get_cx(), number_of_channels, length, sample_rate); + sample_rate: f32, + initial_data: Option<&[f32]>) -> DomRoot { + let buffer = AudioBuffer::new_inherited(global.get_cx(), number_of_channels, length, sample_rate, initial_data); reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) } @@ -75,7 +88,7 @@ impl AudioBuffer { if options.numberOfChannels > MAX_CHANNEL_COUNT { return Err(Error::NotSupported); } - Ok(AudioBuffer::new(window, options.numberOfChannels, options.length, *options.sampleRate)) + Ok(AudioBuffer::new(window, options.numberOfChannels, options.length, *options.sampleRate, None)) } #[allow(unsafe_code)] diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 59247516659..7f65eb04cbd 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -6,12 +6,15 @@ use dom::audiobuffer::AudioBuffer; use dom::audiobuffersourcenode::AudioBufferSourceNode; use dom::audiodestinationnode::AudioDestinationNode; use dom::audionode::MAX_CHANNEL_COUNT; +use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; -use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::DecodeErrorCallback; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::DecodeSuccessCallback; use dom::bindings::codegen::Bindings::GainNodeBinding::GainOptions; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions; use dom::bindings::error::{Error, ErrorResult, Fallible}; @@ -20,6 +23,7 @@ use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; use dom::bindings::root::DomRoot; +use dom::domexception::{DOMErrorName, DOMException}; use dom::eventtarget::EventTarget; use dom::gainnode::GainNode; use dom::globalscope::GlobalScope; @@ -28,20 +32,33 @@ use dom::promise::Promise; use dom::window::Window; use dom_struct::dom_struct; use servo_media::ServoMedia; +use js::rust::CustomAutoRooterGuard; +use js::typedarray::ArrayBuffer; use servo_media::audio::context::{AudioContext, ProcessingState}; use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions}; +use servo_media::audio::decoder::AudioDecoderCallbacks; use servo_media::audio::graph::NodeId; use std::cell::Cell; -use std::collections::VecDeque; +use std::collections::{HashMap, VecDeque}; use std::mem; use std::rc::Rc; +use std::sync::{Arc, Mutex}; use task_source::TaskSource; +use uuid::Uuid; pub enum BaseAudioContextOptions { AudioContext(RealTimeAudioContextOptions), OfflineAudioContext(OfflineAudioContextOptions), } +#[derive(JSTraceable)] +#[allow(unrooted_must_root)] +struct DecodeResolver { + pub promise: Rc, + pub success_callback: Option>, + pub error_callback: Option>, +} + #[dom_struct] pub struct BaseAudioContext { eventtarget: EventTarget, @@ -55,6 +72,8 @@ pub struct BaseAudioContext { /// https://webaudio.github.io/web-audio-api/#pendingresumepromises #[ignore_malloc_size_of = "promises are hard"] pending_resume_promises: DomRefCell>>, + #[ignore_malloc_size_of = "promises are hard"] + decode_resolvers: DomRefCell>, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate sample_rate: f32, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state @@ -85,6 +104,7 @@ impl BaseAudioContext { destination: None, in_flight_resume_promises_queue: Default::default(), pending_resume_promises: Default::default(), + decode_resolvers: Default::default(), sample_rate, state: Cell::new(AudioContextState::Suspended), }; @@ -290,13 +310,13 @@ impl BaseAudioContextMethods for BaseAudioContext { length: u32, sample_rate: Finite) -> Fallible> { if number_of_channels <= 0 || - number_of_channels > MAX_CHANNEL_COUNT || - length <= 0 || - *sample_rate <= 0. { - return Err(Error::NotSupported); - } + number_of_channels > MAX_CHANNEL_COUNT || + length <= 0 || + *sample_rate <= 0. { + return Err(Error::NotSupported); + } let global = self.global(); - Ok(AudioBuffer::new(&global.as_window(), number_of_channels, length, *sample_rate)) + Ok(AudioBuffer::new(&global.as_window(), number_of_channels, length, *sample_rate, None)) } #[allow(unsafe_code)] @@ -306,6 +326,78 @@ impl BaseAudioContextMethods for BaseAudioContext { let options = unsafe { AudioBufferSourceOptions::empty(global.get_cx()) }; AudioBufferSourceNode::new(&global.as_window(), &self, &options) } + + #[allow(unrooted_must_root)] + fn DecodeAudioData(&self, + audio_data: CustomAutoRooterGuard, + decode_success_callback: Option>, + decode_error_callback: Option>) + -> Rc { + // Step 1. + let promise = Promise::new(&self.global()); + + if audio_data.len() > 0 { + // Step 2. + // XXX detach array buffer. + let uuid = Uuid::new_v4().simple().to_string(); + let uuid_ = uuid.clone(); + self.decode_resolvers.borrow_mut().insert(uuid.clone(), DecodeResolver { + promise: promise.clone(), + success_callback: decode_success_callback, + error_callback: decode_error_callback, + }); + let audio_data = audio_data.to_vec(); + let decoded_audio = Arc::new(Mutex::new(Vec::new())); + let decoded_audio_ = decoded_audio.clone(); + let this = Trusted::new(self); + let this_ = this.clone(); + let callbacks = AudioDecoderCallbacks::new() + .eos(move || { + let this = this_.root(); + let decoded_audio = decoded_audio.lock().unwrap(); + let buffer = AudioBuffer::new( + &this.global().as_window(), + 1, // XXX servo-media should provide this info + decoded_audio.len() as u32, + this.sample_rate, + Some(decoded_audio.as_slice())); + let mut resolvers = this.decode_resolvers.borrow_mut(); + assert!(resolvers.contains_key(&uuid_)); + let resolver = resolvers.remove(&uuid_).unwrap(); + if let Some(callback) = resolver.success_callback { + let _ = callback.Call__(&buffer, ExceptionHandling::Report); + } + resolver.promise.resolve_native(&buffer); + }) + .error(move || { + let this = this.root(); + let mut resolvers = this.decode_resolvers.borrow_mut(); + assert!(resolvers.contains_key(&uuid)); + let resolver = resolvers.remove(&uuid).unwrap(); + if let Some(callback) = resolver.error_callback { + let _ = callback.Call__( + &DOMException::new(&this.global(), DOMErrorName::DataCloneError), + ExceptionHandling::Report); + } + resolver.promise.reject_error(Error::Type("Audio decode error".to_owned())); + }) + .progress(move |buffer| { + decoded_audio_ + .lock() + .unwrap() + .extend_from_slice((*buffer).as_ref()); + }) + .build(); + self.audio_context_impl.decode_audio_data(audio_data, callbacks); + } else { + // Step 3. + promise.reject_error(Error::DataClone); + return promise; + } + + // Step 4. + promise + } } impl From for AudioContextState { diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl index 9147ca5ed58..197ef3f357b 100644 --- a/components/script/dom/webidls/BaseAudioContext.webidl +++ b/components/script/dom/webidls/BaseAudioContext.webidl @@ -12,8 +12,8 @@ enum AudioContextState { "closed" }; -// callback DecodeErrorCallback = void (DOMException error); -// callback DecodeSuccessCallback = void (AudioBuffer decodedData); +callback DecodeErrorCallback = void (DOMException error); +callback DecodeSuccessCallback = void (AudioBuffer decodedData); [Exposed=Window] interface BaseAudioContext : EventTarget { @@ -27,9 +27,9 @@ interface BaseAudioContext : EventTarget { [Throws] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate); - // Promise decodeAudioData(ArrayBuffer audioData, - // optional DecodeSuccessCallback successCallback, - // optional DecodeErrorCallback errorCallback); + Promise decodeAudioData(ArrayBuffer audioData, + optional DecodeSuccessCallback successCallback, + optional DecodeErrorCallback errorCallback); AudioBufferSourceNode createBufferSource(); // ConstantSourceNode createConstantSource(); // ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, From 911b8ebd797135a3b06ef58244999f762add2954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 9 Jul 2018 16:12:58 +0200 Subject: [PATCH 36/87] Remove unsafe code to create empty AudioNodeOptions --- .../script/dom/audiobuffersourcenode.rs | 8 +++---- components/script/dom/baseaudiocontext.rs | 24 ++++--------------- components/script/dom/gainnode.rs | 3 +-- components/script/dom/oscillatornode.rs | 3 +-- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 3a1bcf6e914..64ca58b5bc9 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -7,12 +7,13 @@ use dom::audioparam::{AudioParam, AudioParamImpl}; use dom::audioscheduledsourcenode::AudioScheduledSourceNode; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding; -use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceNodeMethods; +use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; -use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; +use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding:: + AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; @@ -46,13 +47,12 @@ pub struct AudioBufferSourceNode { impl AudioBufferSourceNode { #[allow(unrooted_must_root)] - #[allow(unsafe_code)] fn new_inherited( window: &Window, context: &BaseAudioContext, options: &AudioBufferSourceOptions, ) -> AudioBufferSourceNode { - let mut node_options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; + let mut node_options = AudioNodeOptions::empty(); node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 7f65eb04cbd..9a5310f70e8 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -86,7 +86,6 @@ pub struct BaseAudioContext { impl BaseAudioContext { #[allow(unrooted_must_root)] - #[allow(unsafe_code)] pub fn new_inherited( global: &GlobalScope, options: BaseAudioContextOptions, @@ -109,7 +108,7 @@ impl BaseAudioContext { state: Cell::new(AudioContextState::Suspended), }; - let mut options = unsafe { AudioNodeOptions::empty(global.get_cx()) }; + let mut options = AudioNodeOptions::empty(); options.channelCount = Some(2); options.channelCountMode = Some(ChannelCountMode::Explicit); options.channelInterpretation = Some(ChannelInterpretation::Speakers); @@ -287,21 +286,13 @@ impl BaseAudioContextMethods for BaseAudioContext { event_handler!(statechange, GetOnstatechange, SetOnstatechange); /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createoscillator - #[allow(unsafe_code)] fn CreateOscillator(&self) -> DomRoot { - let global = self.global(); - let window = global.as_window(); - let options = unsafe { OscillatorOptions::empty(window.get_cx()) }; - OscillatorNode::new(&window, &self, &options) + OscillatorNode::new(&self.global().as_window(), &self, &OscillatorOptions::empty()) } /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-creategain - #[allow(unsafe_code)] fn CreateGain(&self) -> DomRoot { - let global = self.global(); - let window = global.as_window(); - let options = unsafe { GainOptions::empty(window.get_cx()) }; - GainNode::new(&window, &self, &options) + GainNode::new(&self.global().as_window(), &self, &GainOptions::empty()) } /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer @@ -315,16 +306,11 @@ impl BaseAudioContextMethods for BaseAudioContext { *sample_rate <= 0. { return Err(Error::NotSupported); } - let global = self.global(); - Ok(AudioBuffer::new(&global.as_window(), number_of_channels, length, *sample_rate, None)) + Ok(AudioBuffer::new(&self.global().as_window(), number_of_channels, length, *sample_rate, None)) } - #[allow(unsafe_code)] fn CreateBufferSource(&self) -> DomRoot { - let global = self.global(); - // XXX Can we do this implementing Default? - let options = unsafe { AudioBufferSourceOptions::empty(global.get_cx()) }; - AudioBufferSourceNode::new(&global.as_window(), &self, &options) + AudioBufferSourceNode::new(&self.global().as_window(), &self, &AudioBufferSourceOptions::empty()) } #[allow(unrooted_must_root)] diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index 6b43651231d..3bb2c573233 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -31,14 +31,13 @@ pub struct GainNode { } impl GainNode { - #[allow(unsafe_code)] #[allow(unrooted_must_root)] pub fn new_inherited( window: &Window, context: &BaseAudioContext, gain_options: &GainOptions, ) -> GainNode { - let mut node_options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; + let mut node_options = AudioNodeOptions::empty(); node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 0440111410a..adb9cc778bc 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -38,13 +38,12 @@ pub struct OscillatorNode { impl OscillatorNode { #[allow(unrooted_must_root)] - #[allow(unsafe_code)] pub fn new_inherited( window: &Window, context: &BaseAudioContext, oscillator_options: &OscillatorOptions, ) -> OscillatorNode { - let mut node_options = unsafe { AudioNodeOptions::empty(window.get_cx()) }; + let mut node_options = AudioNodeOptions::empty(); node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); From 34ba14385a52f062904c252818174a3c8d175016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 9 Jul 2018 17:55:03 +0200 Subject: [PATCH 37/87] Fix regex duplicated versions --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 5d67aab91de..3af0c07f7a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4102,3 +4102,4 @@ dependencies = [ "checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1" "checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" "checksum xml5ever 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead952cf8bab253fb5cb56e1fff780747bbf7a7258fb0451afe645a166050b1f" + From 8f9a081ff0395e84bf303c1baa68447c087f6243 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 9 Jul 2018 23:02:17 -0700 Subject: [PATCH 38/87] Fix Trusted usage in audio decoder to queue tasks (#3) --- components/script/dom/baseaudiocontext.rs | 63 +++++++++++++---------- components/script/lib.rs | 2 + 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 9a5310f70e8..4404a519312 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -195,7 +195,8 @@ impl BaseAudioContext { } pub fn resume(&self) { - let window = DomRoot::downcast::(self.global()).unwrap(); + let global = self.global(); + let window = global.as_window(); let task_source = window.dom_manipulation_task_source(); let this = Trusted::new(self); // Set the rendering thread state to 'running' and start @@ -321,6 +322,8 @@ impl BaseAudioContextMethods for BaseAudioContext { -> Rc { // Step 1. let promise = Promise::new(&self.global()); + let global = self.global(); + let window = global.as_window(); if audio_data.len() > 0 { // Step 2. @@ -337,35 +340,43 @@ impl BaseAudioContextMethods for BaseAudioContext { let decoded_audio_ = decoded_audio.clone(); let this = Trusted::new(self); let this_ = this.clone(); + let task_source = window.dom_manipulation_task_source(); + let task_source_ = window.dom_manipulation_task_source(); + let canceller = window.task_canceller(); + let canceller_ = window.task_canceller(); let callbacks = AudioDecoderCallbacks::new() .eos(move || { - let this = this_.root(); - let decoded_audio = decoded_audio.lock().unwrap(); - let buffer = AudioBuffer::new( - &this.global().as_window(), - 1, // XXX servo-media should provide this info - decoded_audio.len() as u32, - this.sample_rate, - Some(decoded_audio.as_slice())); - let mut resolvers = this.decode_resolvers.borrow_mut(); - assert!(resolvers.contains_key(&uuid_)); - let resolver = resolvers.remove(&uuid_).unwrap(); - if let Some(callback) = resolver.success_callback { - let _ = callback.Call__(&buffer, ExceptionHandling::Report); - } - resolver.promise.resolve_native(&buffer); + let _ = task_source.queue_with_canceller(task!(audio_decode_eos: move || { + let this = this.root(); + let decoded_audio = decoded_audio.lock().unwrap(); + let buffer = AudioBuffer::new( + &this.global().as_window(), + 1, // XXX servo-media should provide this info + decoded_audio.len() as u32, + this.sample_rate, + Some(decoded_audio.as_slice())); + let mut resolvers = this.decode_resolvers.borrow_mut(); + assert!(resolvers.contains_key(&uuid_)); + let resolver = resolvers.remove(&uuid_).unwrap(); + if let Some(callback) = resolver.success_callback { + let _ = callback.Call__(&buffer, ExceptionHandling::Report); + } + resolver.promise.resolve_native(&buffer); + }), &canceller); }) .error(move || { - let this = this.root(); - let mut resolvers = this.decode_resolvers.borrow_mut(); - assert!(resolvers.contains_key(&uuid)); - let resolver = resolvers.remove(&uuid).unwrap(); - if let Some(callback) = resolver.error_callback { - let _ = callback.Call__( - &DOMException::new(&this.global(), DOMErrorName::DataCloneError), - ExceptionHandling::Report); - } - resolver.promise.reject_error(Error::Type("Audio decode error".to_owned())); + let _ = task_source_.queue_with_canceller(task!(audio_decode_eos: move || { + let this = this_.root(); + let mut resolvers = this.decode_resolvers.borrow_mut(); + assert!(resolvers.contains_key(&uuid)); + let resolver = resolvers.remove(&uuid).unwrap(); + if let Some(callback) = resolver.error_callback { + let _ = callback.Call__( + &DOMException::new(&this.global(), DOMErrorName::DataCloneError), + ExceptionHandling::Report); + } + resolver.promise.reject_error(Error::Type("Audio decode error".to_owned())); + }), &canceller_); }) .progress(move |buffer| { decoded_audio_ diff --git a/components/script/lib.rs b/components/script/lib.rs index 5125607219b..3275f10a65f 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -13,6 +13,8 @@ #![deny(unsafe_code)] #![allow(non_snake_case)] +#![recursion_limit = "128"] + #![doc = "The script crate contains all matters DOM."] #![plugin(script_plugins)] From f0d04249f9fe7a9ee78a868e27268708b6ec0cf1 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 9 Jul 2018 23:10:20 -0700 Subject: [PATCH 39/87] Use new params impl (#4) * AudioNodeType -> AudioNodeInit * Use new param type system, clean up --- .../script/dom/audiobuffersourcenode.rs | 24 ++--- components/script/dom/audiodestinationnode.rs | 4 +- components/script/dom/audionode.rs | 4 +- components/script/dom/audioparam.rs | 101 +++++++++++++----- .../script/dom/audioscheduledsourcenode.rs | 4 +- components/script/dom/bindings/trace.rs | 2 + components/script/dom/gainnode.rs | 20 ++-- components/script/dom/macros.rs | 75 +------------ components/script/dom/oscillatornode.rs | 25 ++--- 9 files changed, 113 insertions(+), 146 deletions(-) diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 64ca58b5bc9..6c709c17d9a 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audiobuffer::AudioBuffer; -use dom::audioparam::{AudioParam, AudioParamImpl}; +use dom::audioparam::AudioParam; use dom::audioscheduledsourcenode::AudioScheduledSourceNode; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding; @@ -23,16 +23,10 @@ use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage; use servo_media::audio::buffer_source_node::AudioBufferSourceNodeOptions; -use servo_media::audio::context::AudioContext; -use servo_media::audio::graph::NodeId; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; -use servo_media::audio::param::{UserAutomationEvent, RampKind}; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit}; +use servo_media::audio::param::ParamType; use std::cell::Cell; use std::f32; -use std::rc::Rc; - -audio_param_impl!(PlaybackRate, AudioBufferSourceNode, AudioBufferSourceNodeMessage, SetPlaybackRate); -audio_param_impl!(Detune, AudioBufferSourceNode, AudioBufferSourceNodeMessage, SetDetune); #[dom_struct] pub struct AudioBufferSourceNode { @@ -57,22 +51,24 @@ impl AudioBufferSourceNode { node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); let source_node = AudioScheduledSourceNode::new_inherited( - AudioNodeType::AudioBufferSourceNode(options.into()), + AudioNodeInit::AudioBufferSourceNode(options.into()), context, &node_options, 0 /* inputs */, 1 /* outputs */, ); let node_id = source_node.node().node_id(); - let playback_rate = PlaybackRate::new(context.audio_context_impl(), node_id); let playback_rate = AudioParam::new(&window, - Box::new(playback_rate), + context, + node_id, + ParamType::PlaybackRate, AutomationRate::K_rate, *options.playbackRate, f32::MIN, f32::MAX); - let detune = Detune::new(context.audio_context_impl(), node_id); let detune = AudioParam::new(&window, - Box::new(detune), + context, + node_id, + ParamType::Detune, AutomationRate::K_rate, *options.detune, f32::MIN, f32::MAX); diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs index 83cfedb8584..95fe4e044b4 100644 --- a/components/script/dom/audiodestinationnode.rs +++ b/components/script/dom/audiodestinationnode.rs @@ -10,7 +10,7 @@ use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use servo_media::audio::node::AudioNodeType; +use servo_media::audio::node::AudioNodeInit; #[dom_struct] pub struct AudioDestinationNode { @@ -21,7 +21,7 @@ impl AudioDestinationNode { fn new_inherited(context: &BaseAudioContext, options: &AudioNodeOptions) -> AudioDestinationNode { AudioDestinationNode { - node: AudioNode::new_inherited(AudioNodeType::DestinationNode, + node: AudioNode::new_inherited(AudioNodeInit::DestinationNode, Some(context.destination_node()), context, options, 1, 1), } diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index a4b0dfecc34..31090851737 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -11,7 +11,7 @@ use dom::audioparam::AudioParam; use dom::eventtarget::EventTarget; use dom_struct::dom_struct; use servo_media::audio::graph::NodeId; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit}; use std::cell::Cell; // 32 is the minimum required by the spec for createBuffer() and the deprecated @@ -33,7 +33,7 @@ pub struct AudioNode { } impl AudioNode { - pub fn new_inherited(node_type: AudioNodeType, + pub fn new_inherited(node_type: AudioNodeInit, node_id: Option, context: &BaseAudioContext, options: &AudioNodeOptions, diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index b21ee86b57b..4c67e08cb5c 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -2,31 +2,27 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioParamBinding; use dom::bindings::codegen::Bindings::AudioParamBinding::{AudioParamMethods, AutomationRate}; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::DomRoot; -use dom::bindings::trace::JSTraceable; +use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; -use malloc_size_of::MallocSizeOf; -use servo_media::audio::param::RampKind; +use servo_media::audio::graph::NodeId; +use servo_media::audio::node::AudioNodeMessage; +use servo_media::audio::param::{ParamType, RampKind, UserAutomationEvent}; use std::cell::Cell; -pub trait AudioParamImpl: JSTraceable + MallocSizeOf { - fn set_value(&self, value: f32); - fn set_value_at_time(&self, value: f32, start_time: f64); - fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64); - fn set_target_at_time(&self, value: f32, start_time: f64, time_constant: f32); - fn cancel_scheduled_values(&self, cancel_time: f64); - fn cancel_and_hold_at_time(&self, cancel_time: f64); -} - #[dom_struct] pub struct AudioParam { reflector_: Reflector, - param_impl: Box, + context: Dom, + #[ignore_malloc_size_of = "servo_media"] + node: NodeId, + #[ignore_malloc_size_of = "servo_media"] + param: ParamType, automation_rate: Cell, default_value: f32, min_value: f32, @@ -34,14 +30,18 @@ pub struct AudioParam { } impl AudioParam { - pub fn new_inherited(param_impl: Box, + pub fn new_inherited(context: &BaseAudioContext, + node: NodeId, + param: ParamType, automation_rate: AutomationRate, default_value: f32, min_value: f32, max_value: f32) -> AudioParam { AudioParam { reflector_: Reflector::new(), - param_impl, + context: Dom::from_ref(context), + node, + param, automation_rate: Cell::new(automation_rate), default_value, min_value, @@ -51,12 +51,14 @@ impl AudioParam { #[allow(unrooted_must_root)] pub fn new(window: &Window, - param_impl: Box, + context: &BaseAudioContext, + node: NodeId, + param: ParamType, automation_rate: AutomationRate, default_value: f32, min_value: f32, max_value: f32) -> DomRoot { - let audio_param = AudioParam::new_inherited(param_impl, automation_rate, + let audio_param = AudioParam::new_inherited(context, node, param, automation_rate, default_value, min_value, max_value); reflect_dom_object(Box::new(audio_param), window, AudioParamBinding::Wrap) } @@ -78,7 +80,14 @@ impl AudioParamMethods for AudioParam { } fn SetValue(&self, value: Finite) { - self.param_impl.set_value(*value); + self.context.audio_context_impl() + .message_node(self.node, + AudioNodeMessage::SetParam(self.param, + UserAutomationEvent::SetValue( + *value + ) + ) + ); } fn DefaultValue(&self) -> Finite { @@ -96,38 +105,80 @@ impl AudioParamMethods for AudioParam { fn SetValueAtTime(&self, value: Finite, start_time: Finite) -> DomRoot { - self.param_impl.set_value_at_time(*value, *start_time); + self.context.audio_context_impl() + .message_node(self.node, + AudioNodeMessage::SetParam(self.param, + UserAutomationEvent::SetValueAtTime( + *value, *start_time + ) + ) + ); DomRoot::from_ref(self) } fn LinearRampToValueAtTime(&self, value: Finite, end_time: Finite) -> DomRoot { - self.param_impl.ramp_to_value_at_time(RampKind::Linear, *value, *end_time); + self.context.audio_context_impl() + .message_node(self.node, + AudioNodeMessage::SetParam(self.param, + UserAutomationEvent::RampToValueAtTime( + RampKind::Linear, *value, *end_time + ) + ) + ); DomRoot::from_ref(self) } fn ExponentialRampToValueAtTime(&self, value: Finite, end_time: Finite) -> DomRoot { - self.param_impl.ramp_to_value_at_time(RampKind::Exponential, *value, *end_time); + self.context.audio_context_impl() + .message_node(self.node, + AudioNodeMessage::SetParam(self.param, + UserAutomationEvent::RampToValueAtTime( + RampKind::Exponential, *value, *end_time + ) + ) + ); DomRoot::from_ref(self) } fn SetTargetAtTime(&self, target: Finite, start_time: Finite, time_constant: Finite) -> DomRoot { - self.param_impl.set_target_at_time(*target, *start_time, *time_constant); + self.context.audio_context_impl() + .message_node(self.node, + AudioNodeMessage::SetParam(self.param, + UserAutomationEvent::SetTargetAtTime( + *target, *start_time, (*time_constant).into() + ) + ) + ); DomRoot::from_ref(self) } fn CancelScheduledValues(&self, cancel_time: Finite) -> DomRoot { - self.param_impl.cancel_scheduled_values(*cancel_time); + self.context.audio_context_impl() + .message_node(self.node, + AudioNodeMessage::SetParam(self.param, + UserAutomationEvent::CancelScheduledValues( + *cancel_time + ) + ) + ); DomRoot::from_ref(self) } fn CancelAndHoldAtTime(&self, cancel_time: Finite) -> DomRoot { - self.param_impl.cancel_and_hold_at_time(*cancel_time); + self.context.audio_context_impl() + .message_node(self.node, + AudioNodeMessage::SetParam(self.param, + UserAutomationEvent::CancelAndHoldAtTime( + *cancel_time + ) + ) + ); DomRoot::from_ref(self) } } diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index da284e02910..25ae2c009ed 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::error::{Error, Fallible}; use dom::bindings::num::Finite; use dom_struct::dom_struct; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeType, AudioScheduledSourceNodeMessage}; +use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit, AudioScheduledSourceNodeMessage}; use std::cell::Cell; #[dom_struct] @@ -19,7 +19,7 @@ pub struct AudioScheduledSourceNode { } impl AudioScheduledSourceNode { - pub fn new_inherited(node_type: AudioNodeType, + pub fn new_inherited(node_type: AudioNodeInit, context: &BaseAudioContext, options: &AudioNodeOptions, number_of_inputs: u32, diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 898bb9fe490..bf6ac823603 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -83,6 +83,7 @@ use profile_traits::time::ProfilerChan as TimeProfilerChan; use servo_media::audio::buffer_source_node::AudioBuffer; use servo_media::audio::context::AudioContext; use servo_media::audio::graph::NodeId; +use servo_media::audio::param::ParamType; use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; @@ -436,6 +437,7 @@ unsafe_no_jsmanaged_fields!(AudioGraph); unsafe_no_jsmanaged_fields!(AudioBuffer); unsafe_no_jsmanaged_fields!(AudioContext); unsafe_no_jsmanaged_fields!(NodeId); +unsafe_no_jsmanaged_fields!(ParamType); unsafe impl<'a> JSTraceable for &'a str { #[inline] diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index 3bb2c573233..2aef086cd57 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audionode::AudioNode; -use dom::audioparam::{AudioParam, AudioParamImpl}; +use dom::audioparam::AudioParam; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; @@ -14,15 +14,10 @@ use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; -use servo_media::audio::context::AudioContext; -use servo_media::audio::gain_node::{GainNodeMessage, GainNodeOptions}; -use servo_media::audio::graph::NodeId; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; -use servo_media::audio::param::{UserAutomationEvent, RampKind}; +use servo_media::audio::gain_node::GainNodeOptions; +use servo_media::audio::node::AudioNodeInit; +use servo_media::audio::param::ParamType; use std::f32; -use std::rc::Rc; - -audio_param_impl!(Gain, GainNode, GainNodeMessage, SetGain); #[dom_struct] pub struct GainNode { @@ -42,16 +37,17 @@ impl GainNode { node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); let node = AudioNode::new_inherited( - AudioNodeType::GainNode(gain_options.into()), + AudioNodeInit::GainNode(gain_options.into()), None, context, &node_options, 1, // inputs 1, // outputs ); - let gain = Gain::new(context.audio_context_impl(), node.node_id()); let gain = AudioParam::new(window, - Box::new(gain), + context, + node.node_id(), + ParamType::Gain, AutomationRate::A_rate, 1., // default value f32::MIN, // min value diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 923d0bb9873..7d9172cbe7b 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -628,77 +628,4 @@ macro_rules! handle_potential_webgl_error { ($context:expr, $call:expr) => { handle_potential_webgl_error!($context, $call, ()); }; -} - -macro_rules! audio_param_impl( - ($struct:ident, $node_type:ident, $message_type:ident, $setter:ident) => ( - #[derive(JSTraceable, MallocSizeOf)] - struct $struct { - #[ignore_malloc_size_of = "Rc"] - context: Rc, - #[ignore_malloc_size_of = "servo_media"] - node: NodeId, - } - - impl $struct { - pub fn new(context: Rc, - node: NodeId) -> Self { - Self { - context, - node, - } - } - } - - impl AudioParamImpl for $struct { - fn set_value(&self, value: f32) { - self.set_value_at_time(value, self.context.current_time()); - } - - fn set_value_at_time(&self, value: f32, start_time: f64) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::SetValueAtTime(value, start_time), - )), - ); - } - - fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::RampToValueAtTime(ramp_kind, value, end_time), - )), - ); - } - - fn set_target_at_time(&self, target: f32, start_time: f64, time_constant: f32) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::SetTargetAtTime(target, start_time, time_constant.into()), - )), - ); - } - - fn cancel_scheduled_values(&self, cancel_time: f64) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::CancelScheduledValues(cancel_time), - )), - ); - } - - fn cancel_and_hold_at_time(&self, cancel_time: f64) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::CancelAndHoldAtTime(cancel_time), - )), - ); - } - } - ); -); +} \ No newline at end of file diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index adb9cc778bc..131b76fd616 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -2,7 +2,7 @@ * License, v.2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::audioparam::{AudioParam, AudioParamImpl}; +use dom::audioparam::AudioParam; use dom::audioscheduledsourcenode::AudioScheduledSourceNode; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; @@ -15,18 +15,11 @@ use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; -use servo_media::audio::context::AudioContext; -use servo_media::audio::graph::NodeId; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; +use servo_media::audio::node::AudioNodeInit; use servo_media::audio::oscillator_node::OscillatorNodeOptions as ServoMediaOscillatorOptions; use servo_media::audio::oscillator_node::OscillatorType as ServoMediaOscillatorType; -use servo_media::audio::oscillator_node::OscillatorNodeMessage; -use servo_media::audio::param::{UserAutomationEvent, RampKind}; +use servo_media::audio::param::ParamType; use std::f32; -use std::rc::Rc; - -audio_param_impl!(Frequency, OscillatorNode, OscillatorNodeMessage, SetFrequency); -audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); #[dom_struct] pub struct OscillatorNode { @@ -48,21 +41,23 @@ impl OscillatorNode { node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); let source_node = AudioScheduledSourceNode::new_inherited( - AudioNodeType::OscillatorNode(oscillator_options.into()), + AudioNodeInit::OscillatorNode(oscillator_options.into()), context, &node_options, 0, /* inputs */ 1, /* outputs */ ); let node_id = source_node.node().node_id(); - let frequency = Frequency::new(context.audio_context_impl(), node_id); let frequency = AudioParam::new(window, - Box::new(frequency), + context, + node_id, + ParamType::Frequency, AutomationRate::A_rate, 440., f32::MIN, f32::MAX); - let detune = Detune::new(context.audio_context_impl(), node_id); let detune = AudioParam::new(window, - Box::new(detune), + context, + node_id, + ParamType::Detune, AutomationRate::A_rate, 0., -440. / 2., 440. / 2.); From 6ac4b4b8e0aad2aaa0c383ddfabab5f0597dff2a Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 9 Jul 2018 23:51:51 -0700 Subject: [PATCH 40/87] Fix context comparison (#5) * Fix comparison of audiocontexts * Fix comparison --- components/script/dom/audionode.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 31090851737..44ae993963e 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -69,8 +69,8 @@ impl AudioNodeMethods for AudioNode { destination: &AudioNode, output: u32, input: u32) -> Fallible> { - if *(self.context) != *(destination.Context()) { - //XXX return Err(Error::InvalidAccess); + if self.context != destination.context { + return Err(Error::InvalidAccess); } if output >= self.NumberOfOutputs() || From 723f1b058261f2ab2d52e8a98da1f178075930b9 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 10 Jul 2018 00:34:11 -0700 Subject: [PATCH 41/87] Fix construction of destination node (#6) * Fix comparison of audiocontexts * Fix comparison * Fix destination node construction --- components/script/dom/audionode.rs | 1 + components/script/dom/baseaudiocontext.rs | 26 +++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 44ae993963e..10758ebd3c5 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -69,6 +69,7 @@ impl AudioNodeMethods for AudioNode { destination: &AudioNode, output: u32, input: u32) -> Fallible> { + if self.context != destination.context { return Err(Error::InvalidAccess); } diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 4404a519312..c09fe9971f5 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -22,7 +22,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::domexception::{DOMErrorName, DOMException}; use dom::eventtarget::EventTarget; use dom::gainnode::GainNode; @@ -65,7 +65,7 @@ pub struct BaseAudioContext { #[ignore_malloc_size_of = "servo_media"] audio_context_impl: Rc, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination - destination: Option>, + destination: MutNullableDom, /// Resume promises which are soon to be fulfilled by a queued task. #[ignore_malloc_size_of = "promises are hard"] in_flight_resume_promises_queue: DomRefCell]>, ErrorResult)>>, @@ -87,7 +87,7 @@ pub struct BaseAudioContext { impl BaseAudioContext { #[allow(unrooted_must_root)] pub fn new_inherited( - global: &GlobalScope, + _: &GlobalScope, options: BaseAudioContextOptions, ) -> BaseAudioContext { let options = match options { @@ -97,10 +97,10 @@ impl BaseAudioContext { let sample_rate = options.sample_rate; - let mut context = BaseAudioContext { + let context = BaseAudioContext { eventtarget: EventTarget::new_inherited(), audio_context_impl: Rc::new(ServoMedia::get().unwrap().create_audio_context(options.into())), - destination: None, + destination: Default::default(), in_flight_resume_promises_queue: Default::default(), pending_resume_promises: Default::default(), decode_resolvers: Default::default(), @@ -108,13 +108,6 @@ impl BaseAudioContext { state: Cell::new(AudioContextState::Suspended), }; - let mut options = AudioNodeOptions::empty(); - options.channelCount = Some(2); - options.channelCountMode = Some(ChannelCountMode::Explicit); - options.channelInterpretation = Some(ChannelInterpretation::Speakers); - - context.destination = Some(AudioDestinationNode::new(global, &context, &options)); - context } @@ -280,7 +273,14 @@ impl BaseAudioContextMethods for BaseAudioContext { /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination fn Destination(&self) -> DomRoot { - DomRoot::from_ref(self.destination.as_ref().unwrap()) + let global = self.global(); + self.destination.or_init(|| { + let mut options = AudioNodeOptions::empty(); + options.channelCount = Some(2); + options.channelCountMode = Some(ChannelCountMode::Explicit); + options.channelInterpretation = Some(ChannelInterpretation::Speakers); + AudioDestinationNode::new(&global, self, &options) + }) } /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange From ff1d5a5b471a19a1e392de815d2470cb24e8384d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 10 Jul 2018 10:13:23 +0200 Subject: [PATCH 42/87] Fix Cargo.lock rebase issues --- Cargo.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 3af0c07f7a8..5d67aab91de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4102,4 +4102,3 @@ dependencies = [ "checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1" "checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" "checksum xml5ever 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead952cf8bab253fb5cb56e1fff780747bbf7a7258fb0451afe645a166050b1f" - From 9dda87aa70df51205c7744b382f3abd2c3db3439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 10 Jul 2018 09:43:35 +0200 Subject: [PATCH 43/87] Enable WPTs --- tests/wpt/include.ini | 2 ++ .../webaudio/idlharness.https.html.ini | 4 ++++ .../ctor-analyser.html.ini | 11 ++++++++++ .../realtimeanalyser-basic.html.ini | 2 ++ .../realtimeanalyser-fft-scaling.html.ini | 2 ++ .../realtimeanalyser-fft-sizing.html.ini | 2 ++ .../test-analyser-gain.html.ini | 4 ++++ .../test-analyser-minimum.html.ini | 4 ++++ .../test-analyser-output.html.ini | 4 ++++ .../test-analyser-scale.html.ini | 4 ++++ .../test-analysernode.html.ini | 7 ++++++ .../audiobuffer-copy-channel.html.ini | 2 ++ .../ctor-audiobuffer.html.ini | 8 +++++++ .../ctor-audiobuffersource.html.ini | 14 ++++++++++++ .../audiocontext-suspend-resume.html.ini | 5 +++++ .../audiocontextoptions.html.ini | 2 ++ .../audionode-channel-rules.html.ini | 2 ++ ...audionode-connect-method-chaining.html.ini | 2 ++ .../audionode-connect-order.html.ini | 2 ++ .../audionode-connect-return-value.html.ini | 4 ++++ .../audionode-disconnect-audioparam.html.ini | 2 ++ .../audionode-disconnect.html.ini | 2 ++ .../audionode.html.ini | 13 +++++++++++ .../channel-mode-interp-basic.html.ini | 2 ++ ...udioparam-connect-audioratesignal.html.ini | 2 ++ .../audioparam-exceptional-values.html.ini | 8 +++++++ ...aram-exponentialRampToValueAtTime.html.ini | 2 ++ .../audioparam-large-endtime.html.ini | 2 ++ ...udioparam-linearRampToValueAtTime.html.ini | 2 ++ .../audioparam-method-chaining.html.ini | 2 ++ .../audioparam-setTargetAtTime.html.ini | 2 ++ .../audioparam-setValueAtTime.html.ini | 2 ++ ...dioparam-setValueCurve-exceptions.html.ini | 2 ++ .../audioparam-setValueCurveAtTime.html.ini | 2 ++ .../audioparam-summingjunction.html.ini | 2 ++ .../automation-rate.html.ini | 2 ++ .../event-insertion.html.ini | 2 ++ .../k-rate-audioworklet.https.html.ini | 2 ++ .../k-rate-biquad.html.ini | 2 ++ .../k-rate-constant-source.html.ini | 2 ++ .../k-rate-delay.html.ini | 2 ++ .../k-rate-gain.html.ini | 2 ++ .../k-rate-oscillator.html.ini | 2 ++ .../k-rate-panner.html.ini | 2 ++ .../k-rate-stereo-panner.html.ini | 2 ++ ...tive-exponentialRampToValueAtTime.html.ini | 2 ++ ...ospective-linearRampToValueAtTime.html.ini | 2 ++ .../retrospective-setTargetAtTime.html.ini | 2 ++ .../retrospective-setValueAtTime.html.ini | 2 ++ ...retrospective-setValueCurveAtTime.html.ini | 2 ++ ...etAtTime-after-event-within-block.html.ini | 4 ++++ .../setValueAtTime-within-block.html.ini | 4 ++++ ...orklet-addmodule-resolution.https.html.ini | 4 ++++ .../audioworklet-audioparam.https.html.ini | 2 ++ .../audioworklet-messageport.https.html.ini | 4 ++++ ...kletglobalscope-sample-rate.https.html.ini | 4 ++++ ...kletglobalscope-timing-info.https.html.ini | 4 ++++ ...oworkletnode-automatic-pull.https.html.ini | 2 ++ ...ioworkletnode-channel-count.https.html.ini | 2 ++ ...dioworkletnode-construction.https.html.ini | 8 +++++++ ...letnode-constructor-options.https.html.ini | 2 ++ ...kletnode-disconnected-input.https.html.ini | 2 ++ .../audioworkletnode-onerror.https.html.ini | 4 ++++ ...dioworkletprocessor-options.https.html.ini | 2 ++ ...seaudiocontext-audioworklet.https.html.ini | 4 ++++ .../biquad-allpass.html.ini | 2 ++ .../biquad-automation.html.ini | 2 ++ .../biquad-bandpass.html.ini | 2 ++ .../biquad-basic.html.ini | 8 +++++++ .../biquad-getFrequencyResponse.html.ini | 2 ++ .../biquad-highpass.html.ini | 2 ++ .../biquad-highshelf.html.ini | 2 ++ .../biquad-lowpass.html.ini | 2 ++ .../biquad-lowshelf.html.ini | 2 ++ .../biquad-notch.html.ini | 2 ++ .../biquad-peaking.html.ini | 2 ++ .../biquad-tail.html.ini | 2 ++ .../biquadfilternode-basic.html.ini | 2 ++ .../ctor-biquadfilter.html.ini | 11 ++++++++++ .../no-dezippering.html.ini | 2 ++ .../audiochannelmerger-basic.html.ini | 2 ++ .../audiochannelmerger-disconnect.html.ini | 2 ++ ...iochannelmerger-input-non-default.html.ini | 2 ++ .../audiochannelmerger-input.html.ini | 2 ++ .../ctor-channelmerger.html.ini | 11 ++++++++++ .../audiochannelsplitter.html.ini | 2 ++ .../ctor-channelsplitter.html.ini | 11 ++++++++++ .../constant-source-basic.html.ini | 5 +++++ .../constant-source-onended.html.ini | 4 ++++ .../constant-source-output.html.ini | 2 ++ .../ctor-constantsource.html.ini | 11 ++++++++++ .../test-constantsourcenode.html.ini | 19 ++++++++++++++++ .../convolution-mono-mono.html.ini | 2 ++ .../convolver-cascade.html.ini | 2 ++ .../convolver-channels.html.ini | 2 ++ .../convolver-response-1-chan.html.ini | 2 ++ .../convolver-response-2-chan.html.ini | 2 ++ .../convolver-response-4-chan.html.ini | 2 ++ .../convolver-setBuffer-null.html.ini | 2 ++ .../ctor-convolver.html.ini | 11 ++++++++++ .../ctor-delay.html.ini | 11 ++++++++++ .../delaynode-max-default-delay.html.ini | 2 ++ .../delaynode-max-nondefault-delay.html.ini | 2 ++ .../delaynode-maxdelay.html.ini | 2 ++ .../delaynode-maxdelaylimit.html.ini | 2 ++ .../delaynode-scheduling.html.ini | 2 ++ .../delaynode.html.ini | 2 ++ .../no-dezippering.html.ini | 2 ++ .../ctor-dynamicscompressor.html.ini | 11 ++++++++++ .../dynamicscompressor-basic.html.ini | 2 ++ .../the-gainnode-interface/ctor-gain.html.ini | 14 ++++++++++++ .../the-gainnode-interface/gain.html.ini | 2 ++ .../no-dezippering.html.ini | 2 ++ .../test-gainnode.html.ini | 5 +++++ .../ctor-iirfilter.html.ini | 11 ++++++++++ .../iirfilter-basic.html.ini | 8 +++++++ .../iirfilter-getFrequencyResponse.html.ini | 2 ++ .../iirfilter.html.ini | 2 ++ .../test-iirfilternode.html.ini | 22 +++++++++++++++++++ ...tAudioSourceToScriptProcessorTest.html.ini | 5 +++++ .../ctor-offlineaudiocontext.html.ini | 11 ++++++++++ .../current-time-block-size.html.ini | 4 ++++ .../ctor-oscillator.html.ini | 14 ++++++++++++ .../ctor-panner.html.ini | 11 ++++++++++ .../distance-exponential.html.ini | 2 ++ .../distance-inverse.html.ini | 2 ++ .../distance-linear.html.ini | 2 ++ .../panner-automation-basic.html.ini | 2 ++ ...nner-automation-equalpower-stereo.html.ini | 2 ++ .../panner-automation-position.html.ini | 2 ++ .../panner-distance-clamping.html.ini | 2 ++ .../panner-equalpower-stereo.html.ini | 2 ++ .../panner-equalpower.html.ini | 2 ++ .../panner-rolloff-clamping.html.ini | 2 ++ .../pannernode-basic.html.ini | 8 +++++++ .../test-pannernode-automation.html.ini | 4 ++++ .../ctor-stereopanner.html.ini | 11 ++++++++++ .../no-dezippering.html.ini | 2 ++ .../stereopannernode-basic.html.ini | 2 ++ .../stereopannernode-panning.html.ini | 2 ++ .../ctor-waveshaper.html.ini | 11 ++++++++++ .../curve-tests.html.ini | 5 +++++ .../silent-inputs.html.ini | 2 ++ .../waveshaper-copy-curve.html.ini | 2 ++ .../waveshaper-limits.html.ini | 2 ++ .../waveshaper-simple.html.ini | 2 ++ .../waveshaper.html.ini | 2 ++ 147 files changed, 585 insertions(+) create mode 100644 tests/wpt/metadata/webaudio/idlharness.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/ctor-analyser.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-sizing.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-method-chaining.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-order.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect-audioparam.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-method-chaining.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurveAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/event-insertion.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-audioworklet.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-automatic-pull.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-disconnected-input.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-allpass.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-bandpass.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highpass.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highshelf.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowpass.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowshelf.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-notch.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-peaking.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-tail.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-disconnect.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input-non-default.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/ctor-channelmerger.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/ctor-channelsplitter.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-onended.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/ctor-constantsource.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolution-mono-mono.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-cascade.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-channels.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-null.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/ctor-delay.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-default-delay.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-nondefault-delay.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelay.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-scheduling.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/no-dezippering.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/gain.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/no-dezippering.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/test-iirfilternode.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-exponential.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-inverse.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-linear.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-equalpower-stereo.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-stereo.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/ctor-stereopanner.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-panning.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/ctor-waveshaper.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/curve-tests.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/silent-inputs.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-simple.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper.html.ini diff --git a/tests/wpt/include.ini b/tests/wpt/include.ini index ea27b0791d5..300308ea7cb 100644 --- a/tests/wpt/include.ini +++ b/tests/wpt/include.ini @@ -107,6 +107,8 @@ skip: true skip: false [url] skip: false +[webaudio] + skip: false [WebCryptoAPI] skip: false [webgl] diff --git a/tests/wpt/metadata/webaudio/idlharness.https.html.ini b/tests/wpt/metadata/webaudio/idlharness.https.html.ini new file mode 100644 index 00000000000..64d4148b7a2 --- /dev/null +++ b/tests/wpt/metadata/webaudio/idlharness.https.html.ini @@ -0,0 +1,4 @@ +[idlharness.https.html] + [WebAudio IDL tests] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/ctor-analyser.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/ctor-analyser.html.ini new file mode 100644 index 00000000000..f5269d37fde --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/ctor-analyser.html.ini @@ -0,0 +1,11 @@ +[ctor-analyser.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new AnalyserNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic.html.ini new file mode 100644 index 00000000000..f48362f4d5c --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic.html.ini @@ -0,0 +1,2 @@ +[realtimeanalyser-basic.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini new file mode 100644 index 00000000000..75d8cd648df --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini @@ -0,0 +1,2 @@ +[realtimeanalyser-fft-scaling.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-sizing.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-sizing.html.ini new file mode 100644 index 00000000000..6e6b8e650d1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-sizing.html.ini @@ -0,0 +1,2 @@ +[realtimeanalyser-fft-sizing.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html.ini new file mode 100644 index 00000000000..b972dd44f6c --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html.ini @@ -0,0 +1,4 @@ +[test-analyser-gain.html] + [Test effect of AnalyserNode on GainNode output] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html.ini new file mode 100644 index 00000000000..447d580b11d --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html.ini @@ -0,0 +1,4 @@ +[test-analyser-minimum.html] + [Test AnalyserNode when the input is silent] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html.ini new file mode 100644 index 00000000000..a534a25d22d --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html.ini @@ -0,0 +1,4 @@ +[test-analyser-output.html] + [AnalyserNode output] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html.ini new file mode 100644 index 00000000000..85616419537 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html.ini @@ -0,0 +1,4 @@ +[test-analyser-scale.html] + [Test AnalyserNode when the input is scaled] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html.ini new file mode 100644 index 00000000000..5d4013b58ba --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html.ini @@ -0,0 +1,7 @@ +[test-analysernode.html] + [Test AnalyserNode API] + expected: FAIL + + [Test AnalyserNode's ctor API] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel.html.ini new file mode 100644 index 00000000000..4010758ca64 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel.html.ini @@ -0,0 +1,2 @@ +[audiobuffer-copy-channel.html] + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini new file mode 100644 index 00000000000..11144a484d2 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini @@ -0,0 +1,8 @@ +[ctor-audiobuffer.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini new file mode 100644 index 00000000000..cb9953a5945 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini @@ -0,0 +1,14 @@ +[ctor-audiobuffersource.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new AudioBufferSourceNode(context) incorrectly threw TypeError: "Value is not an object.".] + expected: FAIL + + [X node0 instanceof AudioBufferSourceNode is not equal to true. Got false.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini new file mode 100644 index 00000000000..d3a0f34dc1b --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini @@ -0,0 +1,5 @@ +[audiocontext-suspend-resume.html] + expected: ERROR + [X offlineContext = new OfflineAudioContext(1, 44100, 44100) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini new file mode 100644 index 00000000000..2eaee7d5a46 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini @@ -0,0 +1,2 @@ +[audiocontextoptions.html] + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini new file mode 100644 index 00000000000..270831b7378 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini @@ -0,0 +1,2 @@ +[audionode-channel-rules.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-method-chaining.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-method-chaining.html.ini new file mode 100644 index 00000000000..fcc810e1dd7 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-method-chaining.html.ini @@ -0,0 +1,2 @@ +[audionode-connect-method-chaining.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-order.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-order.html.ini new file mode 100644 index 00000000000..416dfa0ae18 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-order.html.ini @@ -0,0 +1,2 @@ +[audionode-connect-order.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini new file mode 100644 index 00000000000..e4a66b55635 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini @@ -0,0 +1,4 @@ +[audionode-connect-return-value.html] + [connect should return the node connected to.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect-audioparam.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect-audioparam.html.ini new file mode 100644 index 00000000000..cad8cb42b1d --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect-audioparam.html.ini @@ -0,0 +1,2 @@ +[audionode-disconnect-audioparam.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini new file mode 100644 index 00000000000..45d61e35bb6 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini @@ -0,0 +1,2 @@ +[audionode-disconnect.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini new file mode 100644 index 00000000000..4e50308c069 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini @@ -0,0 +1,13 @@ +[audionode.html] + [X AudioContext.destination.numberOfOutputs is not equal to 0. Got 1.] + expected: FAIL + + [X Connecting a node to a different context did not throw an exception.] + expected: FAIL + + [< [test\] 2 out of 12 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini new file mode 100644 index 00000000000..783f3ff032d --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini @@ -0,0 +1,2 @@ +[channel-mode-interp-basic.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini new file mode 100644 index 00000000000..a095f42f1d4 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini @@ -0,0 +1,2 @@ +[audioparam-connect-audioratesignal.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini new file mode 100644 index 00000000000..248fea6a1ac --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini @@ -0,0 +1,8 @@ +[audioparam-exceptional-values.html] + expected: ERROR + [X Creating context for testing incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini new file mode 100644 index 00000000000..96150248f5b --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini @@ -0,0 +1,2 @@ +[audioparam-exponentialRampToValueAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini new file mode 100644 index 00000000000..eacbf1d55b1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini @@ -0,0 +1,2 @@ +[audioparam-large-endtime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini new file mode 100644 index 00000000000..26787ed164e --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini @@ -0,0 +1,2 @@ +[audioparam-linearRampToValueAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-method-chaining.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-method-chaining.html.ini new file mode 100644 index 00000000000..abe7e19de11 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-method-chaining.html.ini @@ -0,0 +1,2 @@ +[audioparam-method-chaining.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini new file mode 100644 index 00000000000..5e01f268dac --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini @@ -0,0 +1,2 @@ +[audioparam-setTargetAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini new file mode 100644 index 00000000000..d2f0b5c9e18 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini @@ -0,0 +1,2 @@ +[audioparam-setValueAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini new file mode 100644 index 00000000000..56df600f048 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini @@ -0,0 +1,2 @@ +[audioparam-setValueCurve-exceptions.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurveAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurveAtTime.html.ini new file mode 100644 index 00000000000..c6ff6a46614 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurveAtTime.html.ini @@ -0,0 +1,2 @@ +[audioparam-setValueCurveAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini new file mode 100644 index 00000000000..4969e59bbd1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini @@ -0,0 +1,2 @@ +[audioparam-summingjunction.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini new file mode 100644 index 00000000000..7394d9167aa --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini @@ -0,0 +1,2 @@ +[automation-rate.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/event-insertion.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/event-insertion.html.ini new file mode 100644 index 00000000000..acbb68b01a0 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/event-insertion.html.ini @@ -0,0 +1,2 @@ +[event-insertion.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-audioworklet.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-audioworklet.https.html.ini new file mode 100644 index 00000000000..ddf48045720 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-audioworklet.https.html.ini @@ -0,0 +1,2 @@ +[k-rate-audioworklet.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad.html.ini new file mode 100644 index 00000000000..3d6983a5926 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad.html.ini @@ -0,0 +1,2 @@ +[k-rate-biquad.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source.html.ini new file mode 100644 index 00000000000..dd19c6b7655 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source.html.ini @@ -0,0 +1,2 @@ +[k-rate-constant-source.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay.html.ini new file mode 100644 index 00000000000..ee7a689ec43 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay.html.ini @@ -0,0 +1,2 @@ +[k-rate-delay.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain.html.ini new file mode 100644 index 00000000000..e479a35ccdc --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain.html.ini @@ -0,0 +1,2 @@ +[k-rate-gain.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator.html.ini new file mode 100644 index 00000000000..2810e1b0234 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator.html.ini @@ -0,0 +1,2 @@ +[k-rate-oscillator.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner.html.ini new file mode 100644 index 00000000000..3ca0eaddfd4 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner.html.ini @@ -0,0 +1,2 @@ +[k-rate-panner.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner.html.ini new file mode 100644 index 00000000000..c54ad68ca58 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner.html.ini @@ -0,0 +1,2 @@ +[k-rate-stereo-panner.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime.html.ini new file mode 100644 index 00000000000..40b86091760 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime.html.ini @@ -0,0 +1,2 @@ +[retrospective-exponentialRampToValueAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime.html.ini new file mode 100644 index 00000000000..b1b685eaef1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime.html.ini @@ -0,0 +1,2 @@ +[retrospective-linearRampToValueAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime.html.ini new file mode 100644 index 00000000000..b100363750f --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime.html.ini @@ -0,0 +1,2 @@ +[retrospective-setTargetAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini new file mode 100644 index 00000000000..c9647f410fd --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini @@ -0,0 +1,2 @@ +[retrospective-setValueAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime.html.ini new file mode 100644 index 00000000000..28e1d12c231 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime.html.ini @@ -0,0 +1,2 @@ +[retrospective-setValueCurveAtTime.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini new file mode 100644 index 00000000000..b85f8845f18 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini @@ -0,0 +1,4 @@ +[setTargetAtTime-after-event-within-block.html] + [Test setTargetAtTime after an event in the same processing block] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini new file mode 100644 index 00000000000..03c2e023d4d --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini @@ -0,0 +1,4 @@ +[setValueAtTime-within-block.html] + [Test setValueAtTime with start time not on a block boundary] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html.ini new file mode 100644 index 00000000000..2fa755c898b --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html.ini @@ -0,0 +1,4 @@ +[audioworklet-addmodule-resolution.https.html] + [\n Test the invocation order of AudioWorklet.addModule() and BaseAudioContext\n ] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html.ini new file mode 100644 index 00000000000..5ae63f521cc --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html.ini @@ -0,0 +1,2 @@ +[audioworklet-audioparam.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html.ini new file mode 100644 index 00000000000..b43548d64fe --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html.ini @@ -0,0 +1,4 @@ +[audioworklet-messageport.https.html] + [\n Test MessagePort in AudioWorkletNode and AudioWorkletProcessor\n ] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html.ini new file mode 100644 index 00000000000..303611ce2b7 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html.ini @@ -0,0 +1,4 @@ +[audioworkletglobalscope-sample-rate.https.html] + [\n Test sampleRate in AudioWorkletGlobalScope\n ] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html.ini new file mode 100644 index 00000000000..f11ad0f4626 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html.ini @@ -0,0 +1,4 @@ +[audioworkletglobalscope-timing-info.https.html] + [\n Test currentTime and currentFrame in AudioWorkletGlobalScope\n ] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-automatic-pull.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-automatic-pull.https.html.ini new file mode 100644 index 00000000000..a9dede82004 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-automatic-pull.https.html.ini @@ -0,0 +1,2 @@ +[audioworkletnode-automatic-pull.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html.ini new file mode 100644 index 00000000000..96ee5123835 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html.ini @@ -0,0 +1,2 @@ +[audioworkletnode-channel-count.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html.ini new file mode 100644 index 00000000000..af49d11d616 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html.ini @@ -0,0 +1,8 @@ +[audioworkletnode-construction.https.html] + expected: ERROR + [X Creating a node before loading a module should throw. threw "ReferenceError" instead of InvalidStateError.] + expected: FAIL + + [< [construction-before-module-loading\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html.ini new file mode 100644 index 00000000000..4a7d9fded52 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html.ini @@ -0,0 +1,2 @@ +[audioworkletnode-constructor-options.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-disconnected-input.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-disconnected-input.https.html.ini new file mode 100644 index 00000000000..2949be5b509 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-disconnected-input.https.html.ini @@ -0,0 +1,2 @@ +[audioworkletnode-disconnected-input.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html.ini new file mode 100644 index 00000000000..f3faec26c7d --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html.ini @@ -0,0 +1,4 @@ +[audioworkletnode-onerror.https.html] + [\n Test onprocessorerror handler in AudioWorkletNode\n ] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html.ini new file mode 100644 index 00000000000..a07e70774d5 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html.ini @@ -0,0 +1,2 @@ +[audioworkletprocessor-options.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini new file mode 100644 index 00000000000..3e3b5437281 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini @@ -0,0 +1,4 @@ +[baseaudiocontext-audioworklet.https.html] + [\n Checking BaseAudioContext.audioWorklet\n ] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-allpass.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-allpass.html.ini new file mode 100644 index 00000000000..e5aa83654f5 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-allpass.html.ini @@ -0,0 +1,2 @@ +[biquad-allpass.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation.html.ini new file mode 100644 index 00000000000..ac3dec84f13 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation.html.ini @@ -0,0 +1,2 @@ +[biquad-automation.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-bandpass.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-bandpass.html.ini new file mode 100644 index 00000000000..fcc3d0f21a5 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-bandpass.html.ini @@ -0,0 +1,2 @@ +[biquad-bandpass.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini new file mode 100644 index 00000000000..5db6179d6b6 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini @@ -0,0 +1,8 @@ +[biquad-basic.html] + expected: ERROR + [X Initialize context for testing incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse.html.ini new file mode 100644 index 00000000000..bda92b1d005 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse.html.ini @@ -0,0 +1,2 @@ +[biquad-getFrequencyResponse.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highpass.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highpass.html.ini new file mode 100644 index 00000000000..3e4776a430c --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highpass.html.ini @@ -0,0 +1,2 @@ +[biquad-highpass.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highshelf.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highshelf.html.ini new file mode 100644 index 00000000000..041e10d010e --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-highshelf.html.ini @@ -0,0 +1,2 @@ +[biquad-highshelf.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowpass.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowpass.html.ini new file mode 100644 index 00000000000..a61dc595e90 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowpass.html.ini @@ -0,0 +1,2 @@ +[biquad-lowpass.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowshelf.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowshelf.html.ini new file mode 100644 index 00000000000..eb11b1317ec --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-lowshelf.html.ini @@ -0,0 +1,2 @@ +[biquad-lowshelf.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-notch.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-notch.html.ini new file mode 100644 index 00000000000..29576262c6e --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-notch.html.ini @@ -0,0 +1,2 @@ +[biquad-notch.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-peaking.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-peaking.html.ini new file mode 100644 index 00000000000..13f1c9c4824 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-peaking.html.ini @@ -0,0 +1,2 @@ +[biquad-peaking.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-tail.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-tail.html.ini new file mode 100644 index 00000000000..98840c3cb20 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-tail.html.ini @@ -0,0 +1,2 @@ +[biquad-tail.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html.ini new file mode 100644 index 00000000000..68f54dbc496 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html.ini @@ -0,0 +1,2 @@ +[biquadfilternode-basic.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html.ini new file mode 100644 index 00000000000..6651b6044af --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html.ini @@ -0,0 +1,11 @@ +[ctor-biquadfilter.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new BiquadFilterNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering.html.ini new file mode 100644 index 00000000000..a09d9921c49 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering.html.ini @@ -0,0 +1,2 @@ +[no-dezippering.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini new file mode 100644 index 00000000000..4d75c400e84 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini @@ -0,0 +1,2 @@ +[audiochannelmerger-basic.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-disconnect.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-disconnect.html.ini new file mode 100644 index 00000000000..c85f6c075d8 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-disconnect.html.ini @@ -0,0 +1,2 @@ +[audiochannelmerger-disconnect.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input-non-default.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input-non-default.html.ini new file mode 100644 index 00000000000..307a5731949 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input-non-default.html.ini @@ -0,0 +1,2 @@ +[audiochannelmerger-input-non-default.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input.html.ini new file mode 100644 index 00000000000..4c0f0dd12a1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-input.html.ini @@ -0,0 +1,2 @@ +[audiochannelmerger-input.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/ctor-channelmerger.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/ctor-channelmerger.html.ini new file mode 100644 index 00000000000..4625d399cf7 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/ctor-channelmerger.html.ini @@ -0,0 +1,11 @@ +[ctor-channelmerger.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new ChannelMergerNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini new file mode 100644 index 00000000000..4e6601565ed --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini @@ -0,0 +1,2 @@ +[audiochannelsplitter.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/ctor-channelsplitter.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/ctor-channelsplitter.html.ini new file mode 100644 index 00000000000..92e7446b7ac --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/ctor-channelsplitter.html.ini @@ -0,0 +1,11 @@ +[ctor-channelsplitter.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new ChannelSplitterNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic.html.ini new file mode 100644 index 00000000000..0af07ce7439 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic.html.ini @@ -0,0 +1,5 @@ +[constant-source-basic.html] + expected: ERROR + [X Factory method: node = context.createConstantSource() incorrectly threw TypeError: "context.createConstantSource is not a function".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-onended.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-onended.html.ini new file mode 100644 index 00000000000..192a173a935 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-onended.html.ini @@ -0,0 +1,4 @@ +[constant-source-onended.html] + [\n Test ConstantSourceNode onended\n ] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output.html.ini new file mode 100644 index 00000000000..36ddcdb8688 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output.html.ini @@ -0,0 +1,2 @@ +[constant-source-output.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/ctor-constantsource.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/ctor-constantsource.html.ini new file mode 100644 index 00000000000..6f8ec2d5edf --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/ctor-constantsource.html.ini @@ -0,0 +1,11 @@ +[ctor-constantsource.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new ConstantSourceNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html.ini new file mode 100644 index 00000000000..0705478a45f --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html.ini @@ -0,0 +1,19 @@ +[test-constantsourcenode.html] + [ConstantSourceNode can be constructed] + expected: FAIL + + [ConstantSourceNode stop and start] + expected: FAIL + + [ConstantSourceNode onended event] + expected: FAIL + + [ConstantSourceNode start and stop when work] + expected: FAIL + + [ConstantSourceNode with no automation] + expected: FAIL + + [ConstantSourceNode with automation] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolution-mono-mono.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolution-mono-mono.html.ini new file mode 100644 index 00000000000..ad0581a239e --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolution-mono-mono.html.ini @@ -0,0 +1,2 @@ +[convolution-mono-mono.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-cascade.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-cascade.html.ini new file mode 100644 index 00000000000..4cbf9a25487 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-cascade.html.ini @@ -0,0 +1,2 @@ +[convolver-cascade.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-channels.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-channels.html.ini new file mode 100644 index 00000000000..df70e50599b --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-channels.html.ini @@ -0,0 +1,2 @@ +[convolver-channels.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan.html.ini new file mode 100644 index 00000000000..b16c9494baf --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan.html.ini @@ -0,0 +1,2 @@ +[convolver-response-1-chan.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan.html.ini new file mode 100644 index 00000000000..9f76052af48 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan.html.ini @@ -0,0 +1,2 @@ +[convolver-response-2-chan.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan.html.ini new file mode 100644 index 00000000000..591a89c6ebe --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan.html.ini @@ -0,0 +1,2 @@ +[convolver-response-4-chan.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-null.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-null.html.ini new file mode 100644 index 00000000000..9fea5ff2474 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-null.html.ini @@ -0,0 +1,2 @@ +[convolver-setBuffer-null.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver.html.ini new file mode 100644 index 00000000000..e696df1a9f7 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver.html.ini @@ -0,0 +1,11 @@ +[ctor-convolver.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new ConvolverNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/ctor-delay.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/ctor-delay.html.ini new file mode 100644 index 00000000000..d69bdd755c1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/ctor-delay.html.ini @@ -0,0 +1,11 @@ +[ctor-delay.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new DelayNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-default-delay.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-default-delay.html.ini new file mode 100644 index 00000000000..1f2ee4b07e1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-default-delay.html.ini @@ -0,0 +1,2 @@ +[delaynode-max-default-delay.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-nondefault-delay.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-nondefault-delay.html.ini new file mode 100644 index 00000000000..b5029de5f80 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-max-nondefault-delay.html.ini @@ -0,0 +1,2 @@ +[delaynode-max-nondefault-delay.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelay.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelay.html.ini new file mode 100644 index 00000000000..b6b9a1d2ead --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelay.html.ini @@ -0,0 +1,2 @@ +[delaynode-maxdelay.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini new file mode 100644 index 00000000000..b67478861c9 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini @@ -0,0 +1,2 @@ +[delaynode-maxdelaylimit.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-scheduling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-scheduling.html.ini new file mode 100644 index 00000000000..73b40d82b00 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-scheduling.html.ini @@ -0,0 +1,2 @@ +[delaynode-scheduling.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode.html.ini new file mode 100644 index 00000000000..8943424a61b --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode.html.ini @@ -0,0 +1,2 @@ +[delaynode.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/no-dezippering.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/no-dezippering.html.ini new file mode 100644 index 00000000000..a09d9921c49 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/no-dezippering.html.ini @@ -0,0 +1,2 @@ +[no-dezippering.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html.ini new file mode 100644 index 00000000000..7b109536ba3 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html.ini @@ -0,0 +1,11 @@ +[ctor-dynamicscompressor.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new DynamicsCompressorNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic.html.ini new file mode 100644 index 00000000000..479a20cea02 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic.html.ini @@ -0,0 +1,2 @@ +[dynamicscompressor-basic.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini new file mode 100644 index 00000000000..f3299d77c26 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini @@ -0,0 +1,14 @@ +[ctor-gain.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new GainNode(context) incorrectly threw TypeError: "Value is not an object.".] + expected: FAIL + + [X node0 instanceof GainNode is not equal to true. Got false.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/gain.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/gain.html.ini new file mode 100644 index 00000000000..4c84e0baf87 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/gain.html.ini @@ -0,0 +1,2 @@ +[gain.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/no-dezippering.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/no-dezippering.html.ini new file mode 100644 index 00000000000..a09d9921c49 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/no-dezippering.html.ini @@ -0,0 +1,2 @@ +[no-dezippering.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini new file mode 100644 index 00000000000..0d2ee9a750f --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini @@ -0,0 +1,5 @@ +[test-gainnode.html] + expected: ERROR + [GainNode] + expected: NOTRUN + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter.html.ini new file mode 100644 index 00000000000..04f71c65f49 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter.html.ini @@ -0,0 +1,11 @@ +[ctor-iirfilter.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new IIRFilterNode(context, {"feedforward":[1\],"feedback":[1,-0.9\]}) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini new file mode 100644 index 00000000000..155aaf9a9ef --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini @@ -0,0 +1,8 @@ +[iirfilter-basic.html] + expected: ERROR + [X Initialize context for testing incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse.html.ini new file mode 100644 index 00000000000..5c657325deb --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse.html.ini @@ -0,0 +1,2 @@ +[iirfilter-getFrequencyResponse.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini new file mode 100644 index 00000000000..f98237d5ae5 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini @@ -0,0 +1,2 @@ +[iirfilter.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/test-iirfilternode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/test-iirfilternode.html.ini new file mode 100644 index 00000000000..c91d5ebdad7 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/test-iirfilternode.html.ini @@ -0,0 +1,22 @@ +[test-iirfilternode.html] + [feedforward coefficients can not be empty] + expected: FAIL + + [feedback coefficients can not be empty] + expected: FAIL + + [more than 20 feedforward coefficients can not be used] + expected: FAIL + + [more than 20 feedback coefficients can not be used] + expected: FAIL + + [at least one feedforward coefficient must be non-zero] + expected: FAIL + + [the first feedback coefficient must be non-zero] + expected: FAIL + + [IIRFilterNode getFrequencyResponse handles invalid frequencies properly] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html.ini new file mode 100644 index 00000000000..86cf943f0b2 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html.ini @@ -0,0 +1,5 @@ +[mediaElementAudioSourceToScriptProcessorTest.html] + expected: ERROR + [Element Source tests completed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini new file mode 100644 index 00000000000..71a9223566f --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini @@ -0,0 +1,11 @@ +[ctor-offlineaudiocontext.html] + expected: ERROR + [X new OfflineAudioContext(3) threw "ReferenceError" instead of TypeError.] + expected: FAIL + + [X new OfflineAudioContext(3, 42) threw "ReferenceError" instead of TypeError.] + expected: FAIL + + [X context = new OfflineAudioContext(3, 42, 12345) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini new file mode 100644 index 00000000000..9112d9bdd39 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini @@ -0,0 +1,4 @@ +[current-time-block-size.html] + [Test currentTime at completion of OfflineAudioContext rendering] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini new file mode 100644 index 00000000000..d9b88d010ea --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini @@ -0,0 +1,14 @@ +[ctor-oscillator.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new OscillatorNode(context) incorrectly threw TypeError: "Value is not an object.".] + expected: FAIL + + [X node0 instanceof OscillatorNode is not equal to true. Got false.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html.ini new file mode 100644 index 00000000000..669207991d1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html.ini @@ -0,0 +1,11 @@ +[ctor-panner.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new PannerNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-exponential.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-exponential.html.ini new file mode 100644 index 00000000000..7efbcf583f3 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-exponential.html.ini @@ -0,0 +1,2 @@ +[distance-exponential.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-inverse.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-inverse.html.ini new file mode 100644 index 00000000000..b516b89d7eb --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-inverse.html.ini @@ -0,0 +1,2 @@ +[distance-inverse.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-linear.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-linear.html.ini new file mode 100644 index 00000000000..a83cbe3becb --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/distance-linear.html.ini @@ -0,0 +1,2 @@ +[distance-linear.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic.html.ini new file mode 100644 index 00000000000..a1c827555e2 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic.html.ini @@ -0,0 +1,2 @@ +[panner-automation-basic.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-equalpower-stereo.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-equalpower-stereo.html.ini new file mode 100644 index 00000000000..23daa531853 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-equalpower-stereo.html.ini @@ -0,0 +1,2 @@ +[panner-automation-equalpower-stereo.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position.html.ini new file mode 100644 index 00000000000..2c76c302d1b --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position.html.ini @@ -0,0 +1,2 @@ +[panner-automation-position.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini new file mode 100644 index 00000000000..590a0e116bd --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini @@ -0,0 +1,2 @@ +[panner-distance-clamping.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-stereo.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-stereo.html.ini new file mode 100644 index 00000000000..af6521690b1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-stereo.html.ini @@ -0,0 +1,2 @@ +[panner-equalpower-stereo.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower.html.ini new file mode 100644 index 00000000000..2c9651d704f --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower.html.ini @@ -0,0 +1,2 @@ +[panner-equalpower.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping.html.ini new file mode 100644 index 00000000000..10dcd6b0c87 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping.html.ini @@ -0,0 +1,2 @@ +[panner-rolloff-clamping.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic.html.ini new file mode 100644 index 00000000000..9553796f474 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic.html.ini @@ -0,0 +1,8 @@ +[pannernode-basic.html] + expected: ERROR + [X Initialize context and panner incorrectly threw TypeError: "context.createPanner is not a function".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html.ini new file mode 100644 index 00000000000..1fe66f4c246 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html.ini @@ -0,0 +1,4 @@ +[test-pannernode-automation.html] + [PannerNode AudioParam automation works properly] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/ctor-stereopanner.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/ctor-stereopanner.html.ini new file mode 100644 index 00000000000..60b5da616c4 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/ctor-stereopanner.html.ini @@ -0,0 +1,11 @@ +[ctor-stereopanner.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new StereoPannerNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering.html.ini new file mode 100644 index 00000000000..a09d9921c49 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering.html.ini @@ -0,0 +1,2 @@ +[no-dezippering.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-basic.html.ini new file mode 100644 index 00000000000..5c2eca1884f --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-basic.html.ini @@ -0,0 +1,2 @@ +[stereopannernode-basic.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-panning.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-panning.html.ini new file mode 100644 index 00000000000..318073e0211 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-panning.html.ini @@ -0,0 +1,2 @@ +[stereopannernode-panning.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/ctor-waveshaper.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/ctor-waveshaper.html.ini new file mode 100644 index 00000000000..64059b2a021 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/ctor-waveshaper.html.ini @@ -0,0 +1,11 @@ +[ctor-waveshaper.html] + expected: ERROR + [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] + expected: FAIL + + [< [initialize\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X node0 = new WaveShaperNode(context) incorrectly threw TypeError: "window[name\] is not a constructor".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/curve-tests.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/curve-tests.html.ini new file mode 100644 index 00000000000..a03586bfd27 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/curve-tests.html.ini @@ -0,0 +1,5 @@ +[curve-tests.html] + expected: ERROR + [WaveShaperNode - Testing that -1, 0 and +1 map correctly to curve (with 1:1 correlation)] + expected: NOTRUN + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/silent-inputs.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/silent-inputs.html.ini new file mode 100644 index 00000000000..f7af301e826 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/silent-inputs.html.ini @@ -0,0 +1,2 @@ +[silent-inputs.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve.html.ini new file mode 100644 index 00000000000..e89b8bae3de --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve.html.ini @@ -0,0 +1,2 @@ +[waveshaper-copy-curve.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits.html.ini new file mode 100644 index 00000000000..5928332c45c --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits.html.ini @@ -0,0 +1,2 @@ +[waveshaper-limits.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-simple.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-simple.html.ini new file mode 100644 index 00000000000..8cacd43311b --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-simple.html.ini @@ -0,0 +1,2 @@ +[waveshaper-simple.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper.html.ini new file mode 100644 index 00000000000..5e5b20fe070 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper.html.ini @@ -0,0 +1,2 @@ +[waveshaper.html] + expected: ERROR From d4fcd8fb0c25c4678e88a1b56cf7676e2a5e240c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 10 Jul 2018 14:43:11 -0700 Subject: [PATCH 44/87] Remove recursion limit --- components/script/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/script/lib.rs b/components/script/lib.rs index 3275f10a65f..5125607219b 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -13,8 +13,6 @@ #![deny(unsafe_code)] #![allow(non_snake_case)] -#![recursion_limit = "128"] - #![doc = "The script crate contains all matters DOM."] #![plugin(script_plugins)] From 02aaf55cd3c14577b0ce650e59d7b0fbc151473d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 10 Jul 2018 14:44:30 -0700 Subject: [PATCH 45/87] Pass global to AudioBuffer::new_inherited --- components/script/dom/audiobuffer.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 569de5baec3..1ed2811d88f 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -35,7 +35,7 @@ pub struct AudioBuffer { impl AudioBuffer { #[allow(unrooted_must_root)] #[allow(unsafe_code)] - pub fn new_inherited(cx: *mut JSContext, + pub fn new_inherited(global: &Window, number_of_channels: u32, length: u32, sample_rate: f32, @@ -48,6 +48,7 @@ impl AudioBuffer { }, None => vec![0.; (length * number_of_channels) as usize] }; + let cx = global.get_cx(); let mut js_channels: Vec = Vec::with_capacity(number_of_channels as usize); for channel in 0..number_of_channels { rooted!(in (cx) let mut array = ptr::null_mut::()); @@ -79,7 +80,7 @@ impl AudioBuffer { length: u32, sample_rate: f32, initial_data: Option<&[f32]>) -> DomRoot { - let buffer = AudioBuffer::new_inherited(global.get_cx(), number_of_channels, length, sample_rate, initial_data); + let buffer = AudioBuffer::new_inherited(global, number_of_channels, length, sample_rate, initial_data); reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) } From b7730da37dfb42d4dc901fa8b0d15caa73a048bb Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 10 Jul 2018 14:45:28 -0700 Subject: [PATCH 46/87] Add spec link to AudioBuffer::Constructor --- components/script/dom/audiobuffer.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 1ed2811d88f..a092d177775 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -84,6 +84,7 @@ impl AudioBuffer { reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) } + /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer pub fn Constructor(window: &Window, options: &AudioBufferOptions) -> Fallible> { if options.numberOfChannels > MAX_CHANNEL_COUNT { From 8172b4f9609b79ffaf18c904c97a2b2250938dd6 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 10 Jul 2018 14:46:12 -0700 Subject: [PATCH 47/87] Remove unnecessary comment This check is implicitly handled by the graph impl --- components/script/dom/audionode.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 10758ebd3c5..400e975bac4 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -79,8 +79,6 @@ impl AudioNodeMethods for AudioNode { return Err(Error::IndexSize); } - // XXX Check previous connections. - self.context.audio_context_impl().connect_ports( self.node_id().output(output), destination.node_id().input(input) ); From c5abc3eb8b72148ff14619857e1bf1362145fe7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 10:44:52 +0200 Subject: [PATCH 48/87] Use git url for servo-media dependency --- components/script/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 71d0456d679..6aa60335808 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -87,7 +87,7 @@ servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} servo_config = {path = "../config"} servo_geometry = {path = "../geometry" } -servo_media = {path = "../../../media/servo-media"} +servo_media = {git = "https://github.com/servo/media"} servo_rand = {path = "../rand"} servo_url = {path = "../url"} smallvec = "0.6" From 3fc9ecace07d41ab2baa6c865983c82cd13e529b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 10:55:08 +0200 Subject: [PATCH 49/87] Make restore_js_channel_data unsafe --- components/script/dom/audiobuffer.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index a092d177775..c624d0c6d36 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -84,7 +84,7 @@ impl AudioBuffer { reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) } - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer + // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer pub fn Constructor(window: &Window, options: &AudioBufferOptions) -> Fallible> { if options.numberOfChannels > MAX_CHANNEL_COUNT { @@ -94,7 +94,7 @@ impl AudioBuffer { } #[allow(unsafe_code)] - fn restore_js_channel_data(&self, cx: *mut JSContext) -> bool { + unsafe fn restore_js_channel_data(&self, cx: *mut JSContext) -> bool { for (i, channel) in self.js_channels.borrow_mut().iter().enumerate() { if !channel.get().is_null() { // Already have data in JS array. @@ -104,9 +104,7 @@ impl AudioBuffer { // Move the channel data from shared_channels to js_channels. rooted!(in (cx) let mut array = ptr::null_mut::()); let shared_channel = (*self.shared_channels.borrow_mut()).buffers.remove(i); - if unsafe { - Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) - }.is_err() { + if Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()).is_err() { return false; } channel.set(array.get()); @@ -238,7 +236,7 @@ impl AudioBufferMethods for AudioBuffer { } let cx = self.global().get_cx(); - if !self.restore_js_channel_data(cx) { + if unsafe { !self.restore_js_channel_data(cx) } { return Err(Error::JSFailed); } From b26a3bd31bafc3960af64d2e838d80c1700b5003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 10:59:18 +0200 Subject: [PATCH 50/87] rustfmt --- components/script/dom/audiobuffer.rs | 98 ++++++--- .../script/dom/audiobuffersourcenode.rs | 78 ++++--- components/script/dom/audiocontext.rs | 45 ++-- components/script/dom/audiodestinationnode.rs | 25 ++- components/script/dom/audionode.rs | 67 +++--- components/script/dom/audioparam.rs | 176 ++++++++------- .../script/dom/audioscheduledsourcenode.rs | 40 ++-- components/script/dom/baseaudiocontext.rs | 207 +++++++++++------- components/script/dom/gainnode.rs | 34 +-- components/script/dom/oscillatornode.rs | 40 ++-- 10 files changed, 478 insertions(+), 332 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index c624d0c6d36..7475bccb8a6 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -35,18 +35,20 @@ pub struct AudioBuffer { impl AudioBuffer { #[allow(unrooted_must_root)] #[allow(unsafe_code)] - pub fn new_inherited(global: &Window, - number_of_channels: u32, - length: u32, - sample_rate: f32, - initial_data: Option<&[f32]>) -> AudioBuffer { + pub fn new_inherited( + global: &Window, + number_of_channels: u32, + length: u32, + sample_rate: f32, + initial_data: Option<&[f32]>, + ) -> AudioBuffer { let initial_data = match initial_data { Some(initial_data) => { let mut data = vec![]; data.extend_from_slice(initial_data); data }, - None => vec![0.; (length * number_of_channels) as usize] + None => vec![0.; (length * number_of_channels) as usize], }; let cx = global.get_cx(); let mut js_channels: Vec = Vec::with_capacity(number_of_channels as usize); @@ -57,7 +59,8 @@ impl AudioBuffer { Float32Array::create( cx, CreateWith::Slice(&initial_data.as_slice()[offset..offset + (length as usize)]), - array.handle_mut()) + array.handle_mut(), + ) }; let js_channel = Heap::default(); js_channel.set(array.get()); @@ -66,7 +69,10 @@ impl AudioBuffer { AudioBuffer { reflector_: Reflector::new(), js_channels: DomRefCell::new(js_channels), - shared_channels: DomRefCell::new(ServoMediaAudioBuffer::new(number_of_channels as u8, length as usize)), + shared_channels: DomRefCell::new(ServoMediaAudioBuffer::new( + number_of_channels as u8, + length as usize, + )), sample_rate, length, duration: length as f64 / sample_rate as f64, @@ -75,22 +81,38 @@ impl AudioBuffer { } #[allow(unrooted_must_root)] - pub fn new(global: &Window, - number_of_channels: u32, - length: u32, - sample_rate: f32, - initial_data: Option<&[f32]>) -> DomRoot { - let buffer = AudioBuffer::new_inherited(global, number_of_channels, length, sample_rate, initial_data); + pub fn new( + global: &Window, + number_of_channels: u32, + length: u32, + sample_rate: f32, + initial_data: Option<&[f32]>, + ) -> DomRoot { + let buffer = AudioBuffer::new_inherited( + global, + number_of_channels, + length, + sample_rate, + initial_data, + ); reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) } // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer - pub fn Constructor(window: &Window, - options: &AudioBufferOptions) -> Fallible> { + pub fn Constructor( + window: &Window, + options: &AudioBufferOptions, + ) -> Fallible> { if options.numberOfChannels > MAX_CHANNEL_COUNT { return Err(Error::NotSupported); } - Ok(AudioBuffer::new(window, options.numberOfChannels, options.length, *options.sampleRate, None)) + Ok(AudioBuffer::new( + window, + options.numberOfChannels, + options.length, + *options.sampleRate, + None, + )) } #[allow(unsafe_code)] @@ -104,7 +126,9 @@ impl AudioBuffer { // Move the channel data from shared_channels to js_channels. rooted!(in (cx) let mut array = ptr::null_mut::()); let shared_channel = (*self.shared_channels.borrow_mut()).buffers.remove(i); - if Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()).is_err() { + if Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) + .is_err() + { return false; } channel.set(array.get()); @@ -175,7 +199,11 @@ impl AudioBufferMethods for AudioBuffer { // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-getchanneldata #[allow(unsafe_code)] - unsafe fn GetChannelData(&self, cx: *mut JSContext, channel: u32) -> Fallible> { + unsafe fn GetChannelData( + &self, + cx: *mut JSContext, + channel: u32, + ) -> Fallible> { if channel >= self.number_of_channels { return Err(Error::IndexSize); } @@ -184,15 +212,19 @@ impl AudioBufferMethods for AudioBuffer { return Err(Error::JSFailed); } - Ok(NonNull::new_unchecked(self.js_channels.borrow()[channel as usize].get())) + Ok(NonNull::new_unchecked( + self.js_channels.borrow()[channel as usize].get(), + )) } // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-copyfromchannel #[allow(unsafe_code)] - fn CopyFromChannel(&self, - mut destination: CustomAutoRooterGuard, - channel_number: u32, - start_in_channel: u32) -> Fallible<()> { + fn CopyFromChannel( + &self, + mut destination: CustomAutoRooterGuard, + channel_number: u32, + start_in_channel: u32, + ) -> Fallible<()> { if channel_number >= self.number_of_channels || start_in_channel > self.length { return Err(Error::IndexSize); } @@ -220,17 +252,21 @@ impl AudioBufferMethods for AudioBuffer { dest.extend_from_slice(&shared_channel.as_slice()[offset..offset + bytes_to_copy]); } - unsafe { destination.update(&dest); } + unsafe { + destination.update(&dest); + } Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-copytochannel #[allow(unsafe_code)] - fn CopyToChannel(&self, - source: CustomAutoRooterGuard, - channel_number: u32, - start_in_channel: u32) -> Fallible<()> { + fn CopyToChannel( + &self, + source: CustomAutoRooterGuard, + channel_number: u32, + start_in_channel: u32, + ) -> Fallible<()> { if channel_number >= self.number_of_channels || start_in_channel > (source.len() as u32) { return Err(Error::IndexSize); } @@ -250,7 +286,9 @@ impl AudioBufferMethods for AudioBuffer { if let Ok(mut array) = array { let bytes_to_copy = min(self.length - start_in_channel, source.len() as u32) as usize; let offset = start_in_channel as usize; - unsafe { array.update(&source.as_slice()[offset..offset + bytes_to_copy]); } + unsafe { + array.update(&source.as_slice()[offset..offset + bytes_to_copy]); + } } else { return Err(Error::IndexSize); } diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 6c709c17d9a..15d23ab6988 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding:: - AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; +AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; @@ -45,7 +45,7 @@ impl AudioBufferSourceNode { window: &Window, context: &BaseAudioContext, options: &AudioBufferSourceOptions, - ) -> AudioBufferSourceNode { + ) -> AudioBufferSourceNode { let mut node_options = AudioNodeOptions::empty(); node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); @@ -54,24 +54,30 @@ impl AudioBufferSourceNode { AudioNodeInit::AudioBufferSourceNode(options.into()), context, &node_options, - 0 /* inputs */, - 1 /* outputs */, - ); + 0, /* inputs */ + 1, /* outputs */ + ); let node_id = source_node.node().node_id(); - let playback_rate = AudioParam::new(&window, - context, - node_id, - ParamType::PlaybackRate, - AutomationRate::K_rate, - *options.playbackRate, - f32::MIN, f32::MAX); - let detune = AudioParam::new(&window, - context, - node_id, - ParamType::Detune, - AutomationRate::K_rate, - *options.detune, - f32::MIN, f32::MAX); + let playback_rate = AudioParam::new( + &window, + context, + node_id, + ParamType::PlaybackRate, + AutomationRate::K_rate, + *options.playbackRate, + f32::MIN, + f32::MAX, + ); + let detune = AudioParam::new( + &window, + context, + node_id, + ParamType::Detune, + AutomationRate::K_rate, + *options.detune, + f32::MIN, + f32::MAX, + ); AudioBufferSourceNode { source_node, buffer: Default::default(), @@ -88,7 +94,7 @@ impl AudioBufferSourceNode { window: &Window, context: &BaseAudioContext, options: &AudioBufferSourceOptions, - ) -> DomRoot { + ) -> DomRoot { let node = AudioBufferSourceNode::new_inherited(window, context, options); reflect_dom_object(Box::new(node), window, AudioBufferSourceNodeBinding::Wrap) } @@ -97,7 +103,7 @@ impl AudioBufferSourceNode { window: &Window, context: &BaseAudioContext, options: &AudioBufferSourceOptions, - ) -> Fallible> { + ) -> Fallible> { Ok(AudioBufferSourceNode::new(window, context, options)) } } @@ -119,9 +125,11 @@ impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { if self.source_node.started() { if let Some(buffer) = self.buffer.get() { let buffer = buffer.acquire_contents(); - self.source_node.node().message( - AudioNodeMessage::AudioBufferSourceNode( - AudioBufferSourceNodeMessage::SetBuffer(buffer))); + self.source_node + .node() + .message(AudioNodeMessage::AudioBufferSourceNode( + AudioBufferSourceNodeMessage::SetBuffer(buffer), + )); } } @@ -160,17 +168,23 @@ impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { self.loop_end.set(*loop_end) } - fn Start(&self, - when: Finite, - _offset: Option>, - _duration: Option>) -> Fallible<()> { + fn Start( + &self, + when: Finite, + _offset: Option>, + _duration: Option>, + ) -> Fallible<()> { if let Some(buffer) = self.buffer.get() { let buffer = buffer.acquire_contents(); - self.source_node.node().message( - AudioNodeMessage::AudioBufferSourceNode( - AudioBufferSourceNodeMessage::SetBuffer(buffer))); + self.source_node + .node() + .message(AudioNodeMessage::AudioBufferSourceNode( + AudioBufferSourceNodeMessage::SetBuffer(buffer), + )); } - self.source_node.upcast::().Start(when) + self.source_node + .upcast::() + .Start(when) } } diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 6eb9cc781a9..275208b9821 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -37,7 +37,10 @@ impl AudioContext { // https://webaudio.github.io/web-audio-api/#AudioContext-constructors fn new_inherited(global: &GlobalScope, options: &AudioContextOptions) -> AudioContext { // Steps 1-3. - let context = BaseAudioContext::new_inherited(global, BaseAudioContextOptions::AudioContext(options.into())); + let context = BaseAudioContext::new_inherited( + global, + BaseAudioContextOptions::AudioContext(options.into()), + ); // Step 4.1. let latency_hint = options.latencyHint; @@ -52,14 +55,13 @@ impl AudioContext { AudioContext { context, latency_hint, - base_latency: 0., // TODO + base_latency: 0., // TODO output_latency: 0., // TODO } } #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope, - options: &AudioContextOptions) -> DomRoot { + pub fn new(global: &GlobalScope, options: &AudioContextOptions) -> DomRoot { let context = AudioContext::new_inherited(global, options); let context = reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap); context.resume(); @@ -67,8 +69,10 @@ impl AudioContext { } // https://webaudio.github.io/web-audio-api/#AudioContext-constructors - pub fn Constructor(window: &Window, - options: &AudioContextOptions) -> Fallible> { + pub fn Constructor( + window: &Window, + options: &AudioContextOptions, + ) -> Fallible> { let global = window.upcast::(); Ok(AudioContext::new(global, options)) } @@ -125,7 +129,8 @@ impl AudioContextMethods for AudioContext { Ok(_) => { let base_context = Trusted::new(&self.context); let context = Trusted::new(self); - let _ = task_source.queue(task!(suspend_ok: move || { + let _ = task_source.queue( + task!(suspend_ok: move || { let base_context = base_context.root(); let context = context.root(); let promise = trusted_promise.root(); @@ -139,15 +144,20 @@ impl AudioContextMethods for AudioContext { &window ); } - }), window.upcast()); + }), + window.upcast(), + ); }, Err(_) => { // The spec does not define the error case and `suspend` should // never fail, but we handle the case here for completion. - let _ = task_source.queue(task!(suspend_error: move || { + let _ = task_source.queue( + task!(suspend_error: move || { let promise = trusted_promise.root(); promise.reject_error(Error::Type("Something went wrong".to_owned())); - }), window.upcast()); + }), + window.upcast(), + ); }, }; @@ -180,7 +190,8 @@ impl AudioContextMethods for AudioContext { Ok(_) => { let base_context = Trusted::new(&self.context); let context = Trusted::new(self); - let _ = task_source.queue(task!(suspend_ok: move || { + let _ = task_source.queue( + task!(suspend_ok: move || { let base_context = base_context.root(); let context = context.root(); let promise = trusted_promise.root(); @@ -194,19 +205,23 @@ impl AudioContextMethods for AudioContext { &window ); } - }), window.upcast()); + }), + window.upcast(), + ); }, Err(_) => { // The spec does not define the error case and `suspend` should // never fail, but we handle the case here for completion. - let _ = task_source.queue(task!(suspend_error: move || { + let _ = task_source.queue( + task!(suspend_error: move || { let promise = trusted_promise.root(); promise.reject_error(Error::Type("Something went wrong".to_owned())); - }), window.upcast()); + }), + window.upcast(), + ); }, }; - // Step 6. promise } diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs index 95fe4e044b4..77fda8dbef5 100644 --- a/components/script/dom/audiodestinationnode.rs +++ b/components/script/dom/audiodestinationnode.rs @@ -18,19 +18,28 @@ pub struct AudioDestinationNode { } impl AudioDestinationNode { - fn new_inherited(context: &BaseAudioContext, - options: &AudioNodeOptions) -> AudioDestinationNode { + fn new_inherited( + context: &BaseAudioContext, + options: &AudioNodeOptions, + ) -> AudioDestinationNode { AudioDestinationNode { - node: AudioNode::new_inherited(AudioNodeInit::DestinationNode, - Some(context.destination_node()), - context, options, 1, 1), + node: AudioNode::new_inherited( + AudioNodeInit::DestinationNode, + Some(context.destination_node()), + context, + options, + 1, + 1, + ), } } #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope, - context: &BaseAudioContext, - options: &AudioNodeOptions) -> DomRoot { + pub fn new( + global: &GlobalScope, + context: &BaseAudioContext, + options: &AudioNodeOptions, + ) -> DomRoot { let node = AudioDestinationNode::new_inherited(context, options); reflect_dom_object(Box::new(node), global, AudioDestinationNodeBinding::Wrap) } diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 400e975bac4..57313c1167d 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -33,15 +33,16 @@ pub struct AudioNode { } impl AudioNode { - pub fn new_inherited(node_type: AudioNodeInit, - node_id: Option, - context: &BaseAudioContext, - options: &AudioNodeOptions, - number_of_inputs: u32, - number_of_outputs: u32) -> AudioNode { - let node_id = node_id.unwrap_or_else(|| { - context.audio_context_impl().create_node(node_type) - }); + pub fn new_inherited( + node_type: AudioNodeInit, + node_id: Option, + context: &BaseAudioContext, + options: &AudioNodeOptions, + number_of_inputs: u32, + number_of_outputs: u32, + ) -> AudioNode { + let node_id = + node_id.unwrap_or_else(|| context.audio_context_impl().create_node(node_type)); AudioNode { eventtarget: EventTarget::new_inherited(), node_id, @@ -55,7 +56,9 @@ impl AudioNode { } pub fn message(&self, message: AudioNodeMessage) { - self.context.audio_context_impl().message_node(self.node_id, message); + self.context + .audio_context_impl() + .message_node(self.node_id, message); } pub fn node_id(&self) -> NodeId { @@ -65,65 +68,69 @@ impl AudioNode { impl AudioNodeMethods for AudioNode { // https://webaudio.github.io/web-audio-api/#dom-audionode-connect - fn Connect(&self, - destination: &AudioNode, - output: u32, - input: u32) -> Fallible> { - + fn Connect( + &self, + destination: &AudioNode, + output: u32, + input: u32, + ) -> Fallible> { if self.context != destination.context { return Err(Error::InvalidAccess); } - if output >= self.NumberOfOutputs() || - input >= destination.NumberOfInputs() { - return Err(Error::IndexSize); - } + if output >= self.NumberOfOutputs() || input >= destination.NumberOfInputs() { + return Err(Error::IndexSize); + } self.context.audio_context_impl().connect_ports( - self.node_id().output(output), destination.node_id().input(input) - ); + self.node_id().output(output), + destination.node_id().input(input), + ); Ok(DomRoot::from_ref(destination)) } - fn Connect_(&self, - _: &AudioParam, - _: u32) -> Fallible<()> { + fn Connect_(&self, _: &AudioParam, _: u32) -> Fallible<()> { // TODO Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect fn Disconnect(&self) -> ErrorResult { - self.context.audio_context_impl() + self.context + .audio_context_impl() .disconnect_all_from(self.node_id()); Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-output fn Disconnect_(&self, out: u32) -> ErrorResult { - self.context.audio_context_impl() + self.context + .audio_context_impl() .disconnect_output(self.node_id().output(out)); Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode fn Disconnect__(&self, to: &AudioNode) -> ErrorResult { - self.context.audio_context_impl() + self.context + .audio_context_impl() .disconnect_between(self.node_id(), to.node_id()); Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output - fn Disconnect___(&self, to: &AudioNode, out: u32) -> ErrorResult{ - self.context.audio_context_impl() + fn Disconnect___(&self, to: &AudioNode, out: u32) -> ErrorResult { + self.context + .audio_context_impl() .disconnect_output_between(self.node_id().output(out), to.node_id()); Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output-input fn Disconnect____(&self, to: &AudioNode, out: u32, inp: u32) -> ErrorResult { - self.context.audio_context_impl() + self.context + .audio_context_impl() .disconnect_output_between_to(self.node_id().output(out), to.node_id().input(inp)); Ok(()) } diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index 4c67e08cb5c..87e6804dd5a 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -30,13 +30,15 @@ pub struct AudioParam { } impl AudioParam { - pub fn new_inherited(context: &BaseAudioContext, - node: NodeId, - param: ParamType, - automation_rate: AutomationRate, - default_value: f32, - min_value: f32, - max_value: f32) -> AudioParam { + pub fn new_inherited( + context: &BaseAudioContext, + node: NodeId, + param: ParamType, + automation_rate: AutomationRate, + default_value: f32, + min_value: f32, + max_value: f32, + ) -> AudioParam { AudioParam { reflector_: Reflector::new(), context: Dom::from_ref(context), @@ -50,16 +52,25 @@ impl AudioParam { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, - context: &BaseAudioContext, - node: NodeId, - param: ParamType, - automation_rate: AutomationRate, - default_value: f32, - min_value: f32, - max_value: f32) -> DomRoot { - let audio_param = AudioParam::new_inherited(context, node, param, automation_rate, - default_value, min_value, max_value); + pub fn new( + window: &Window, + context: &BaseAudioContext, + node: NodeId, + param: ParamType, + automation_rate: AutomationRate, + default_value: f32, + min_value: f32, + max_value: f32, + ) -> DomRoot { + let audio_param = AudioParam::new_inherited( + context, + node, + param, + automation_rate, + default_value, + min_value, + max_value, + ); reflect_dom_object(Box::new(audio_param), window, AudioParamBinding::Wrap) } } @@ -80,14 +91,10 @@ impl AudioParamMethods for AudioParam { } fn SetValue(&self, value: Finite) { - self.context.audio_context_impl() - .message_node(self.node, - AudioNodeMessage::SetParam(self.param, - UserAutomationEvent::SetValue( - *value - ) - ) - ); + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParam(self.param, UserAutomationEvent::SetValue(*value)), + ); } fn DefaultValue(&self) -> Finite { @@ -102,83 +109,82 @@ impl AudioParamMethods for AudioParam { Finite::wrap(self.max_value) } - fn SetValueAtTime(&self, value: Finite, start_time: Finite) - -> DomRoot - { - self.context.audio_context_impl() - .message_node(self.node, - AudioNodeMessage::SetParam(self.param, - UserAutomationEvent::SetValueAtTime( - *value, *start_time - ) - ) - ); + fn SetValueAtTime(&self, value: Finite, start_time: Finite) -> DomRoot { + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::SetValueAtTime(*value, *start_time), + ), + ); DomRoot::from_ref(self) } - fn LinearRampToValueAtTime(&self, value: Finite, end_time: Finite) - -> DomRoot - { - self.context.audio_context_impl() - .message_node(self.node, - AudioNodeMessage::SetParam(self.param, - UserAutomationEvent::RampToValueAtTime( - RampKind::Linear, *value, *end_time - ) - ) - ); + fn LinearRampToValueAtTime( + &self, + value: Finite, + end_time: Finite, + ) -> DomRoot { + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::RampToValueAtTime(RampKind::Linear, *value, *end_time), + ), + ); DomRoot::from_ref(self) } - fn ExponentialRampToValueAtTime(&self, value: Finite, end_time: Finite) - -> DomRoot - { - self.context.audio_context_impl() - .message_node(self.node, - AudioNodeMessage::SetParam(self.param, - UserAutomationEvent::RampToValueAtTime( - RampKind::Exponential, *value, *end_time - ) - ) - ); + fn ExponentialRampToValueAtTime( + &self, + value: Finite, + end_time: Finite, + ) -> DomRoot { + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::RampToValueAtTime(RampKind::Exponential, *value, *end_time), + ), + ); DomRoot::from_ref(self) } - fn SetTargetAtTime(&self, target: Finite, start_time: Finite, time_constant: Finite) - -> DomRoot - { - self.context.audio_context_impl() - .message_node(self.node, - AudioNodeMessage::SetParam(self.param, - UserAutomationEvent::SetTargetAtTime( - *target, *start_time, (*time_constant).into() - ) - ) - ); + fn SetTargetAtTime( + &self, + target: Finite, + start_time: Finite, + time_constant: Finite, + ) -> DomRoot { + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::SetTargetAtTime(*target, *start_time, (*time_constant).into()), + ), + ); DomRoot::from_ref(self) } fn CancelScheduledValues(&self, cancel_time: Finite) -> DomRoot { - self.context.audio_context_impl() - .message_node(self.node, - AudioNodeMessage::SetParam(self.param, - UserAutomationEvent::CancelScheduledValues( - *cancel_time - ) - ) - ); + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::CancelScheduledValues(*cancel_time), + ), + ); DomRoot::from_ref(self) } fn CancelAndHoldAtTime(&self, cancel_time: Finite) -> DomRoot { - self.context.audio_context_impl() - .message_node(self.node, - AudioNodeMessage::SetParam(self.param, - UserAutomationEvent::CancelAndHoldAtTime( - *cancel_time - ) - ) - ); + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::CancelAndHoldAtTime(*cancel_time), + ), + ); DomRoot::from_ref(self) } } diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index 25ae2c009ed..74044d9dd9c 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -19,16 +19,24 @@ pub struct AudioScheduledSourceNode { } impl AudioScheduledSourceNode { - pub fn new_inherited(node_type: AudioNodeInit, - context: &BaseAudioContext, - options: &AudioNodeOptions, - number_of_inputs: u32, - number_of_outputs: u32) -> AudioScheduledSourceNode { + pub fn new_inherited( + node_type: AudioNodeInit, + context: &BaseAudioContext, + options: &AudioNodeOptions, + number_of_inputs: u32, + number_of_outputs: u32, + ) -> AudioScheduledSourceNode { AudioScheduledSourceNode { - node: AudioNode::new_inherited(node_type, None /* node_id */, - context, options, number_of_inputs, number_of_outputs), - started: Cell::new(false), - stopped: Cell::new(false), + node: AudioNode::new_inherited( + node_type, + None, /* node_id */ + context, + options, + number_of_inputs, + number_of_outputs, + ), + started: Cell::new(false), + stopped: Cell::new(false), } } @@ -51,9 +59,10 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { return Err(Error::InvalidState); } self.started.set(true); - self.node.message( - AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(*when)) - ); + self.node + .message(AudioNodeMessage::AudioScheduledSourceNode( + AudioScheduledSourceNodeMessage::Start(*when), + )); Ok(()) } @@ -63,9 +72,10 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { return Err(Error::InvalidState); } self.stopped.set(true); - self.node.message( - AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Stop(*when)) - ); + self.node + .message(AudioNodeMessage::AudioScheduledSourceNode( + AudioScheduledSourceNodeMessage::Stop(*when), + )); Ok(()) } } diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index c09fe9971f5..1dbf8bbaf7a 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -86,10 +86,7 @@ pub struct BaseAudioContext { impl BaseAudioContext { #[allow(unrooted_must_root)] - pub fn new_inherited( - _: &GlobalScope, - options: BaseAudioContextOptions, - ) -> BaseAudioContext { + pub fn new_inherited(_: &GlobalScope, options: BaseAudioContextOptions) -> BaseAudioContext { let options = match options { BaseAudioContextOptions::AudioContext(options) => options, BaseAudioContextOptions::OfflineAudioContext(_) => unimplemented!(), @@ -99,7 +96,11 @@ impl BaseAudioContext { let context = BaseAudioContext { eventtarget: EventTarget::new_inherited(), - audio_context_impl: Rc::new(ServoMedia::get().unwrap().create_audio_context(options.into())), + audio_context_impl: Rc::new( + ServoMedia::get() + .unwrap() + .create_audio_context(options.into()), + ), destination: Default::default(), in_flight_resume_promises_queue: Default::default(), pending_resume_promises: Default::default(), @@ -126,7 +127,9 @@ impl BaseAudioContext { #[allow(unrooted_must_root)] fn push_pending_resume_promise(&self, promise: &Rc) { - self.pending_resume_promises.borrow_mut().push(promise.clone()); + self.pending_resume_promises + .borrow_mut() + .push(promise.clone()); } /// Takes the pending resume promises. @@ -141,14 +144,11 @@ impl BaseAudioContext { /// which were taken and moved to the in-flight queue. #[allow(unrooted_must_root)] fn take_pending_resume_promises(&self, result: ErrorResult) { - let pending_resume_promises = mem::replace( - &mut *self.pending_resume_promises.borrow_mut(), - vec![], - ); - self.in_flight_resume_promises_queue.borrow_mut().push_back(( - pending_resume_promises.into(), - result, - )); + let pending_resume_promises = + mem::replace(&mut *self.pending_resume_promises.borrow_mut(), vec![]); + self.in_flight_resume_promises_queue + .borrow_mut() + .push_back((pending_resume_promises.into(), result)); } /// Fulfills the next in-flight resume promises queue after running a closure. @@ -161,21 +161,22 @@ impl BaseAudioContext { /// hiding actual safety bugs. #[allow(unrooted_must_root)] fn fulfill_in_flight_resume_promises(&self, f: F) - where - F: FnOnce(), - { - let (promises, result) = self.in_flight_resume_promises_queue - .borrow_mut() - .pop_front() - .expect("there should be at least one list of in flight resume promises"); - f(); - for promise in &*promises { - match result { - Ok(ref value) => promise.resolve_native(value), - Err(ref error) => promise.reject_error(error.clone()), - } + where + F: FnOnce(), + { + let (promises, result) = self + .in_flight_resume_promises_queue + .borrow_mut() + .pop_front() + .expect("there should be at least one list of in flight resume promises"); + f(); + for promise in &*promises { + match result { + Ok(ref value) => promise.resolve_native(value), + Err(ref error) => promise.reject_error(error.clone()), } } + } /// Control thread processing state pub fn control_thread_state(&self) -> ProcessingState { @@ -197,7 +198,8 @@ impl BaseAudioContext { match self.audio_context_impl.resume() { Ok(()) => { self.take_pending_resume_promises(Ok(())); - let _ = task_source.queue(task!(resume_success: move || { + let _ = task_source.queue( + task!(resume_success: move || { let this = this.root(); this.fulfill_in_flight_resume_promises(|| { if this.state.get() != AudioContextState::Running { @@ -210,14 +212,21 @@ impl BaseAudioContext { ); } }); - }), window.upcast()); + }), + window.upcast(), + ); }, Err(()) => { - self.take_pending_resume_promises(Err(Error::Type("Something went wrong".to_owned()))); - let _ = task_source.queue(task!(resume_error: move || { + self.take_pending_resume_promises(Err(Error::Type( + "Something went wrong".to_owned(), + ))); + let _ = task_source.queue( + task!(resume_error: move || { this.root().fulfill_in_flight_resume_promises(|| {}) - }), window.upcast()); - } + }), + window.upcast(), + ); + }, } } } @@ -288,7 +297,11 @@ impl BaseAudioContextMethods for BaseAudioContext { /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createoscillator fn CreateOscillator(&self) -> DomRoot { - OscillatorNode::new(&self.global().as_window(), &self, &OscillatorOptions::empty()) + OscillatorNode::new( + &self.global().as_window(), + &self, + &OscillatorOptions::empty(), + ) } /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-creategain @@ -297,56 +310,74 @@ impl BaseAudioContextMethods for BaseAudioContext { } /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer - fn CreateBuffer(&self, - number_of_channels: u32, - length: u32, - sample_rate: Finite) -> Fallible> { + fn CreateBuffer( + &self, + number_of_channels: u32, + length: u32, + sample_rate: Finite, + ) -> Fallible> { if number_of_channels <= 0 || number_of_channels > MAX_CHANNEL_COUNT || - length <= 0 || - *sample_rate <= 0. { - return Err(Error::NotSupported); - } - Ok(AudioBuffer::new(&self.global().as_window(), number_of_channels, length, *sample_rate, None)) + length <= 0 || + *sample_rate <= 0. + { + return Err(Error::NotSupported); + } + Ok(AudioBuffer::new( + &self.global().as_window(), + number_of_channels, + length, + *sample_rate, + None, + )) } fn CreateBufferSource(&self) -> DomRoot { - AudioBufferSourceNode::new(&self.global().as_window(), &self, &AudioBufferSourceOptions::empty()) + AudioBufferSourceNode::new( + &self.global().as_window(), + &self, + &AudioBufferSourceOptions::empty(), + ) } #[allow(unrooted_must_root)] - fn DecodeAudioData(&self, - audio_data: CustomAutoRooterGuard, - decode_success_callback: Option>, - decode_error_callback: Option>) - -> Rc { - // Step 1. - let promise = Promise::new(&self.global()); - let global = self.global(); - let window = global.as_window(); + fn DecodeAudioData( + &self, + audio_data: CustomAutoRooterGuard, + decode_success_callback: Option>, + decode_error_callback: Option>, + ) -> Rc { + // Step 1. + let promise = Promise::new(&self.global()); + let global = self.global(); + let window = global.as_window(); - if audio_data.len() > 0 { - // Step 2. - // XXX detach array buffer. - let uuid = Uuid::new_v4().simple().to_string(); - let uuid_ = uuid.clone(); - self.decode_resolvers.borrow_mut().insert(uuid.clone(), DecodeResolver { + if audio_data.len() > 0 { + // Step 2. + // XXX detach array buffer. + let uuid = Uuid::new_v4().simple().to_string(); + let uuid_ = uuid.clone(); + self.decode_resolvers.borrow_mut().insert( + uuid.clone(), + DecodeResolver { promise: promise.clone(), success_callback: decode_success_callback, error_callback: decode_error_callback, - }); - let audio_data = audio_data.to_vec(); - let decoded_audio = Arc::new(Mutex::new(Vec::new())); - let decoded_audio_ = decoded_audio.clone(); - let this = Trusted::new(self); - let this_ = this.clone(); - let task_source = window.dom_manipulation_task_source(); - let task_source_ = window.dom_manipulation_task_source(); - let canceller = window.task_canceller(); - let canceller_ = window.task_canceller(); - let callbacks = AudioDecoderCallbacks::new() - .eos(move || { - let _ = task_source.queue_with_canceller(task!(audio_decode_eos: move || { + }, + ); + let audio_data = audio_data.to_vec(); + let decoded_audio = Arc::new(Mutex::new(Vec::new())); + let decoded_audio_ = decoded_audio.clone(); + let this = Trusted::new(self); + let this_ = this.clone(); + let task_source = window.dom_manipulation_task_source(); + let task_source_ = window.dom_manipulation_task_source(); + let canceller = window.task_canceller(); + let canceller_ = window.task_canceller(); + let callbacks = AudioDecoderCallbacks::new() + .eos(move || { + let _ = task_source.queue_with_canceller( + task!(audio_decode_eos: move || { let this = this.root(); let decoded_audio = decoded_audio.lock().unwrap(); let buffer = AudioBuffer::new( @@ -362,10 +393,13 @@ impl BaseAudioContextMethods for BaseAudioContext { let _ = callback.Call__(&buffer, ExceptionHandling::Report); } resolver.promise.resolve_native(&buffer); - }), &canceller); - }) + }), + &canceller, + ); + }) .error(move || { - let _ = task_source_.queue_with_canceller(task!(audio_decode_eos: move || { + let _ = task_source_.queue_with_canceller( + task!(audio_decode_eos: move || { let this = this_.root(); let mut resolvers = this.decode_resolvers.borrow_mut(); assert!(resolvers.contains_key(&uuid)); @@ -376,7 +410,9 @@ impl BaseAudioContextMethods for BaseAudioContext { ExceptionHandling::Report); } resolver.promise.reject_error(Error::Type("Audio decode error".to_owned())); - }), &canceller_); + }), + &canceller_, + ); }) .progress(move |buffer| { decoded_audio_ @@ -385,16 +421,17 @@ impl BaseAudioContextMethods for BaseAudioContext { .extend_from_slice((*buffer).as_ref()); }) .build(); - self.audio_context_impl.decode_audio_data(audio_data, callbacks); - } else { - // Step 3. - promise.reject_error(Error::DataClone); - return promise; - } - - // Step 4. - promise + self.audio_context_impl + .decode_audio_data(audio_data, callbacks); + } else { + // Step 3. + promise.reject_error(Error::DataClone); + return promise; } + + // Step 4. + promise + } } impl From for AudioContextState { diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index 2aef086cd57..e9423c81960 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -31,7 +31,7 @@ impl GainNode { window: &Window, context: &BaseAudioContext, gain_options: &GainOptions, - ) -> GainNode { + ) -> GainNode { let mut node_options = AudioNodeOptions::empty(); node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); @@ -43,16 +43,17 @@ impl GainNode { &node_options, 1, // inputs 1, // outputs - ); - let gain = AudioParam::new(window, - context, - node.node_id(), - ParamType::Gain, - AutomationRate::A_rate, - 1., // default value - f32::MIN, // min value - f32::MAX, // max value - ); + ); + let gain = AudioParam::new( + window, + context, + node.node_id(), + ParamType::Gain, + AutomationRate::A_rate, + 1., // default value + f32::MIN, // min value + f32::MAX, // max value + ); GainNode { node, gain: Dom::from_ref(&gain), @@ -60,10 +61,11 @@ impl GainNode { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, - context: &BaseAudioContext, - options: &GainOptions - ) -> DomRoot { + pub fn new( + window: &Window, + context: &BaseAudioContext, + options: &GainOptions, + ) -> DomRoot { let node = GainNode::new_inherited(window, context, options); reflect_dom_object(Box::new(node), window, GainNodeBinding::Wrap) } @@ -72,7 +74,7 @@ impl GainNode { window: &Window, context: &BaseAudioContext, options: &GainOptions, - ) -> Fallible> { + ) -> Fallible> { Ok(GainNode::new(window, context, options)) } } diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 131b76fd616..f5e5d5df886 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -35,7 +35,7 @@ impl OscillatorNode { window: &Window, context: &BaseAudioContext, oscillator_options: &OscillatorOptions, - ) -> OscillatorNode { + ) -> OscillatorNode { let mut node_options = AudioNodeOptions::empty(); node_options.channelCount = Some(2); node_options.channelCountMode = Some(ChannelCountMode::Max); @@ -46,20 +46,28 @@ impl OscillatorNode { &node_options, 0, /* inputs */ 1, /* outputs */ - ); + ); let node_id = source_node.node().node_id(); - let frequency = AudioParam::new(window, - context, - node_id, - ParamType::Frequency, - AutomationRate::A_rate, - 440., f32::MIN, f32::MAX); - let detune = AudioParam::new(window, - context, - node_id, - ParamType::Detune, - AutomationRate::A_rate, - 0., -440. / 2., 440. / 2.); + let frequency = AudioParam::new( + window, + context, + node_id, + ParamType::Frequency, + AutomationRate::A_rate, + 440., + f32::MIN, + f32::MAX, + ); + let detune = AudioParam::new( + window, + context, + node_id, + ParamType::Detune, + AutomationRate::A_rate, + 0., + -440. / 2., + 440. / 2., + ); OscillatorNode { source_node, @@ -74,7 +82,7 @@ impl OscillatorNode { window: &Window, context: &BaseAudioContext, options: &OscillatorOptions, - ) -> DomRoot { + ) -> DomRoot { let node = OscillatorNode::new_inherited(window, context, options); reflect_dom_object(Box::new(node), window, OscillatorNodeBinding::Wrap) } @@ -83,7 +91,7 @@ impl OscillatorNode { window: &Window, context: &BaseAudioContext, options: &OscillatorOptions, - ) -> Fallible> { + ) -> Fallible> { Ok(OscillatorNode::new(window, context, options)) } } From abccf68a47cfc86c5b36b27db226912808062bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 11:14:51 +0200 Subject: [PATCH 51/87] Clarify that servo-media deals with duplicated connections --- components/script/dom/audionode.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 57313c1167d..43e0ee736e7 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -82,6 +82,8 @@ impl AudioNodeMethods for AudioNode { return Err(Error::IndexSize); } + // servo-media takes care of ignoring duplicated connections. + self.context.audio_context_impl().connect_ports( self.node_id().output(output), destination.node_id().input(input), From 758ae94aa13b18a8e6014a6c771ffd3ee49f9817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 15:02:10 +0200 Subject: [PATCH 52/87] AudioNode channel related properties getter and setter fixes --- components/script/dom/audionode.rs | 68 +++++++++++++++++++++++ components/script/dom/baseaudiocontext.rs | 5 ++ 2 files changed, 73 insertions(+) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 43e0ee736e7..3b9d6ce8ac3 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -5,13 +5,17 @@ use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::codegen::InheritTypes::{AudioNodeTypeId, EventTargetTypeId}; use dom::bindings::error::{Error, ErrorResult, Fallible}; +use dom::bindings::inheritance::Castable; use dom::bindings::root::{Dom, DomRoot}; use dom::audioparam::AudioParam; use dom::eventtarget::EventTarget; use dom_struct::dom_struct; use servo_media::audio::graph::NodeId; use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit}; +use servo_media::audio::node::ChannelCountMode as ServoMediaChannelCountMode; +use servo_media::audio::node::ChannelInterpretation as ServoMediaChannelInterpretation; use std::cell::Cell; // 32 is the minimum required by the spec for createBuffer() and the deprecated @@ -169,28 +173,92 @@ impl AudioNodeMethods for AudioNode { self.channel_count.get() } + // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount fn SetChannelCount(&self, value: u32) -> ErrorResult { + match self.upcast::().type_id() { + EventTargetTypeId::AudioNode(AudioNodeTypeId::AudioDestinationNode) => { + if self.context.is_offline() { + return Err(Error::InvalidState); + } else if value < 1 || value > MAX_CHANNEL_COUNT { + return Err(Error::IndexSize); + } + }, + // XXX We do not support any of the other AudioNodes with + // constraints yet. Add more cases here as we add support + // for new AudioNodes. + _ => (), + }; + if value == 0 || value > MAX_CHANNEL_COUNT { return Err(Error::NotSupported); } + self.channel_count.set(value); + self.message(AudioNodeMessage::SetChannelCount(value as u8)); Ok(()) } + // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcountmode fn ChannelCountMode(&self) -> ChannelCountMode { self.channel_count_mode.get() } + // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcountmode fn SetChannelCountMode(&self, value: ChannelCountMode) -> ErrorResult { + // Channel count mode has no effect for nodes with no inputs. + if self.number_of_inputs == 0 { + return Ok(()); + } + + match self.upcast::().type_id() { + EventTargetTypeId::AudioNode(AudioNodeTypeId::AudioDestinationNode) => { + if self.context.is_offline() { + return Err(Error::InvalidState); + } + }, + // XXX We do not support any of the other AudioNodes with + // constraints yet. Add more cases here as we add support + // for new AudioNodes. + _ => (), + }; + self.channel_count_mode.set(value); + self.message(AudioNodeMessage::SetChannelMode(value.into())); Ok(()) } + // https://webaudio.github.io/web-audio-api/#dom-audionode-channelinterpretation fn ChannelInterpretation(&self) -> ChannelInterpretation { self.channel_interpretation.get() } + // https://webaudio.github.io/web-audio-api/#dom-audionode-channelinterpretation fn SetChannelInterpretation(&self, value: ChannelInterpretation) { + // Channel interpretation mode has no effect for nodes with no inputs. + if self.number_of_inputs == 0 { + return Ok(()); + } + self.channel_interpretation.set(value); + self.message(AudioNodeMessage::SetChannelInterpretation(value.into())); + } +} + +impl From for ServoMediaChannelCountMode { + fn from(mode: ChannelCountMode) -> Self { + match mode { + ChannelCountMode::Max => ServoMediaChannelCountMode::Max, + ChannelCountMode::Clamped_max => ServoMediaChannelCountMode::ClampedMax, + ChannelCountMode::Explicit => ServoMediaChannelCountMode::Explicit, + } + } +} + +impl From for ServoMediaChannelInterpretation { + fn from(interpretation: ChannelInterpretation) -> Self { + match interpretation { + ChannelInterpretation::Discrete => ServoMediaChannelInterpretation::Discrete, + ChannelInterpretation::Speakers => ServoMediaChannelInterpretation::Speakers, + } } } diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 1dbf8bbaf7a..7010cd76661 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -112,6 +112,11 @@ impl BaseAudioContext { context } + /// Tells whether this is an OfflineAudioContext or not. + pub fn is_offline(&self) -> bool { + false + } + pub fn audio_context_impl(&self) -> Rc { self.audio_context_impl.clone() } From 3dde730f9b4d3f4b05e89e9c62744c667d75b6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 15:21:09 +0200 Subject: [PATCH 53/87] AudioParam automation rate setter --- components/script/dom/audionode.rs | 2 +- components/script/dom/audioparam.rs | 30 +++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 3b9d6ce8ac3..7833856e421 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -236,7 +236,7 @@ impl AudioNodeMethods for AudioNode { fn SetChannelInterpretation(&self, value: ChannelInterpretation) { // Channel interpretation mode has no effect for nodes with no inputs. if self.number_of_inputs == 0 { - return Ok(()); + return; } self.channel_interpretation.set(value); diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index 87e6804dd5a..b64d0aab99c 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -12,7 +12,7 @@ use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::graph::NodeId; use servo_media::audio::node::AudioNodeMessage; -use servo_media::audio::param::{ParamType, RampKind, UserAutomationEvent}; +use servo_media::audio::param::{ParamRate, ParamType, RampKind, UserAutomationEvent}; use std::cell::Cell; #[dom_struct] @@ -76,20 +76,27 @@ impl AudioParam { } impl AudioParamMethods for AudioParam { + // https://webaudio.github.io/web-audio-api/#dom-audioparam-automationrate fn AutomationRate(&self) -> AutomationRate { self.automation_rate.get() } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-automationrate fn SetAutomationRate(&self, automation_rate: AutomationRate) { self.automation_rate.set(automation_rate); - // XXX set servo-media param automation rate + self.context.audio_context_impl().message_node( + self.node, + AudioNodeMessage::SetParamRate(self.param, automation_rate.into()), + ); } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-value fn Value(&self) -> Finite { // XXX Finite::wrap(0.) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-value fn SetValue(&self, value: Finite) { self.context.audio_context_impl().message_node( self.node, @@ -97,18 +104,22 @@ impl AudioParamMethods for AudioParam { ); } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-defaultvalue fn DefaultValue(&self) -> Finite { Finite::wrap(self.default_value) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-minvalue fn MinValue(&self) -> Finite { Finite::wrap(self.min_value) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-maxvalue fn MaxValue(&self) -> Finite { Finite::wrap(self.max_value) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-setvalueattime fn SetValueAtTime(&self, value: Finite, start_time: Finite) -> DomRoot { self.context.audio_context_impl().message_node( self.node, @@ -120,6 +131,7 @@ impl AudioParamMethods for AudioParam { DomRoot::from_ref(self) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-linearramptovalueattime fn LinearRampToValueAtTime( &self, value: Finite, @@ -135,6 +147,7 @@ impl AudioParamMethods for AudioParam { DomRoot::from_ref(self) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-exponentialramptovalueattime fn ExponentialRampToValueAtTime( &self, value: Finite, @@ -150,6 +163,7 @@ impl AudioParamMethods for AudioParam { DomRoot::from_ref(self) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-settargetattime fn SetTargetAtTime( &self, target: Finite, @@ -166,6 +180,7 @@ impl AudioParamMethods for AudioParam { DomRoot::from_ref(self) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-cancelscheduledvalues fn CancelScheduledValues(&self, cancel_time: Finite) -> DomRoot { self.context.audio_context_impl().message_node( self.node, @@ -177,6 +192,7 @@ impl AudioParamMethods for AudioParam { DomRoot::from_ref(self) } + // https://webaudio.github.io/web-audio-api/#dom-audioparam-cancelandholdattime fn CancelAndHoldAtTime(&self, cancel_time: Finite) -> DomRoot { self.context.audio_context_impl().message_node( self.node, @@ -188,3 +204,13 @@ impl AudioParamMethods for AudioParam { DomRoot::from_ref(self) } } + +// https://webaudio.github.io/web-audio-api/#enumdef-automationrate +impl From for ParamRate { + fn from(rate: AutomationRate) -> Self { + match rate { + AutomationRate::A_rate => ParamRate::ARate, + AutomationRate::K_rate => ParamRate::KRate, + } + } +} From 8a6ea00f584513913b676f77a790121f13bb1c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 16:05:16 +0200 Subject: [PATCH 54/87] Reference issue to support the AudioScheduledSourceNode.ended event --- components/script/dom/audioscheduledsourcenode.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index 74044d9dd9c..cc1a57f212d 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -51,6 +51,7 @@ impl AudioScheduledSourceNode { impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-onended + // XXX We should dispatch this when we reach the end. Depends on servo-media #82. event_handler!(ended, GetOnended, SetOnended); // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start From ebcbe2ff7da04abb2aa98c4b797975c48af74bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 16:18:25 +0200 Subject: [PATCH 55/87] Mark DecodeResolver as must_root --- components/script/dom/baseaudiocontext.rs | 2 +- components/script/dom/macros.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 7010cd76661..4acb4d9f1d9 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -51,8 +51,8 @@ pub enum BaseAudioContextOptions { OfflineAudioContext(OfflineAudioContextOptions), } +#[must_root] #[derive(JSTraceable)] -#[allow(unrooted_must_root)] struct DecodeResolver { pub promise: Rc, pub success_callback: Option>, diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 7d9172cbe7b..5362b09214e 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -628,4 +628,5 @@ macro_rules! handle_potential_webgl_error { ($context:expr, $call:expr) => { handle_potential_webgl_error!($context, $call, ()); }; -} \ No newline at end of file +} + From b68c791b8de22633d5a5940a64787403d26fc775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 11 Jul 2018 17:50:20 +0200 Subject: [PATCH 56/87] Remove unimplemented PeriodicWave stub --- components/script/dom/baseaudiocontext.rs | 1 + components/script/dom/mod.rs | 1 - components/script/dom/periodicwave.rs | 40 ------------------- .../script/dom/webidls/OscillatorNode.webidl | 2 +- .../script/dom/webidls/PeriodicWave.webidl | 21 ---------- 5 files changed, 2 insertions(+), 63 deletions(-) delete mode 100644 components/script/dom/periodicwave.rs delete mode 100644 components/script/dom/webidls/PeriodicWave.webidl diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 4acb4d9f1d9..a6ba9e2fa02 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -46,6 +46,7 @@ use std::sync::{Arc, Mutex}; use task_source::TaskSource; use uuid::Uuid; +#[allow(dead_code)] pub enum BaseAudioContextOptions { AudioContext(RealTimeAudioContextOptions), OfflineAudioContext(OfflineAudioContextOptions), diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 39273745417..d58314f9af3 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -414,7 +414,6 @@ pub mod performanceobserver; pub mod performanceobserverentrylist; pub mod performancepainttiming; pub mod performancetiming; -pub mod periodicwave; pub mod permissions; pub mod permissionstatus; pub mod plugin; diff --git a/components/script/dom/periodicwave.rs b/components/script/dom/periodicwave.rs deleted file mode 100644 index 4158e250e5c..00000000000 --- a/components/script/dom/periodicwave.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use dom::baseaudiocontext::BaseAudioContext; -use dom::bindings::codegen::Bindings::PeriodicWaveBinding; -use dom::bindings::codegen::Bindings::PeriodicWaveBinding::PeriodicWaveOptions; -use dom::bindings::error::Fallible; -use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::DomRoot; -use dom::window::Window; -use dom_struct::dom_struct; - -#[dom_struct] -pub struct PeriodicWave { - reflector_: Reflector, -} - -impl PeriodicWave { - pub fn new_inherited() -> PeriodicWave { - PeriodicWave { - reflector_: Reflector::new(), - } - } - - #[allow(unrooted_must_root)] - pub fn new(window: &Window) -> DomRoot { - let periodic_wave = PeriodicWave::new_inherited(); - reflect_dom_object(Box::new(periodic_wave), window, PeriodicWaveBinding::Wrap) - } - - pub fn Constructor( - window: &Window, - _context: &BaseAudioContext, - _options: &PeriodicWaveOptions, - ) -> Fallible> { - // TODO. - Ok(PeriodicWave::new(&window)) - } -} diff --git a/components/script/dom/webidls/OscillatorNode.webidl b/components/script/dom/webidls/OscillatorNode.webidl index 84c6de45967..958921bb810 100644 --- a/components/script/dom/webidls/OscillatorNode.webidl +++ b/components/script/dom/webidls/OscillatorNode.webidl @@ -18,7 +18,7 @@ dictionary OscillatorOptions : AudioNodeOptions { OscillatorType type = "sine"; float frequency = 440; float detune = 0; - PeriodicWave periodicWave; + // PeriodicWave periodicWave; }; [Exposed=Window, diff --git a/components/script/dom/webidls/PeriodicWave.webidl b/components/script/dom/webidls/PeriodicWave.webidl deleted file mode 100644 index 63ec5981235..00000000000 --- a/components/script/dom/webidls/PeriodicWave.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, 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/#periodicwave - */ - -dictionary PeriodicWaveConstraints { - boolean disableNormalization = false; -}; - -dictionary PeriodicWaveOptions : PeriodicWaveConstraints { - sequence real; - sequence imag; -}; - -[Exposed=Window, - Constructor(BaseAudioContext context, optional PeriodicWaveOptions options)] -interface PeriodicWave { -}; From f0a691e474cc328b80bc249c62b49702b419d191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 12 Jul 2018 11:05:29 +0200 Subject: [PATCH 57/87] Update servo-media after crate split up. Allows building for Android --- components/script/Cargo.toml | 2 +- components/script/dom/baseaudiocontext.rs | 6 +++--- components/script/dom/bindings/trace.rs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 6aa60335808..f33735d5435 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -87,7 +87,7 @@ servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} servo_config = {path = "../config"} servo_geometry = {path = "../geometry" } -servo_media = {git = "https://github.com/servo/media"} +servo-media = {git = "https://github.com/servo/media"} servo_rand = {path = "../rand"} servo_url = {path = "../url"} smallvec = "0.6" diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index a6ba9e2fa02..1e2aed3ac7a 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -31,9 +31,9 @@ use dom::oscillatornode::OscillatorNode; use dom::promise::Promise; use dom::window::Window; use dom_struct::dom_struct; -use servo_media::ServoMedia; use js::rust::CustomAutoRooterGuard; use js::typedarray::ArrayBuffer; +use servo_media::{Backend, ServoMedia}; use servo_media::audio::context::{AudioContext, ProcessingState}; use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions}; use servo_media::audio::decoder::AudioDecoderCallbacks; @@ -64,7 +64,7 @@ struct DecodeResolver { pub struct BaseAudioContext { eventtarget: EventTarget, #[ignore_malloc_size_of = "servo_media"] - audio_context_impl: Rc, + audio_context_impl: Rc>, /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination destination: MutNullableDom, /// Resume promises which are soon to be fulfilled by a queued task. @@ -118,7 +118,7 @@ impl BaseAudioContext { false } - pub fn audio_context_impl(&self) -> Rc { + pub fn audio_context_impl(&self) -> Rc> { self.audio_context_impl.clone() } diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index bf6ac823603..1e09dcea81e 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -80,6 +80,7 @@ use offscreen_gl_context::GLLimits; use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; +use servo_media::Backend; use servo_media::audio::buffer_source_node::AudioBuffer; use servo_media::audio::context::AudioContext; use servo_media::audio::graph::NodeId; @@ -435,7 +436,7 @@ unsafe_no_jsmanaged_fields!(CanvasId); unsafe_no_jsmanaged_fields!(SourceSet); unsafe_no_jsmanaged_fields!(AudioGraph); unsafe_no_jsmanaged_fields!(AudioBuffer); -unsafe_no_jsmanaged_fields!(AudioContext); +unsafe_no_jsmanaged_fields!(AudioContext); unsafe_no_jsmanaged_fields!(NodeId); unsafe_no_jsmanaged_fields!(ParamType); From 21cb160be3d2042c5d2100f5ab50f500500a510e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 12 Jul 2018 17:57:08 +0200 Subject: [PATCH 58/87] test-tidy fixes --- .../script/dom/audiobuffersourcenode.rs | 20 +++++++++++++------ components/script/dom/audiocontext.rs | 10 +++++++--- components/script/dom/audiodestinationnode.rs | 1 + components/script/dom/audionode.rs | 3 ++- .../script/dom/audioscheduledsourcenode.rs | 2 +- components/script/dom/baseaudiocontext.rs | 4 +++- components/script/dom/bindings/trace.rs | 10 +++++----- components/script/dom/gainnode.rs | 7 ++++--- components/script/dom/oscillatornode.rs | 8 +++++--- python/tidy/servo_tidy/tidy.py | 1 + 10 files changed, 43 insertions(+), 23 deletions(-) diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 15d23ab6988..2aad2004c20 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -9,11 +9,10 @@ use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceNodeMethods; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; -use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; -use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; -use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding:: -AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; +use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; @@ -109,12 +108,12 @@ impl AudioBufferSourceNode { } impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer fn GetBuffer(&self) -> Fallible>> { Ok(self.buffer.get()) } - /// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer fn SetBuffer(&self, new_buffer: Option<&AudioBuffer>) -> Fallible<()> { if new_buffer.is_some() && self.buffer.get().is_some() { return Err(Error::InvalidState); @@ -136,38 +135,47 @@ impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { Ok(()) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-playbackrate fn PlaybackRate(&self) -> DomRoot { DomRoot::from_ref(&self.playback_rate) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-detune fn Detune(&self) -> DomRoot { DomRoot::from_ref(&self.detune) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loop fn Loop(&self) -> bool { self.loop_enabled.get() } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loop fn SetLoop(&self, should_loop: bool) { self.loop_enabled.set(should_loop); } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopstart fn LoopStart(&self) -> Finite { Finite::wrap(self.loop_start.get()) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopstart fn SetLoopStart(&self, loop_start: Finite) { self.loop_start.set(*loop_start); } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopend fn LoopEnd(&self) -> Finite { Finite::wrap(self.loop_end.get()) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopend fn SetLoopEnd(&self, loop_end: Finite) { self.loop_end.set(*loop_end) } + // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-start fn Start( &self, when: Finite, diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 275208b9821..24df81b0f54 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -4,8 +4,8 @@ use dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; use dom::bindings::codegen::Bindings::AudioContextBinding; -use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextMethods, AudioContextOptions}; -use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextLatencyCategory, AudioTimestamp}; +use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextLatencyCategory, AudioContextMethods}; +use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextOptions, AudioTimestamp}; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::error::{Error, Fallible}; @@ -87,14 +87,17 @@ impl AudioContext { } impl AudioContextMethods for AudioContext { + // https://webaudio.github.io/web-audio-api/#dom-audiocontext-baselatency fn BaseLatency(&self) -> Finite { Finite::wrap(self.base_latency) } + // https://webaudio.github.io/web-audio-api/#dom-audiocontext-outputlatency fn OutputLatency(&self) -> Finite { Finite::wrap(self.output_latency) } + // https://webaudio.github.io/web-audio-api/#dom-audiocontext-outputlatency fn GetOutputTimestamp(&self) -> AudioTimestamp { // TODO AudioTimestamp { @@ -103,7 +106,7 @@ impl AudioContextMethods for AudioContext { } } - /// https://webaudio.github.io/web-audio-api/#dom-audiocontext-suspend + // https://webaudio.github.io/web-audio-api/#dom-audiocontext-suspend #[allow(unrooted_must_root)] fn Suspend(&self) -> Rc { // Step 1. @@ -165,6 +168,7 @@ impl AudioContextMethods for AudioContext { promise } + // https://webaudio.github.io/web-audio-api/#dom-audiocontext-close #[allow(unrooted_must_root)] fn Close(&self) -> Rc { // Step 1. diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs index 77fda8dbef5..06a871edc5a 100644 --- a/components/script/dom/audiodestinationnode.rs +++ b/components/script/dom/audiodestinationnode.rs @@ -46,6 +46,7 @@ impl AudioDestinationNode { } impl AudioDestinationNodeMethods for AudioDestinationNode { + // https://webaudio.github.io/web-audio-api/#dom-audiodestinationnode-maxchannelcount fn MaxChannelCount(&self) -> u32 { MAX_CHANNEL_COUNT } diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 7833856e421..3f4093d08c5 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::audioparam::AudioParam; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; @@ -9,7 +10,6 @@ use dom::bindings::codegen::InheritTypes::{AudioNodeTypeId, EventTargetTypeId}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::root::{Dom, DomRoot}; -use dom::audioparam::AudioParam; use dom::eventtarget::EventTarget; use dom_struct::dom_struct; use servo_media::audio::graph::NodeId; @@ -96,6 +96,7 @@ impl AudioNodeMethods for AudioNode { Ok(DomRoot::from_ref(destination)) } + // https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output fn Connect_(&self, _: &AudioParam, _: u32) -> Fallible<()> { // TODO Ok(()) diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index cc1a57f212d..45a091dcf18 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audionode::AudioNode; use dom::baseaudiocontext::BaseAudioContext; -use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::num::Finite; use dom_struct::dom_struct; diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 1e2aed3ac7a..001e8c84efa 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -9,8 +9,8 @@ use dom::audionode::MAX_CHANNEL_COUNT; use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; -use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use dom::bindings::codegen::Bindings::BaseAudioContextBinding::DecodeErrorCallback; @@ -338,6 +338,7 @@ impl BaseAudioContextMethods for BaseAudioContext { )) } + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffersource fn CreateBufferSource(&self) -> DomRoot { AudioBufferSourceNode::new( &self.global().as_window(), @@ -346,6 +347,7 @@ impl BaseAudioContextMethods for BaseAudioContext { ) } + // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-decodeaudiodata #[allow(unrooted_must_root)] fn DecodeAudioData( &self, diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 1e09dcea81e..ecccb7d2180 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -80,11 +80,6 @@ use offscreen_gl_context::GLLimits; use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; -use servo_media::Backend; -use servo_media::audio::buffer_source_node::AudioBuffer; -use servo_media::audio::context::AudioContext; -use servo_media::audio::graph::NodeId; -use servo_media::audio::param::ParamType; use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; @@ -95,6 +90,11 @@ use selectors::matching::ElementSelectorFlags; use serde::{Deserialize, Serialize}; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; +use servo_media::Backend; +use servo_media::audio::buffer_source_node::AudioBuffer; +use servo_media::audio::context::AudioContext; +use servo_media::audio::graph::NodeId; +use servo_media::audio::param::ParamType; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use smallvec::SmallVec; use std::cell::{Cell, RefCell, UnsafeCell}; diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index e9423c81960..fe7ac041bf9 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -1,13 +1,13 @@ /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v.2.0. If a copy of the MPL was not distributed with this + * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audionode::AudioNode; use dom::audioparam::AudioParam; use dom::baseaudiocontext::BaseAudioContext; -use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; -use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use dom::bindings::codegen::Bindings::GainNodeBinding::{self, GainNodeMethods, GainOptions}; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; @@ -80,6 +80,7 @@ impl GainNode { } impl GainNodeMethods for GainNode { + // https://webaudio.github.io/web-audio-api/#dom-gainnode-gain fn Gain(&self) -> DomRoot { DomRoot::from_ref(&self.gain) } diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index f5e5d5df886..f44fa747f7d 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -1,13 +1,13 @@ /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v.2.0. If a copy of the MPL was not distributed with this + * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::audioparam::AudioParam; use dom::audioscheduledsourcenode::AudioScheduledSourceNode; use dom::baseaudiocontext::BaseAudioContext; -use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; -use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOptions, OscillatorType}; use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods; use dom::bindings::error::Fallible; @@ -97,10 +97,12 @@ impl OscillatorNode { } impl OscillatorNodeMethods for OscillatorNode { + // https://webaudio.github.io/web-audio-api/#dom-oscillatornode-frequency fn Frequency(&self) -> DomRoot { DomRoot::from_ref(&self.frequency) } + // https://webaudio.github.io/web-audio-api/#dom-oscillatornode-detune fn Detune(&self) -> DomRoot { DomRoot::from_ref(&self.detune) } diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index a53b9ebded9..d61f414dd3d 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -94,6 +94,7 @@ WEBIDL_STANDARDS = [ "//webbluetoothcg.github.io/web-bluetooth/", "//svgwg.org/svg2-draft", "//wicg.github.io", + "//webaudio.github.io", # Not a URL "// This interface is entirely internal to Servo, and should not be" + " accessible to\n// web pages." From f7e79d286a8ad25bf3f2c98a01e24990ad850940 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 12 Jul 2018 11:15:44 -0700 Subject: [PATCH 59/87] Add deps to travis --- .travis.yml | 1 + README.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 62fc99df88d..cbb03624f5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ matrix: - sudo add-apt-repository 'deb http://apt.llvm.org/precise/ llvm-toolchain-precise-3.9 main' -y - sudo apt-get update -q - sudo apt-get install clang-3.9 llvm-3.9 llvm-3.9-runtime -y + - sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev -y - export LLVM_CONFIG=/usr/lib/llvm-3.9/bin/llvm-config - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y - source ~/.profile diff --git a/README.md b/README.md index f86d2a2d44d..c6cd2dc4edf 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,8 @@ sudo apt install git curl autoconf libx11-dev \ gperf g++ build-essential cmake virtualenv python-pip \ libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \ libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \ - libharfbuzz-dev ccache clang + libharfbuzz-dev ccache clang \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev ``` If you using a version prior to **Ubuntu 17.04** or **Debian Sid**, replace `libssl1.0-dev` with `libssl-dev`. From 562e58ac49b614c5051430ce132aa001e41f3f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 13 Jul 2018 09:15:18 +0200 Subject: [PATCH 60/87] AudioParam value getter --- components/script/dom/audioparam.rs | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index b64d0aab99c..964d4264d7f 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -14,6 +14,7 @@ use servo_media::audio::graph::NodeId; use servo_media::audio::node::AudioNodeMessage; use servo_media::audio::param::{ParamRate, ParamType, RampKind, UserAutomationEvent}; use std::cell::Cell; +use std::sync::mpsc; #[dom_struct] pub struct AudioParam { @@ -73,6 +74,10 @@ impl AudioParam { ); reflect_dom_object(Box::new(audio_param), window, AudioParamBinding::Wrap) } + + fn message_node(&self, message: AudioNodeMessage) { + self.context.audio_context_impl().message_node(self.node, message); + } } impl AudioParamMethods for AudioParam { @@ -84,22 +89,23 @@ impl AudioParamMethods for AudioParam { // https://webaudio.github.io/web-audio-api/#dom-audioparam-automationrate fn SetAutomationRate(&self, automation_rate: AutomationRate) { self.automation_rate.set(automation_rate); - self.context.audio_context_impl().message_node( - self.node, - AudioNodeMessage::SetParamRate(self.param, automation_rate.into()), + self.message_node( + AudioNodeMessage::SetParamRate(self.param, automation_rate.into()) ); } // https://webaudio.github.io/web-audio-api/#dom-audioparam-value fn Value(&self) -> Finite { - // XXX - Finite::wrap(0.) + let (tx, rx) = mpsc::channel(); + self.message_node( + AudioNodeMessage::GetParamValue(self.param, tx) + ); + Finite::wrap(rx.recv().unwrap()) } // https://webaudio.github.io/web-audio-api/#dom-audioparam-value fn SetValue(&self, value: Finite) { - self.context.audio_context_impl().message_node( - self.node, + self.message_node( AudioNodeMessage::SetParam(self.param, UserAutomationEvent::SetValue(*value)), ); } @@ -121,12 +127,11 @@ impl AudioParamMethods for AudioParam { // https://webaudio.github.io/web-audio-api/#dom-audioparam-setvalueattime fn SetValueAtTime(&self, value: Finite, start_time: Finite) -> DomRoot { - self.context.audio_context_impl().message_node( - self.node, + self.message_node( AudioNodeMessage::SetParam( self.param, UserAutomationEvent::SetValueAtTime(*value, *start_time), - ), + ) ); DomRoot::from_ref(self) } @@ -137,8 +142,7 @@ impl AudioParamMethods for AudioParam { value: Finite, end_time: Finite, ) -> DomRoot { - self.context.audio_context_impl().message_node( - self.node, + self.message_node( AudioNodeMessage::SetParam( self.param, UserAutomationEvent::RampToValueAtTime(RampKind::Linear, *value, *end_time), @@ -153,8 +157,7 @@ impl AudioParamMethods for AudioParam { value: Finite, end_time: Finite, ) -> DomRoot { - self.context.audio_context_impl().message_node( - self.node, + self.message_node( AudioNodeMessage::SetParam( self.param, UserAutomationEvent::RampToValueAtTime(RampKind::Exponential, *value, *end_time), @@ -170,8 +173,7 @@ impl AudioParamMethods for AudioParam { start_time: Finite, time_constant: Finite, ) -> DomRoot { - self.context.audio_context_impl().message_node( - self.node, + self.message_node( AudioNodeMessage::SetParam( self.param, UserAutomationEvent::SetTargetAtTime(*target, *start_time, (*time_constant).into()), @@ -182,8 +184,7 @@ impl AudioParamMethods for AudioParam { // https://webaudio.github.io/web-audio-api/#dom-audioparam-cancelscheduledvalues fn CancelScheduledValues(&self, cancel_time: Finite) -> DomRoot { - self.context.audio_context_impl().message_node( - self.node, + self.message_node( AudioNodeMessage::SetParam( self.param, UserAutomationEvent::CancelScheduledValues(*cancel_time), @@ -194,8 +195,7 @@ impl AudioParamMethods for AudioParam { // https://webaudio.github.io/web-audio-api/#dom-audioparam-cancelandholdattime fn CancelAndHoldAtTime(&self, cancel_time: Finite) -> DomRoot { - self.context.audio_context_impl().message_node( - self.node, + self.message_node( AudioNodeMessage::SetParam( self.param, UserAutomationEvent::CancelAndHoldAtTime(*cancel_time), From 284aeb20ec179197d8b7da24556f23468cf836c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 13 Jul 2018 09:34:34 +0200 Subject: [PATCH 61/87] Try gstreamer-rs travis config --- .travis.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cbb03624f5e..92a53c6df04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,13 @@ matrix: - sudo add-apt-repository 'deb http://apt.llvm.org/precise/ llvm-toolchain-precise-3.9 main' -y - sudo apt-get update -q - sudo apt-get install clang-3.9 llvm-3.9 llvm-3.9-runtime -y - - sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev -y + - curl -L https://people.freedesktop.org/~slomo/gstreamer.tar.gz | tar xz + - sed -i "s;prefix=/root/gstreamer;prefix=$PWD/gstreamer;g" $PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig/*.pc + - export PKG_CONFIG_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig + - export GST_PLUGIN_SYSTEM_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/gstreamer-1.0 + - export GST_PLUGIN_SCANNER=$PWD/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner + - export PATH=$PATH:$PWD/gstreamer/bin + - export LD_LIBRARY_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH - export LLVM_CONFIG=/usr/lib/llvm-3.9/bin/llvm-config - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y - source ~/.profile @@ -53,6 +59,9 @@ matrix: - ccache - libdbus-glib-1-dev - libedit-dev + - libglib2.0-dev + - libxml2-dev + - libgtk-3-dev branches: only: From 4059e16a157d3fb77ab7601104252481fa27c627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 13 Jul 2018 11:27:20 +0200 Subject: [PATCH 62/87] Remove unneeded libxml2 and gtk deps and change gst binaries url --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92a53c6df04..3c1e3649fce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ matrix: - sudo add-apt-repository 'deb http://apt.llvm.org/precise/ llvm-toolchain-precise-3.9 main' -y - sudo apt-get update -q - sudo apt-get install clang-3.9 llvm-3.9 llvm-3.9-runtime -y - - curl -L https://people.freedesktop.org/~slomo/gstreamer.tar.gz | tar xz + - curl -L https://github.com/ferjm/gstreamer-1.14.1-ubuntu-trusty/raw/master/gstreamer.tar.gz | tar xz - sed -i "s;prefix=/root/gstreamer;prefix=$PWD/gstreamer;g" $PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig/*.pc - export PKG_CONFIG_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig - export GST_PLUGIN_SYSTEM_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/gstreamer-1.0 @@ -60,8 +60,6 @@ matrix: - libdbus-glib-1-dev - libedit-dev - libglib2.0-dev - - libxml2-dev - - libgtk-3-dev branches: only: From 1649b6a52871b032655df3945020d5d6111e1944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 13 Jul 2018 15:35:19 +0200 Subject: [PATCH 63/87] Fix build errors after rebase --- Cargo.lock | 378 +++++++++++++++++++++- components/fallible/Cargo.toml | 2 +- components/gfx/Cargo.toml | 2 +- components/layout/Cargo.toml | 2 +- components/script/Cargo.toml | 2 +- components/script/dom/baseaudiocontext.rs | 6 +- components/selectors/Cargo.toml | 2 +- components/style/Cargo.toml | 2 +- 8 files changed, 383 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d67aab91de..39e09ae30d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,6 +45,14 @@ dependencies = [ "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "array-init" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arrayvec" version = "0.4.6" @@ -250,6 +258,16 @@ dependencies = [ "alloc-no-stdlib 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "build_const" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byte-slice-cast" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.2.1" @@ -264,6 +282,24 @@ dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bzip2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "canvas" version = "0.0.1" @@ -525,6 +561,14 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crc" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-deque" version = "0.2.0" @@ -906,6 +950,11 @@ dependencies = [ "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fixedbitset" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "flate2" version = "1.0.1" @@ -913,6 +962,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1088,6 +1138,28 @@ dependencies = [ "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "glib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glib-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "glob" version = "0.2.11" @@ -1124,6 +1196,131 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gobject-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "muldiv 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-app" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-app-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-app-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-audio" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "array-init 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-audio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-audio-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-base" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-base-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gvr-sys" version = "0.7.0" @@ -1269,7 +1466,7 @@ dependencies = [ "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1785,6 +1982,26 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "miniz_oxide" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide_c_api" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mio" version = "0.6.12" @@ -1867,6 +2084,15 @@ dependencies = [ "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "msdos_time" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "msg" version = "0.0.1" @@ -1879,6 +2105,11 @@ dependencies = [ "webrender_api 0.57.2 (git+https://github.com/servo/webrender)", ] +[[package]] +name = "muldiv" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "net" version = "0.0.1" @@ -2026,11 +2257,11 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.1.36" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2140,6 +2371,11 @@ dependencies = [ "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "osmesa-src" version = "18.1.0-devel" @@ -2204,6 +2440,15 @@ name = "percent-encoding" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "petgraph" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "phf" version = "0.7.21" @@ -2266,6 +2511,11 @@ dependencies = [ "num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "podio" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -2342,6 +2592,11 @@ name = "quick-error" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "quote" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "quote" version = "0.5.1" @@ -2597,6 +2852,7 @@ dependencies = [ "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-media 0.1.0 (git+https://github.com/servo/media)", "servo_allocator 0.0.1", "servo_arc 0.1.1", "servo_atoms 0.0.1", @@ -2822,6 +3078,42 @@ dependencies = [ "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "servo-media" +version = "0.1.0" +source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +dependencies = [ + "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", + "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", +] + +[[package]] +name = "servo-media-audio" +version = "0.1.0" +source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +dependencies = [ + "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "servo_media_derive 0.1.0 (git+https://github.com/servo/media)", + "smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "servo-media-gstreamer" +version = "0.1.0" +source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +dependencies = [ + "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-app 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-audio 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", + "zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "servo-skia" version = "0.30000017.0" @@ -2914,6 +3206,15 @@ dependencies = [ "webrender_api 0.57.2 (git+https://github.com/servo/webrender)", ] +[[package]] +name = "servo_media_derive" +version = "0.1.0" +source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "servo_rand" version = "0.0.1" @@ -3165,6 +3466,16 @@ name = "swapper" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "syn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" version = "0.13.1" @@ -3185,6 +3496,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synstructure" version = "0.8.1" @@ -3372,6 +3691,11 @@ name = "unicode-width" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-xid" version = "0.1.0" @@ -3789,6 +4113,18 @@ dependencies = [ "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "zip" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" "checksum aho-corasick 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f0ba20154ea1f47ce2793322f049c5646cc6d0fa9759d5f333f286e507bf8080" @@ -3798,6 +4134,7 @@ dependencies = [ "checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" "checksum app_units 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c4720c83543de184d9f6add2fdb8e8031543497b8506620884c16e125b493c09" +"checksum array-init 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c3cc8456d0ae81a8c76f59e384683a601548c38949a4bfcb65dd31ded5c75ff3" "checksum arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0ef4a9820019a0c91d918918c93dc71d469f581a49b47ddc1d285d4270bbe2" "checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21" "checksum atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21e50800ec991574876040fff8ee46b136a53e985286fbe6a3bdfe6421b78860" @@ -3819,8 +4156,12 @@ dependencies = [ "checksum blurz 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e73bda0f4c71c63a047351070097f3f507e6718e86b9ee525173371ef7b94b73" "checksum brotli 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fe87b40996b84fdc56e57c165d93079f4b50cb806598118e692ddfaa3d3c57c0" "checksum brotli-decompressor 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "313f4b6cc0b365d6b88eda5aa40175ee34ac6efa9a79e0b3b8202eca90247ba8" +"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" +"checksum byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a865e7bfa6c3b79216ccba767d4dc66e4f9f65f1ed4639e73faff3c4a2485d7" "checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" "checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9" +"checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" +"checksum bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5162604199bbb17690ede847eaa6120a3f33d5ab4dcc8e7c25b16d849ae79b" "checksum caseless 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "808dab3318747be122cb31d36de18d4d1c81277a76f8332a02b81a3d73463d7f" "checksum cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9be26b24e988625409b19736d130f0c7d224f01d06454b5f81d8d23d6c1a618f" "checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d" @@ -3839,6 +4180,7 @@ dependencies = [ "checksum core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2a53cce0ddcf7e7e1f998738d757d5a3bf08bf799a180e50ebe50d298f52f5a" "checksum core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e54c4ab33705fa1fc8af375bb7929d68e1c1546c1ecef408966d8c3e49a1d84a" "checksum core-text 10.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f59bff773954e5cd058a3f5983406b52bec7cc65202bef340ba64a0c40ac91" +"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" @@ -3870,6 +4212,7 @@ dependencies = [ "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" "checksum euclid 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59b34ec7d95d70d5cda27301d6182bc17abce8b5b52e260f5ff32c677923bbb0" "checksum expat-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c470ccb972f2088549b023db8029ed9da9426f5affbf9b62efff7009ab8ed5b1" +"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909" "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" "checksum fontsan 0.4.0 (git+https://github.com/servo/fontsan)" = "" @@ -3886,9 +4229,20 @@ dependencies = [ "checksum gif 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3414b424657317e708489d2857d9575f4403698428b040b609b9d1c1a84a2c" "checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a" "checksum gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d41e7ac812597988fdae31c9baec3c6d35cadb8ad9ab88a9bf9c0f119ed66c2" +"checksum glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e0be1b1432e227bcd1a9b28db9dc1474a7e7fd4227e08e16f35304f32d09b61" +"checksum glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615bef979b5838526aee99241afc80cfb2e34a8735d4bcb8ec6072598c18a408" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a70c5fe78efbd5a3b243a804ea1032053c584510f8822819f94cfb29b2100317" "checksum glx 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "63a6e7c2846e12626455f45ebaff9d92161436dd0fa703d9d198012e528ca7b9" +"checksum gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70409d6405db8b1591602fcd0cbe8af52cd9976dd39194442b4c149ba343f86d" +"checksum gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a7fcbc083ea31ca8aee35b78ca5eb00af9a59bd765508d8fa836cfb1a4fbb4dd" +"checksum gstreamer-app 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4e68d96a6a86fe4e4796d7ecb5a3cacd6b4680277da6daea7934612fa8c5c2bf" +"checksum gstreamer-app-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a224d33c7780957c30f9280b1256b3882792dda6916f75b54bb30b5b71ed505a" +"checksum gstreamer-audio 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "73a7b9c097e8d6fc1967137b574e2d4c646220bcfdd00ba681822e297cb06cb8" +"checksum gstreamer-audio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd60631f2dd055f0aae2831e86bd6c1d45e24528d4c478002cc07490dd84b56e" +"checksum gstreamer-base 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec7a84b4160b61c72ea27ccf3f46eb9c8f996c5991746623e69e3e532e3cb5" +"checksum gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "501a7add44f256aab6cb5b65ef121c449197cf55087d6a7586846c8d1e42e88b" +"checksum gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b2f51e25a6f97dd4bfd640cba96f192f8759b8766afd66d6d9ea0f82ca14a37" "checksum gvr-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1334b94d8ce67319ddc44663daef53d8c1538629a11562530c981dbd9085b9a" "checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f" "checksum harfbuzz-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bad27f59fc853bb88eca58088d469cd365ff0ccf362d24c4b1c0cbb1b21b3489" @@ -3939,6 +4293,8 @@ dependencies = [ "checksum mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d69889cdc6336ed56b174514ce876c4c3dc564cc23dd872e7bca589bb2a36c8" "checksum mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76da6df85047af8c0edfa53f48eb1073012ce1cc95c8fedc0a374f659a89dd65" "checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" +"checksum miniz_oxide 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9ba430291c9d6cedae28bcd2d49d1c32fc57d60cd49086646c5dd5673a870eb5" +"checksum miniz_oxide_c_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5a5b8234d6103ebfba71e29786da4608540f862de5ce980a1c94f86a40ca0d51" "checksum mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "75f72a93f046f1517e3cfddc0a096eb756a2ba727d36edc8227dee769a50a9b0" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f" @@ -3947,6 +4303,8 @@ dependencies = [ "checksum mozjs_sys 0.51.4 (registry+https://github.com/rust-lang/crates.io-index)" = "74fd4388f18e64881a63ff773edd77dec47adf63bfd6a3055e5f106e1f7c9eaf" "checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de" "checksum mp4parse 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f821e3799bc0fd16d9b861fb02fa7ee1b5fba29f45ad591dade105c48ca9a1a0" +"checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729" +"checksum muldiv 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cbef5aa2e8cd82a18cc20e26434cc9843e1ef46e55bfabe5bddb022236c5b3e" "checksum net2 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "bc01404e7568680f1259aa5729539f221cb1e6d047a0d9053cab4be8a73b5d67" "checksum new-ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ccbebba6fb53a6d2bdcfaf79cb339bc136dee3bfff54dc337a334bafe36476a" "checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" @@ -3956,7 +4314,7 @@ dependencies = [ "checksum num-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2c31b75c36a993d30c7a13d70513cb93f02acafdd5b7ba250f9b0e18615de7" "checksum num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac0ea58d64a89d9d6b7688031b3be9358d6c919badcf7fbb0527ccfd891ee45" "checksum num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d1891bd7b936f12349b7d1403761c8a0b85a18b148e9da4429d5d102c1a41e" -"checksum num-rational 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "c2dc5ea04020a8f18318ae485c751f8cfa1c0e69dcf465c29ddaaa64a313cc44" +"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775393e285254d2f5004596d69bb8bc1149754570dcc08cf30cabeba67955e28" "checksum num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca313f1862c7ec3e0dfe8ace9fa91b1d9cb5c84ace3d00f5ec4216238e93c167" @@ -3968,6 +4326,7 @@ dependencies = [ "checksum ogg_metadata 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fc665717454399cba557c55ad226148996e9266ee291f8a37a98bb2cded0a490" "checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985" "checksum openssl-sys 0.9.27 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdc5c4a02e69ce65046f1763a0181107038e02176233acb0b3351d7cc588f9" +"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum osmesa-src 18.1.0-devel (git+https://github.com/servo/osmesa-src)" = "" "checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" "checksum ovr-mobile-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a69b517feac6fc640f0679625defa0998bbcb32871a6901e63063c2abf9c4cbe" @@ -3977,6 +4336,7 @@ dependencies = [ "checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79" "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356" +"checksum petgraph 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8b30dc85588cd02b9b76f5e386535db546d21dc68506cff2abebee0b6445e8e4" "checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc" "checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f" "checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" @@ -3984,11 +4344,13 @@ dependencies = [ "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum plane-split 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e14382aabad89085fbf714f75d527492bb672725facb9b2ced2fada47cf418c" "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b" +"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4" "checksum proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6" "checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0ff51282f28dc1b53fd154298feaa2e77c5ea0dba68e1fd8b03b72fbe13d2a" "checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" @@ -4021,8 +4383,12 @@ dependencies = [ "checksum servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93f799b649b4a2bf362398910eca35240704c7e765e780349b2bb1070d892262" "checksum servo-fontconfig-sys 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "38b494f03009ee81914b0e7d387ad7c145cafcd69747c2ec89b0e17bb94f303a" "checksum servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9232032c2e85118c0282c6562c84cab12316e655491ba0a5d1905b2320060d1b" +"checksum servo-media 0.1.0 (git+https://github.com/servo/media)" = "" +"checksum servo-media-audio 0.1.0 (git+https://github.com/servo/media)" = "" +"checksum servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)" = "" "checksum servo-skia 0.30000017.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe33a2592a74f2096daf70bcbee39f2d183efcdc81f536a28af3a357baa6f5b0" "checksum servo-websocket 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6bac1e2295e72f0525147d993c626761811acf0441dac1cee8707f12dc7f3363" +"checksum servo_media_derive 0.1.0 (git+https://github.com/servo/media)" = "" "checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" "checksum shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8254bf098ce4d8d7cc7cc6de438c5488adc5297e5b7ffef88816c0a91bd289c1" "checksum sig 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6649e43c1a1e68d29ed56d0dc3b5b6cf3b901da77cf107c4066b9e3da036df5" @@ -4038,8 +4404,10 @@ dependencies = [ "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" "checksum swapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e454d048db5527d000bfddb77bd072bbf3a1e2ae785f16d9bd116e07c2ab45eb" +"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91b52877572087400e83d24b9178488541e3d535259e04ff17a63df1e5ceff59" "checksum syn 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c67da57e61ebc7b7b6fff56bb34440ca3a83db037320b0507af4c10368deda7d" +"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "98cad891cd238c98e1f0aec9f7c0f620aa696e4e5f7daba56ac67b5e86a6b049" "checksum tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "47776f63b85777d984a50ce49d6b9e58826b6a3766a449fc95bc66cd5663c15b" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" @@ -4064,6 +4432,7 @@ dependencies = [ "checksum unicode-script 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8bd7bbf020b2885113e6304f68bcc33881c5552657c58d4e9699cd1b6606e81" "checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2" @@ -4102,3 +4471,4 @@ dependencies = [ "checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1" "checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" "checksum xml5ever 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead952cf8bab253fb5cb56e1fff780747bbf7a7258fb0451afe645a166050b1f" +"checksum zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "77ce0ceee93c995954a31f77903925a6a8bb094709445238e344f2107910e29e" diff --git a/components/fallible/Cargo.toml b/components/fallible/Cargo.toml index e8f5314693b..176355acd38 100644 --- a/components/fallible/Cargo.toml +++ b/components/fallible/Cargo.toml @@ -10,7 +10,7 @@ name = "fallible" path = "lib.rs" [dependencies] -smallvec = "0.6" +smallvec = "0.6.2" hashglobe = { path = "../hashglobe" } # This crate effectively does nothing except if the `known_system_malloc` diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index bf28a533a55..3133d38399e 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -36,7 +36,7 @@ serde = "1.0" servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} servo_url = {path = "../url"} -smallvec = "0.6" +smallvec = "0.6.2" style = {path = "../style"} time = "0.1.12" unicode-bidi = {version = "0.3", features = ["with_serde"]} diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 4d45cd33439..333c953127c 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -42,7 +42,7 @@ servo_geometry = {path = "../geometry"} serde_json = "1.0" servo_config = {path = "../config"} servo_url = {path = "../url"} -smallvec = "0.6" +smallvec = "0.6.2" style = {path = "../style", features = ["servo"]} style_traits = {path = "../style_traits"} unicode-bidi = {version = "0.3", features = ["with_serde"]} diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index f33735d5435..94ea5aed04a 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -90,7 +90,7 @@ servo_geometry = {path = "../geometry" } servo-media = {git = "https://github.com/servo/media"} servo_rand = {path = "../rand"} servo_url = {path = "../url"} -smallvec = "0.6" +smallvec = "0.6.2" style = {path = "../style", features = ["servo"]} style_traits = {path = "../style_traits"} swapper = "0.1" diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 001e8c84efa..683fecf4576 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -43,7 +43,7 @@ use std::collections::{HashMap, VecDeque}; use std::mem; use std::rc::Rc; use std::sync::{Arc, Mutex}; -use task_source::TaskSource; +use task_source::{TaskSource, TaskSourceName}; use uuid::Uuid; #[allow(dead_code)] @@ -380,8 +380,8 @@ impl BaseAudioContextMethods for BaseAudioContext { let this_ = this.clone(); let task_source = window.dom_manipulation_task_source(); let task_source_ = window.dom_manipulation_task_source(); - let canceller = window.task_canceller(); - let canceller_ = window.task_canceller(); + let canceller = window.task_canceller(TaskSourceName::DOMManipulation); + let canceller_ = window.task_canceller(TaskSourceName::DOMManipulation); let callbacks = AudioDecoderCallbacks::new() .eos(move || { let _ = task_source.queue_with_canceller( diff --git a/components/selectors/Cargo.toml b/components/selectors/Cargo.toml index 19adcdd1578..e8b4fbe2fe3 100644 --- a/components/selectors/Cargo.toml +++ b/components/selectors/Cargo.toml @@ -28,7 +28,7 @@ fnv = "1.0" phf = "0.7.18" precomputed-hash = "0.1" servo_arc = { version = "0.1", path = "../servo_arc" } -smallvec = "0.6" +smallvec = "0.6.2" [build-dependencies] phf_codegen = "0.7.18" diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index 7e8c40dde11..b7ae360c933 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -60,7 +60,7 @@ servo_arc = { path = "../servo_arc" } servo_atoms = {path = "../atoms", optional = true} servo_config = {path = "../config", optional = true} smallbitvec = "2.1.1" -smallvec = "0.6" +smallvec = "0.6.2" string_cache = { version = "0.7", optional = true } style_derive = {path = "../style_derive"} style_traits = {path = "../style_traits"} From 477907e578b5cbba44fe0df8b8fb329bec7005ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 13 Jul 2018 21:49:11 +0200 Subject: [PATCH 64/87] Do not copy initial data during AudioBuffer construction and use JS_DetachArrayBuffer --- components/script/dom/audiobuffer.rs | 41 +++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 7475bccb8a6..356472a2107 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -11,7 +11,7 @@ use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; -use js::jsapi::{Heap, JSContext, JSObject, JS_StealArrayBufferContents}; +use js::jsapi::{DetachDataDisposition, Heap, JSContext, JSObject, JS_DetachArrayBuffer}; use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; @@ -42,26 +42,31 @@ impl AudioBuffer { sample_rate: f32, initial_data: Option<&[f32]>, ) -> AudioBuffer { - let initial_data = match initial_data { - Some(initial_data) => { - let mut data = vec![]; - data.extend_from_slice(initial_data); - data - }, - None => vec![0.; (length * number_of_channels) as usize], - }; let cx = global.get_cx(); let mut js_channels: Vec = Vec::with_capacity(number_of_channels as usize); for channel in 0..number_of_channels { rooted!(in (cx) let mut array = ptr::null_mut::()); let offset = (channel * length) as usize; - let _ = unsafe { - Float32Array::create( - cx, - CreateWith::Slice(&initial_data.as_slice()[offset..offset + (length as usize)]), - array.handle_mut(), - ) - }; + match initial_data { + Some(data) => { + let _ = unsafe { + Float32Array::create( + cx, + CreateWith::Slice(&data[offset..offset + (length as usize) - 1]), + array.handle_mut(), + ) + }; + }, + None => { + let _ = unsafe { + Float32Array::create( + cx, + CreateWith::Slice(&vec![0.; length as usize]), + array.handle_mut(), + ) + }; + } + } let js_channel = Heap::default(); js_channel.set(array.get()); js_channels.push(js_channel); @@ -151,10 +156,8 @@ impl AudioBuffer { let channel_data = unsafe { typedarray!(in(cx) let array: Float32Array = channel.get()); if let Ok(array) = array { - // XXX TypedArrays API does not expose a way to steal the buffer's - // content. let data = array.to_vec(); - let _ = JS_StealArrayBufferContents(cx, channel.handle()); + let _ = JS_DetachArrayBuffer(cx, channel.handle(), DetachDataDisposition::KeepData); data } else { return None; From fe18200bfce3beb283696362c5285853dd53995c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 13 Jul 2018 13:02:07 -0700 Subject: [PATCH 65/87] Update media dep, fix duplicate syn dependency --- Cargo.lock | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39e09ae30d7..5fec507ba9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2592,11 +2592,6 @@ name = "quick-error" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "quote" version = "0.5.1" @@ -3081,7 +3076,7 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", @@ -3090,7 +3085,7 @@ dependencies = [ [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3102,7 +3097,7 @@ dependencies = [ [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3209,10 +3204,10 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#4d64916cc53193fce11f0f7516b7a9c1e1bab009" +source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3466,16 +3461,6 @@ name = "swapper" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "syn" version = "0.13.1" @@ -3496,14 +3481,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "synstructure" version = "0.8.1" @@ -3691,11 +3668,6 @@ name = "unicode-width" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.1.0" @@ -4350,7 +4322,6 @@ dependencies = [ "checksum proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6" "checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0ff51282f28dc1b53fd154298feaa2e77c5ea0dba68e1fd8b03b72fbe13d2a" "checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" @@ -4404,10 +4375,8 @@ dependencies = [ "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" "checksum swapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e454d048db5527d000bfddb77bd072bbf3a1e2ae785f16d9bd116e07c2ab45eb" -"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91b52877572087400e83d24b9178488541e3d535259e04ff17a63df1e5ceff59" "checksum syn 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c67da57e61ebc7b7b6fff56bb34440ca3a83db037320b0507af4c10368deda7d" -"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "98cad891cd238c98e1f0aec9f7c0f620aa696e4e5f7daba56ac67b5e86a6b049" "checksum tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "47776f63b85777d984a50ce49d6b9e58826b6a3766a449fc95bc66cd5663c15b" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" @@ -4432,7 +4401,6 @@ dependencies = [ "checksum unicode-script 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8bd7bbf020b2885113e6304f68bcc33881c5552657c58d4e9699cd1b6606e81" "checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2" From c617ca0d30552b01e2eb99ca28c8365f10c1a05c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 16 Jul 2018 10:44:08 +0200 Subject: [PATCH 66/87] Remove commented code --- components/script/dom/audiobuffer.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 356472a2107..02707018c06 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -237,7 +237,6 @@ impl AudioBufferMethods for AudioBuffer { let channel_number = channel_number as usize; let offset = start_in_channel as usize; let mut dest = Vec::with_capacity(destination.len()); - // let destination = unsafe { destination.as_mut_slice() }; // We either copy form js_channels or shared_channels. From 596640595c01812b36b4fa7ad20b59b53ada8a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 18 Jul 2018 12:28:43 +0200 Subject: [PATCH 67/87] Root JS channels during AudioBuffer construction --- components/script/dom/audiobuffer.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 02707018c06..b56cc859d46 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -17,6 +17,7 @@ use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; use std::cmp::min; use std::ptr::{self, NonNull}; +use std::mem; type JSAudioChannel = Heap<*mut JSObject>; @@ -43,7 +44,7 @@ impl AudioBuffer { initial_data: Option<&[f32]>, ) -> AudioBuffer { let cx = global.get_cx(); - let mut js_channels: Vec = Vec::with_capacity(number_of_channels as usize); + rooted_vec!(let mut js_channels_); for channel in 0..number_of_channels { rooted!(in (cx) let mut array = ptr::null_mut::()); let offset = (channel * length) as usize; @@ -69,11 +70,13 @@ impl AudioBuffer { } let js_channel = Heap::default(); js_channel.set(array.get()); - js_channels.push(js_channel); + js_channels_.push(js_channel); } + let js_channels = DomRefCell::new(Vec::new()); + mem::swap(&mut *js_channels.borrow_mut(), &mut *js_channels_); AudioBuffer { reflector_: Reflector::new(), - js_channels: DomRefCell::new(js_channels), + js_channels, shared_channels: DomRefCell::new(ServoMediaAudioBuffer::new( number_of_channels as u8, length as usize, From c9ff1b9f57a79dab7747be6a16053dc85796a5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 19 Jul 2018 09:43:02 +0200 Subject: [PATCH 68/87] Enter compartment during AudioBuffer creation --- components/script/dom/audiobuffer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index b56cc859d46..f8def4b7375 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -11,7 +11,7 @@ use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; -use js::jsapi::{DetachDataDisposition, Heap, JSContext, JSObject, JS_DetachArrayBuffer}; +use js::jsapi::{DetachDataDisposition, Heap, JSAutoCompartment, JSContext, JSObject, JS_DetachArrayBuffer}; use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; @@ -44,6 +44,7 @@ impl AudioBuffer { initial_data: Option<&[f32]>, ) -> AudioBuffer { let cx = global.get_cx(); + let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get()); rooted_vec!(let mut js_channels_); for channel in 0..number_of_channels { rooted!(in (cx) let mut array = ptr::null_mut::()); From acb03603b6005574c35f544fdc2f0b895d5586a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 19 Jul 2018 11:51:10 +0200 Subject: [PATCH 69/87] Fire AudioScheduledSourceNode.onended when playback stops --- Cargo.lock | 9 +++--- components/atoms/static_atoms.txt | 1 + components/script/dom/audiobuffer.rs | 2 +- .../script/dom/audioscheduledsourcenode.rs | 32 ++++++++++++++++++- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5fec507ba9c..e2f9b819454 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3076,7 +3076,7 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" +source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", @@ -3085,7 +3085,7 @@ dependencies = [ [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" +source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3097,13 +3097,12 @@ dependencies = [ [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" +source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-app 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-audio 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3204,7 +3203,7 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#6403c703ac7411f5d3b18f5edc5889cf1cbceb09" +source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" dependencies = [ "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/atoms/static_atoms.txt b/components/atoms/static_atoms.txt index cf8eb460383..41ff8000073 100644 --- a/components/atoms/static_atoms.txt +++ b/components/atoms/static_atoms.txt @@ -19,6 +19,7 @@ datetime-local dir email emptied +ended error fantasy fetch diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index f8def4b7375..150a8d53ea4 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -16,8 +16,8 @@ use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; use std::cmp::min; -use std::ptr::{self, NonNull}; use std::mem; +use std::ptr::{self, NonNull}; type JSAudioChannel = Heap<*mut JSObject>; diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index 45a091dcf18..c8ecf9a8fda 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -6,10 +6,15 @@ use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use dom::bindings::error::{Error, Fallible}; +use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; +use dom::bindings::refcounted::Trusted; +use dom::bindings::reflector::DomObject; use dom_struct::dom_struct; use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit, AudioScheduledSourceNodeMessage}; +use servo_media::audio::node::OnEndedCallback; use std::cell::Cell; +use task_source::{TaskSource, TaskSourceName}; #[dom_struct] pub struct AudioScheduledSourceNode { @@ -51,7 +56,6 @@ impl AudioScheduledSourceNode { impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-onended - // XXX We should dispatch this when we reach the end. Depends on servo-media #82. event_handler!(ended, GetOnended, SetOnended); // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start @@ -59,6 +63,32 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { if self.started.get() || self.stopped.get() { return Err(Error::InvalidState); } + + let this = Trusted::new(self); + let global = self.global(); + let window = global.as_window(); + let task_source = window.dom_manipulation_task_source(); + let canceller = window.task_canceller(TaskSourceName::DOMManipulation); + let callback = OnEndedCallback::new(move || { + let _ = task_source.queue_with_canceller( + task!(ended: move || { + let this = this.root(); + let global = this.global(); + let window = global.as_window(); + window.dom_manipulation_task_source().queue_simple_event( + this.upcast(), + atom!("ended"), + &window + ); + }), + &canceller, + ); + }); + + self.node().message( + AudioNodeMessage::AudioScheduledSourceNode( + AudioScheduledSourceNodeMessage::RegisterOnEndedCallback(callback))); + self.started.set(true); self.node .message(AudioNodeMessage::AudioScheduledSourceNode( From 841fedda4fb7010c1508d35cdf30abe59245b8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 19 Jul 2018 14:07:52 +0200 Subject: [PATCH 70/87] Bump pkg-config version --- Cargo.lock | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2f9b819454..51549470b32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -865,7 +865,7 @@ version = "0.3.0" source = "git+https://github.com/energymon/energymon-sys.git#f8d77ea2906b25f9c0fd358aa9d300a46dc3e97c" dependencies = [ "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -939,7 +939,7 @@ version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1157,7 +1157,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1204,7 +1204,7 @@ dependencies = [ "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1250,7 +1250,7 @@ dependencies = [ "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1279,7 +1279,7 @@ dependencies = [ "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1306,7 +1306,7 @@ dependencies = [ "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1318,7 +1318,7 @@ dependencies = [ "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1338,7 +1338,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1365,7 +1365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1730,7 +1730,7 @@ name = "libdbus-sys" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1791,7 +1791,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2367,7 +2367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2486,7 +2486,7 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -3060,7 +3060,7 @@ version = "4.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "expat-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3070,7 +3070,7 @@ version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4029,7 +4029,7 @@ version = "2.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4048,7 +4048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4312,7 +4312,7 @@ dependencies = [ "checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f" "checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" "checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2" -"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" +"checksum pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "6a52e4dbc8354505ee07e484ab07127e06d87ca6fa7f0a516a2b294e5ad5ad16" "checksum plane-split 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e14382aabad89085fbf714f75d527492bb672725facb9b2ced2fada47cf418c" "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" From 00014b3f16c8d5c13026ab538469809134297d82 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 19 Jul 2018 14:46:23 -0700 Subject: [PATCH 71/87] Add AudioParam connection support --- Cargo.lock | 8 +++---- components/script/dom/audionode.rs | 32 +++++++++++++++++++++----- components/script/dom/audioparam.rs | 12 ++++++++++ components/script/dom/bindings/root.rs | 7 ++++++ 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 51549470b32..ae734a32cd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3076,7 +3076,7 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" +source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", @@ -3085,7 +3085,7 @@ dependencies = [ [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" +source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3097,7 +3097,7 @@ dependencies = [ [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" +source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3203,7 +3203,7 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748" +source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" dependencies = [ "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index 3f4093d08c5..d193c9d77d9 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -97,8 +97,22 @@ impl AudioNodeMethods for AudioNode { } // https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output - fn Connect_(&self, _: &AudioParam, _: u32) -> Fallible<()> { - // TODO + fn Connect_(&self, dest: &AudioParam, output: u32) -> Fallible<()> { + if self.context != dest.context() { + return Err(Error::InvalidAccess); + } + + if output >= self.NumberOfOutputs() { + return Err(Error::IndexSize); + } + + // servo-media takes care of ignoring duplicated connections. + + self.context.audio_context_impl().connect_ports( + self.node_id().output(output), + dest.node_id().param(dest.param_type()), + ); + Ok(()) } @@ -143,14 +157,20 @@ impl AudioNodeMethods for AudioNode { } // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect_____(&self, _: &AudioParam) -> ErrorResult { - // TODO + fn Disconnect_____(&self, param: &AudioParam) -> ErrorResult { + self.context + .audio_context_impl() + .disconnect_to(self.node_id(), + param.node_id().param(param.param_type())); Ok(()) } // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect______(&self, _: &AudioParam, _: u32) -> ErrorResult { - // TODO + fn Disconnect______(&self, param: &AudioParam, out: u32) -> ErrorResult { + self.context + .audio_context_impl() + .disconnect_output_between_to(self.node_id().output(out), + param.node_id().param(param.param_type())); Ok(()) } diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index 964d4264d7f..db73619180f 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -78,6 +78,18 @@ impl AudioParam { fn message_node(&self, message: AudioNodeMessage) { self.context.audio_context_impl().message_node(self.node, message); } + + pub fn context(&self) -> &BaseAudioContext { + &self.context + } + + pub fn node_id(&self) -> NodeId { + self.node + } + + pub fn param_type(&self) -> ParamType { + self.param + } } impl AudioParamMethods for AudioParam { diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 18cb0062023..f8336e6a85d 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -423,6 +423,13 @@ impl PartialEq for Dom { } } +impl<'a, T: DomObject> PartialEq<&'a T> for Dom { + fn eq(&self, other: &&'a T) -> bool { + *self == Dom::from_ref(*other) + } +} + + impl Eq for Dom {} impl PartialEq for LayoutDom { From 572c04c8337da9385d569a5e270a5dc6c1fac23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 20 Jul 2018 10:41:58 +0200 Subject: [PATCH 72/87] Add deps to appveyor --- appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 532034f191e..00b6738c2d8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,6 +43,10 @@ cache: - .ccache install: + - appveyor-retry appveyor DownloadFile https://gstreamer.freedesktop.org/data/pkg/windows/1.14.1/gstreamer-1.0-devel-x86_64-1.14.1.msi + - appveyor-retry appveyor DownloadFile https://gstreamer.freedesktop.org/data/pkg/windows/1.14.1/gstreamer-1.0-x86_64-1.14.1.msi + - msiexec /i gstreamer-1.0-devel-x86_64-1.14.1.msi /quiet /qn /norestart /log install-devel.log + - msiexec /i gstreamer-1.0-x86_64-1.14.1.msi /quiet /qn /norestart /log install.log - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain none - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin From 75dd050e57043ab09bc5f14e5e335dabd50df879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 20 Jul 2018 11:43:12 +0200 Subject: [PATCH 73/87] Fix rebase mistake --- components/script/dom/bindings/trace.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index ecccb7d2180..5cdb84fba26 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -434,7 +434,6 @@ unsafe_no_jsmanaged_fields!(InteractiveMetrics); unsafe_no_jsmanaged_fields!(InteractiveWindow); unsafe_no_jsmanaged_fields!(CanvasId); unsafe_no_jsmanaged_fields!(SourceSet); -unsafe_no_jsmanaged_fields!(AudioGraph); unsafe_no_jsmanaged_fields!(AudioBuffer); unsafe_no_jsmanaged_fields!(AudioContext); unsafe_no_jsmanaged_fields!(NodeId); From e0341594231d887672b16f3d4d613a2e382b6487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 23 Jul 2018 09:15:50 +0200 Subject: [PATCH 74/87] Set env vars to let the build know where GStreamer libs are --- appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 00b6738c2d8..46f0dc9715e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,6 +43,7 @@ cache: - .ccache install: + - choco install pkgconfiglite - appveyor-retry appveyor DownloadFile https://gstreamer.freedesktop.org/data/pkg/windows/1.14.1/gstreamer-1.0-devel-x86_64-1.14.1.msi - appveyor-retry appveyor DownloadFile https://gstreamer.freedesktop.org/data/pkg/windows/1.14.1/gstreamer-1.0-x86_64-1.14.1.msi - msiexec /i gstreamer-1.0-devel-x86_64-1.14.1.msi /quiet /qn /norestart /log install-devel.log @@ -50,6 +51,9 @@ install: - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain none - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin + - set PKG_CONFIG_PATH=%PKG_CONFIG_PATH%;C:\gstreamer\1.0\x86_64\lib\pkgconfig + - set LIB=C:\gstreamer\1.0\x86_64\lib + - set LIBPATH=C:\gstreamer\1.0\x86_64\lib - rustup -V - mach rustc --version - mach cargo --version From 6aaf5806b1adfaeef5b1ef7bc33d243f56db1ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 27 Jul 2018 16:44:36 +0200 Subject: [PATCH 75/87] OfflineAudioContext --- Cargo.lock | 85 ++++++++- components/atoms/static_atoms.txt | 1 + components/script/dom/audiobuffer.rs | 9 +- components/script/dom/audiocontext.rs | 13 +- components/script/dom/baseaudiocontext.rs | 54 +++--- components/script/dom/mod.rs | 2 + .../script/dom/offlineaudiocompletionevent.rs | 77 ++++++++ components/script/dom/offlineaudiocontext.rs | 178 ++++++++++++++++++ .../OfflineAudioCompletionEvent.webidl | 17 ++ .../dom/webidls/OfflineAudioContext.webidl | 24 +++ 10 files changed, 424 insertions(+), 36 deletions(-) create mode 100644 components/script/dom/offlineaudiocompletionevent.rs create mode 100644 components/script/dom/offlineaudiocontext.rs create mode 100644 components/script/dom/webidls/OfflineAudioCompletionEvent.webidl create mode 100644 components/script/dom/webidls/OfflineAudioContext.webidl diff --git a/Cargo.lock b/Cargo.lock index ae734a32cd0..df2e1fddf83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1309,6 +1309,35 @@ dependencies = [ "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gstreamer-player" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-player-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-video 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-player-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-video-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gstreamer-sys" version = "0.5.0" @@ -1321,6 +1350,37 @@ dependencies = [ "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gstreamer-video" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-video-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-video-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gvr-sys" version = "0.7.0" @@ -3076,38 +3136,48 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" +source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", + "servo-media-player 0.1.0 (git+https://github.com/servo/media)", ] [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" +source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "servo_media_derive 0.1.0 (git+https://github.com/servo/media)", - "smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" +source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-app 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-audio 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-player 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", + "servo-media-player 0.1.0 (git+https://github.com/servo/media)", "zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "servo-media-player" +version = "0.1.0" +source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" + [[package]] name = "servo-skia" version = "0.30000017.0" @@ -3203,7 +3273,7 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf" +source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" dependencies = [ "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4213,7 +4283,11 @@ dependencies = [ "checksum gstreamer-audio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd60631f2dd055f0aae2831e86bd6c1d45e24528d4c478002cc07490dd84b56e" "checksum gstreamer-base 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec7a84b4160b61c72ea27ccf3f46eb9c8f996c5991746623e69e3e532e3cb5" "checksum gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "501a7add44f256aab6cb5b65ef121c449197cf55087d6a7586846c8d1e42e88b" +"checksum gstreamer-player 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "63e81d78e9e7ee5d448ba50c52722005bbbf1bfe606767c4c407f45e8996f050" +"checksum gstreamer-player-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b9476078cc76164446e88b2c4331e81e24a07f7b7c3a8b4bf8975a47998ebd4" "checksum gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b2f51e25a6f97dd4bfd640cba96f192f8759b8766afd66d6d9ea0f82ca14a37" +"checksum gstreamer-video 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75300cf1ed8d8d65811349fc755fac22be05ea55df551ab29e43664d4a575c92" +"checksum gstreamer-video-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed798787e78a0f1c8be06bd3adcab03f962f049a820743aae9f690f56a0d538" "checksum gvr-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1334b94d8ce67319ddc44663daef53d8c1538629a11562530c981dbd9085b9a" "checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f" "checksum harfbuzz-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bad27f59fc853bb88eca58088d469cd365ff0ccf362d24c4b1c0cbb1b21b3489" @@ -4356,6 +4430,7 @@ dependencies = [ "checksum servo-media 0.1.0 (git+https://github.com/servo/media)" = "" "checksum servo-media-audio 0.1.0 (git+https://github.com/servo/media)" = "" "checksum servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)" = "" +"checksum servo-media-player 0.1.0 (git+https://github.com/servo/media)" = "" "checksum servo-skia 0.30000017.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe33a2592a74f2096daf70bcbee39f2d183efcdc81f536a28af3a357baa6f5b0" "checksum servo-websocket 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6bac1e2295e72f0525147d993c626761811acf0441dac1cee8707f12dc7f3363" "checksum servo_media_derive 0.1.0 (git+https://github.com/servo/media)" = "" diff --git a/components/atoms/static_atoms.txt b/components/atoms/static_atoms.txt index 41ff8000073..f60c497cf2e 100644 --- a/components/atoms/static_atoms.txt +++ b/components/atoms/static_atoms.txt @@ -12,6 +12,7 @@ checkbox click close color +complete controllerchange cursive date diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 150a8d53ea4..3f1c5f2f441 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -19,6 +19,11 @@ use std::cmp::min; use std::mem; use std::ptr::{self, NonNull}; +// This range is defined by the spec. +// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer +pub const MIN_SAMPLE_RATE: f32 = 8000.; +pub const MAX_SAMPLE_RATE: f32 = 96000.; + type JSAudioChannel = Heap<*mut JSObject>; #[dom_struct] @@ -112,7 +117,9 @@ impl AudioBuffer { window: &Window, options: &AudioBufferOptions, ) -> Fallible> { - if options.numberOfChannels > MAX_CHANNEL_COUNT { + if options.numberOfChannels > MAX_CHANNEL_COUNT || + *options.sampleRate < MIN_SAMPLE_RATE || + *options.sampleRate > MAX_SAMPLE_RATE { return Err(Error::NotSupported); } Ok(AudioBuffer::new( diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 24df81b0f54..ec43498e29c 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -14,7 +14,6 @@ use dom::bindings::num::Finite; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::root::DomRoot; -use dom::globalscope::GlobalScope; use dom::promise::Promise; use dom::window::Window; use dom_struct::dom_struct; @@ -35,10 +34,9 @@ pub struct AudioContext { impl AudioContext { #[allow(unrooted_must_root)] // https://webaudio.github.io/web-audio-api/#AudioContext-constructors - fn new_inherited(global: &GlobalScope, options: &AudioContextOptions) -> AudioContext { + fn new_inherited(options: &AudioContextOptions) -> AudioContext { // Steps 1-3. let context = BaseAudioContext::new_inherited( - global, BaseAudioContextOptions::AudioContext(options.into()), ); @@ -61,9 +59,9 @@ impl AudioContext { } #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope, options: &AudioContextOptions) -> DomRoot { - let context = AudioContext::new_inherited(global, options); - let context = reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap); + pub fn new(window: &Window, options: &AudioContextOptions) -> DomRoot { + let context = AudioContext::new_inherited(options); + let context = reflect_dom_object(Box::new(context), window, AudioContextBinding::Wrap); context.resume(); context } @@ -73,8 +71,7 @@ impl AudioContext { window: &Window, options: &AudioContextOptions, ) -> Fallible> { - let global = window.upcast::(); - Ok(AudioContext::new(global, options)) + Ok(AudioContext::new(window, options)) } fn resume(&self) { diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 683fecf4576..583b1690048 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -26,7 +26,6 @@ use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::domexception::{DOMErrorName, DOMException}; use dom::eventtarget::EventTarget; use dom::gainnode::GainNode; -use dom::globalscope::GlobalScope; use dom::oscillatornode::OscillatorNode; use dom::promise::Promise; use dom::window::Window; @@ -34,7 +33,7 @@ use dom_struct::dom_struct; use js::rust::CustomAutoRooterGuard; use js::typedarray::ArrayBuffer; use servo_media::{Backend, ServoMedia}; -use servo_media::audio::context::{AudioContext, ProcessingState}; +use servo_media::audio::context::{AudioContext, AudioContextOptions, ProcessingState}; use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions}; use servo_media::audio::decoder::AudioDecoderCallbacks; use servo_media::audio::graph::NodeId; @@ -83,18 +82,17 @@ pub struct BaseAudioContext { /// throw when trying to do things on the context when the context has just /// been "closed()". state: Cell, + channel_count: u32, } impl BaseAudioContext { #[allow(unrooted_must_root)] - pub fn new_inherited(_: &GlobalScope, options: BaseAudioContextOptions) -> BaseAudioContext { - let options = match options { - BaseAudioContextOptions::AudioContext(options) => options, - BaseAudioContextOptions::OfflineAudioContext(_) => unimplemented!(), + pub fn new_inherited(options: BaseAudioContextOptions) -> BaseAudioContext { + let (sample_rate, channel_count) = match options { + BaseAudioContextOptions::AudioContext(ref opt) => (opt.sample_rate, 2), + BaseAudioContextOptions::OfflineAudioContext(ref opt) => (opt.sample_rate, opt.channels), }; - let sample_rate = options.sample_rate; - let context = BaseAudioContext { eventtarget: EventTarget::new_inherited(), audio_context_impl: Rc::new( @@ -108,6 +106,7 @@ impl BaseAudioContext { decode_resolvers: Default::default(), sample_rate, state: Cell::new(AudioContextState::Suspended), + channel_count: channel_count.into(), }; context @@ -206,19 +205,19 @@ impl BaseAudioContext { self.take_pending_resume_promises(Ok(())); let _ = task_source.queue( task!(resume_success: move || { - let this = this.root(); - this.fulfill_in_flight_resume_promises(|| { - if this.state.get() != AudioContextState::Running { - this.state.set(AudioContextState::Running); - let window = DomRoot::downcast::(this.global()).unwrap(); - window.dom_manipulation_task_source().queue_simple_event( - this.upcast(), - atom!("statechange"), - &window - ); - } - }); - }), + let this = this.root(); + this.fulfill_in_flight_resume_promises(|| { + if this.state.get() != AudioContextState::Running { + this.state.set(AudioContextState::Running); + let window = DomRoot::downcast::(this.global()).unwrap(); + window.dom_manipulation_task_source().queue_simple_event( + this.upcast(), + atom!("statechange"), + &window + ); + } + }); + }), window.upcast(), ); }, @@ -291,7 +290,7 @@ impl BaseAudioContextMethods for BaseAudioContext { let global = self.global(); self.destination.or_init(|| { let mut options = AudioNodeOptions::empty(); - options.channelCount = Some(2); + options.channelCount = Some(self.channel_count); options.channelCountMode = Some(ChannelCountMode::Explicit); options.channelInterpretation = Some(ChannelInterpretation::Speakers); AudioDestinationNode::new(&global, self, &options) @@ -442,6 +441,17 @@ impl BaseAudioContextMethods for BaseAudioContext { } } +impl From for AudioContextOptions { + fn from(options: BaseAudioContextOptions) -> Self { + match options { + BaseAudioContextOptions::AudioContext(options) => + AudioContextOptions::RealTimeAudioContext(options), + BaseAudioContextOptions::OfflineAudioContext(options) => + AudioContextOptions::OfflineAudioContext(options), + } + } +} + impl From for AudioContextState { fn from(state: ProcessingState) -> Self { match state { diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index d58314f9af3..ba1668e9f43 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -401,6 +401,8 @@ pub mod navigatorinfo; pub mod node; pub mod nodeiterator; pub mod nodelist; +pub mod offlineaudiocompletionevent; +pub mod offlineaudiocontext; pub mod oscillatornode; pub mod pagetransitionevent; pub mod paintrenderingcontext2d; diff --git a/components/script/dom/offlineaudiocompletionevent.rs b/components/script/dom/offlineaudiocompletionevent.rs new file mode 100644 index 00000000000..91edf35338c --- /dev/null +++ b/components/script/dom/offlineaudiocompletionevent.rs @@ -0,0 +1,77 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audiobuffer::AudioBuffer; +use dom::bindings::codegen::Bindings::EventBinding::EventMethods; +use dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding; +use dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding::OfflineAudioCompletionEventInit; +use dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding::OfflineAudioCompletionEventMethods; +use dom::bindings::error::Fallible; +use dom::bindings::inheritance::Castable; +use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{Dom, DomRoot, RootedReference}; +use dom::bindings::str::DOMString; +use dom::event::{Event, EventBubbles, EventCancelable}; +use dom::window::Window; +use dom_struct::dom_struct; +use servo_atoms::Atom; + +#[dom_struct] +pub struct OfflineAudioCompletionEvent { + event: Event, + rendered_buffer: Dom, +} + +impl OfflineAudioCompletionEvent { + pub fn new_inherited(rendered_buffer: &AudioBuffer) -> OfflineAudioCompletionEvent { + OfflineAudioCompletionEvent { + event: Event::new_inherited(), + rendered_buffer: Dom::from_ref(rendered_buffer), + } + } + + pub fn new( + window: &Window, + type_: Atom, + bubbles: EventBubbles, + cancelable: EventCancelable, + rendered_buffer: &AudioBuffer, + ) -> DomRoot { + let event = Box::new(OfflineAudioCompletionEvent::new_inherited(rendered_buffer)); + let ev = reflect_dom_object(event, window, OfflineAudioCompletionEventBinding::Wrap); + { + let event = ev.upcast::(); + event.init_event(type_, bool::from(bubbles), bool::from(cancelable)); + } + ev + } + + pub fn Constructor( + window: &Window, + type_: DOMString, + init: &OfflineAudioCompletionEventInit, + ) -> Fallible> { + let bubbles = EventBubbles::from(init.parent.bubbles); + let cancelable = EventCancelable::from(init.parent.cancelable); + Ok(OfflineAudioCompletionEvent::new( + window, + Atom::from(type_), + bubbles, + cancelable, + init.renderedBuffer.r(), + )) + } +} + +impl OfflineAudioCompletionEventMethods for OfflineAudioCompletionEvent { + // https://webaudio.github.io/web-audio-api/#dom-offlineaudiocompletionevent-renderedbuffer + fn RenderedBuffer(&self) -> DomRoot { + DomRoot::from_ref(&*self.rendered_buffer) + } + + // https://dom.spec.whatwg.org/#dom-event-istrusted + fn IsTrusted(&self) -> bool { + self.event.IsTrusted() + } +} diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs new file mode 100644 index 00000000000..24c4596b8be --- /dev/null +++ b/components/script/dom/offlineaudiocontext.rs @@ -0,0 +1,178 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::audiobuffer::{AudioBuffer, MAX_SAMPLE_RATE, MIN_SAMPLE_RATE}; +use dom::audionode::MAX_CHANNEL_COUNT; +use dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; +use dom::bindings::cell::DomRefCell; +use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::BaseAudioContextMethods; +use dom::bindings::codegen::Bindings::OfflineAudioContextBinding; +use dom::bindings::codegen::Bindings::OfflineAudioContextBinding::OfflineAudioContextMethods; +use dom::bindings::codegen::Bindings::OfflineAudioContextBinding::OfflineAudioContextOptions; +use dom::bindings::error::{Error, Fallible}; +use dom::bindings::inheritance::Castable; +use dom::bindings::num::Finite; +use dom::bindings::refcounted::Trusted; +use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::event::{Event, EventBubbles, EventCancelable}; +use dom::offlineaudiocompletionevent::OfflineAudioCompletionEvent; +use dom::promise::Promise; +use dom::window::Window; +use dom_struct::dom_struct; +use servo_media::audio::context::OfflineAudioContextOptions as ServoMediaOfflineAudioContextOptions; +use std::cell::Cell; +use std::rc::Rc; +use std::sync::{Arc, Mutex}; +use std::sync::mpsc; +use std::thread::Builder; +use task_source::{TaskSource, TaskSourceName}; + +#[dom_struct] +pub struct OfflineAudioContext { + context: BaseAudioContext, + channel_count: u32, + length: u32, + rendering_started: Cell, + #[ignore_malloc_size_of = "promises are hard"] + pending_rendering_promise: DomRefCell>>, +} + +impl OfflineAudioContext { + #[allow(unrooted_must_root)] + fn new_inherited(options: &OfflineAudioContextOptions) -> OfflineAudioContext { + let context = BaseAudioContext::new_inherited( + BaseAudioContextOptions::OfflineAudioContext(options.into()), + ); + OfflineAudioContext { + context, + channel_count: options.numberOfChannels, + length: options.length, + rendering_started: Cell::new(false), + pending_rendering_promise: Default::default(), + } + } + + #[allow(unrooted_must_root)] + fn new(window: &Window, options: &OfflineAudioContextOptions) -> DomRoot { + let context = OfflineAudioContext::new_inherited(options); + reflect_dom_object(Box::new(context), window, OfflineAudioContextBinding::Wrap) + } + + pub fn Constructor( + window: &Window, + options: &OfflineAudioContextOptions, + ) -> Fallible> { + Ok(OfflineAudioContext::new(window, options)) + } + + pub fn Constructor_( + window: &Window, + number_of_channels: u32, + length: u32, + sample_rate: Finite, + ) -> Fallible> { + if number_of_channels > MAX_CHANNEL_COUNT || + number_of_channels <= 0 || + length <= 0 || + *sample_rate < MIN_SAMPLE_RATE || + *sample_rate > MAX_SAMPLE_RATE + { + return Err(Error::NotSupported); + } + + let mut options = OfflineAudioContextOptions::empty(); + options.numberOfChannels = number_of_channels; + options.length = length; + options.sampleRate = sample_rate; + Ok(OfflineAudioContext::new(window, &options)) + } +} + +impl OfflineAudioContextMethods for OfflineAudioContext { + // https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-oncomplete + event_handler!(complete, GetOncomplete, SetOncomplete); + + // https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-length + fn Length(&self) -> u32 { + self.length + } + + // https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-startrendering + #[allow(unrooted_must_root)] + fn StartRendering(&self) -> Rc { + let promise = Promise::new(&self.global()); + if self.rendering_started.get() { + promise.reject_error(Error::InvalidState); + return promise; + } + self.rendering_started.set(true); + + *self.pending_rendering_promise.borrow_mut() = Some(promise.clone()); + + let processed_audio = Arc::new(Mutex::new(Vec::new())); + let processed_audio_ = processed_audio.clone(); + let (sender, receiver) = mpsc::channel(); + let sender = Mutex::new(sender); + self.context + .audio_context_impl() + .set_eos_callback(Box::new(move |buffer| { + processed_audio_ + .lock() + .unwrap() + .extend_from_slice((*buffer).as_ref()); + let _ = sender.lock().unwrap().send(()); + })); + + let this = Trusted::new(self); + let global = self.global(); + let window = global.as_window(); + let task_source = window.dom_manipulation_task_source(); + let canceller = window.task_canceller(TaskSourceName::DOMManipulation); + Builder::new() + .name("OfflineAudioContextResolver".to_owned()) + .spawn(move || { + let _ = receiver.recv(); + let _ = task_source.queue_with_canceller( + task!(resolve: move || { + let this = this.root(); + let processed_audio = processed_audio.lock().unwrap(); + let buffer = AudioBuffer::new( + &this.global().as_window(), + this.channel_count, + this.length, + *this.context.SampleRate(), + Some(processed_audio.as_slice())); + (*this.pending_rendering_promise.borrow_mut()).take().unwrap().resolve_native(&buffer); + let global = &this.global(); + let window = global.as_window(); + let event = OfflineAudioCompletionEvent::new(&window, + atom!("complete"), + EventBubbles::DoesNotBubble, + EventCancelable::NotCancelable, + &buffer); + event.upcast::().fire(this.upcast()); + }), + &canceller, + ); + }) + .unwrap(); + + if self.context.audio_context_impl().resume().is_err() { + promise.reject_error(Error::Type("Could not start offline rendering".to_owned())); + } + + promise + } +} + +impl<'a> From<&'a OfflineAudioContextOptions> for ServoMediaOfflineAudioContextOptions { + fn from(options: &OfflineAudioContextOptions) -> Self { + Self { + channels: options.numberOfChannels as u8, + length: options.length as usize, + sample_rate: *options.sampleRate, + } + } +} diff --git a/components/script/dom/webidls/OfflineAudioCompletionEvent.webidl b/components/script/dom/webidls/OfflineAudioCompletionEvent.webidl new file mode 100644 index 00000000000..d5f2218c7ed --- /dev/null +++ b/components/script/dom/webidls/OfflineAudioCompletionEvent.webidl @@ -0,0 +1,17 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* + * For more information on this interface please see + * https://webaudio.github.io/web-audio-api/#offlineaudiocompletionevent + */ + +dictionary OfflineAudioCompletionEventInit : EventInit { + required AudioBuffer renderedBuffer; +}; + +[Exposed=Window, + Constructor(DOMString type, OfflineAudioCompletionEventInit eventInitDict)] +interface OfflineAudioCompletionEvent : Event { + readonly attribute AudioBuffer renderedBuffer; +}; diff --git a/components/script/dom/webidls/OfflineAudioContext.webidl b/components/script/dom/webidls/OfflineAudioContext.webidl new file mode 100644 index 00000000000..688d4ec6f0a --- /dev/null +++ b/components/script/dom/webidls/OfflineAudioContext.webidl @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, 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/#OfflineAudioContext + */ + +dictionary OfflineAudioContextOptions { + unsigned long numberOfChannels = 1; + unsigned long length = 0; + float sampleRate = 48000.; +}; + +[Exposed=Window, + Constructor (optional OfflineAudioContextOptions contextOptions), + Constructor (unsigned long numberOfChannels, unsigned long length, float sampleRate)] +interface OfflineAudioContext : BaseAudioContext { + readonly attribute unsigned long length; + attribute EventHandler oncomplete; + + Promise startRendering(); +// Promise suspend(double suspendTime); +}; From f8d61a34a218c65facc05ac0a2e75e27671d0ba7 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 27 Jul 2018 09:42:39 -0700 Subject: [PATCH 76/87] Update lockfile --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index df2e1fddf83..290400fa191 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3136,7 +3136,7 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" +source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", @@ -3146,7 +3146,7 @@ dependencies = [ [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" +source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3158,7 +3158,7 @@ dependencies = [ [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" +source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3176,7 +3176,7 @@ dependencies = [ [[package]] name = "servo-media-player" version = "0.1.0" -source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" +source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" [[package]] name = "servo-skia" @@ -3273,7 +3273,7 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#dadf87f24830712b75e1d909bad7500f9dae952c" +source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" dependencies = [ "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", From a12374726ddc687924729e7a74e173fd19be9540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 27 Jul 2018 18:47:38 +0200 Subject: [PATCH 77/87] Update WPTs expectations --- .../ctor-audiobuffer.html.ini | 2 +- .../audiobuffersource-basic.html.ini | 11 +++++ .../audiobuffersource-channels.html.ini | 10 +++++ .../audiobuffersource-ended.html.ini | 2 + .../audiobuffersource-grain.html.ini | 2 + .../audiobuffersource-multi-channels.html.ini | 2 + ...audiobuffersource-one-sample-loop.html.ini | 2 + ...diobuffersource-playbackrate-zero.html.ini | 2 + .../audiobuffersource-start.html.ini | 2 + .../audiosource-onended.html.ini | 2 + .../audiosource-time-limits.html.ini | 2 + .../ctor-audiobuffersource.html.ini | 10 ++++- .../note-grain-on-play.html.ini | 2 + .../note-grain-on-timing.html.ini | 2 + .../sample-accurate-scheduling.html.ini | 2 + .../audiocontext-suspend-resume.html.ini | 6 +++ .../audionode-channel-rules.html.ini | 2 +- .../audionode-connect-return-value.html.ini | 4 -- .../audionode.html.ini | 3 ++ .../channel-mode-interp-basic.html.ini | 2 +- ...udioparam-connect-audioratesignal.html.ini | 2 +- .../audioparam-exceptional-values.html.ini | 43 ++++++++++++++++++- ...dioparam-setValueCurve-exceptions.html.ini | 33 ++++++++++++++ .../audioparam-summingjunction.html.ini | 2 +- .../automation-rate.html.ini | 9 ++++ ...etAtTime-after-event-within-block.html.ini | 1 + .../setValueAtTime-within-block.html.ini | 1 + ...udioworklet-audioparam-size.https.html.ini | 2 + ...seaudiocontext-audioworklet.https.html.ini | 1 + .../biquad-basic.html.ini | 6 +++ .../audiochannelmerger-basic.html.ini | 15 +++++++ .../audiochannelsplitter.html.ini | 9 ++++ ...olver-setBuffer-already-has-value.html.ini | 2 + .../delaynode-maxdelaylimit.html.ini | 9 ++++ .../the-gainnode-interface/ctor-gain.html.ini | 31 ++++++++++++- .../test-gainnode.html.ini | 2 +- .../iirfilter-basic.html.ini | 6 +++ .../iirfilter.html.ini | 6 +++ .../ctor-offlineaudiocontext.html.ini | 31 ++++++++++++- .../current-time-block-size.html.ini | 3 +- .../ctor-oscillator.html.ini | 36 ++++++++++++++++ .../panner-distance-clamping.html.ini | 9 ++++ 42 files changed, 316 insertions(+), 15 deletions(-) create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-playbackrate-zero.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini delete mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value.html.ini diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini index 11144a484d2..c20621a71fd 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html.ini @@ -1,5 +1,5 @@ [ctor-audiobuffer.html] - expected: ERROR + expected: CRASH [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] expected: FAIL diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini new file mode 100644 index 00000000000..c4a1a127826 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini @@ -0,0 +1,11 @@ +[audiobuffersource-basic.html] + expected: ERROR + [X start(-1) did not throw an exception.] + expected: FAIL + + [X start(0,-1) threw "InvalidStateError" instead of function RangeError() {\n [native code\]\n}.] + expected: FAIL + + [X start(0,0,-1) threw "InvalidStateError" instead of function RangeError() {\n [native code\]\n}.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html.ini new file mode 100644 index 00000000000..e50e54a484f --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html.ini @@ -0,0 +1,10 @@ +[audiobuffersource-channels.html] + [X source.buffer = buffer again did not throw an exception.] + expected: FAIL + + [< [validate .buffer\] 1 out of 16 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini new file mode 100644 index 00000000000..6d26244d4cb --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini @@ -0,0 +1,2 @@ +[audiobuffersource-ended.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini new file mode 100644 index 00000000000..e91945998e8 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini @@ -0,0 +1,2 @@ +[audiobuffersource-grain.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini new file mode 100644 index 00000000000..d85973ca825 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini @@ -0,0 +1,2 @@ +[audiobuffersource-multi-channels.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini new file mode 100644 index 00000000000..e0cf64c8248 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini @@ -0,0 +1,2 @@ +[audiobuffersource-one-sample-loop.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-playbackrate-zero.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-playbackrate-zero.html.ini new file mode 100644 index 00000000000..0ba28a1e87a --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-playbackrate-zero.html.ini @@ -0,0 +1,2 @@ +[audiobuffersource-playbackrate-zero.html] + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini new file mode 100644 index 00000000000..b63ac8ba155 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini @@ -0,0 +1,2 @@ +[audiobuffersource-start.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini new file mode 100644 index 00000000000..57fb1bf99f3 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini @@ -0,0 +1,2 @@ +[audiosource-onended.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini new file mode 100644 index 00000000000..b1b1fdea573 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini @@ -0,0 +1,2 @@ +[audiosource-time-limits.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini index cb9953a5945..ca302b9c130 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html.ini @@ -1,5 +1,4 @@ [ctor-audiobuffersource.html] - expected: ERROR [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] expected: FAIL @@ -12,3 +11,12 @@ [X node0 instanceof AudioBufferSourceNode is not equal to true. Got false.] expected: FAIL + [X node2.buffer === buffer is not equal to true. Got false.] + expected: FAIL + + [< [constructor options\] 1 out of 7 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 5 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini new file mode 100644 index 00000000000..dcc2b107271 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini @@ -0,0 +1,2 @@ +[note-grain-on-play.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini new file mode 100644 index 00000000000..a6ee1a51c20 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini @@ -0,0 +1,2 @@ +[note-grain-on-timing.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini new file mode 100644 index 00000000000..3d60a2897b1 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini @@ -0,0 +1,2 @@ +[sample-accurate-scheduling.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini index d3a0f34dc1b..2027a838885 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-suspend-resume.html.ini @@ -3,3 +3,9 @@ [X offlineContext = new OfflineAudioContext(1, 44100, 44100) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] expected: FAIL + [X p1 = offlineContext.suspend() incorrectly threw TypeError: "offlineContext.suspend is not a function".] + expected: FAIL + + [X p1 instanceof Promise is not true. Got false.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini index 270831b7378..7cb30f75b56 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-channel-rules.html.ini @@ -1,2 +1,2 @@ [audionode-channel-rules.html] - expected: ERROR + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini deleted file mode 100644 index e4a66b55635..00000000000 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[audionode-connect-return-value.html] - [connect should return the node connected to.] - expected: FAIL - diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini index 4e50308c069..0879ed55b0e 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode.html.ini @@ -11,3 +11,6 @@ [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] expected: FAIL + [< [test\] 1 out of 12 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini index 783f3ff032d..ba388d1c837 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini @@ -1,2 +1,2 @@ [channel-mode-interp-basic.html] - expected: ERROR + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini index a095f42f1d4..a1e209bdabf 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-connect-audioratesignal.html.ini @@ -1,2 +1,2 @@ [audioparam-connect-audioratesignal.html] - expected: ERROR + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini index 248fea6a1ac..8bc69f7212e 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html.ini @@ -1,8 +1,49 @@ [audioparam-exceptional-values.html] - expected: ERROR [X Creating context for testing incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] expected: FAIL [< [initialize\] 1 out of 1 assertions were failed.] expected: FAIL + [X gain.gain.setValueAtTime(1,-1) did not throw an exception.] + expected: FAIL + + [X gain.gain.linearRampToValueAtTime(1,-1) did not throw an exception.] + expected: FAIL + + [X gain.gain.exponentialRampToValueAtTime(1,-1) did not throw an exception.] + expected: FAIL + + [X gain.gain.setTargetAtTime(1,-1,1) did not throw an exception.] + expected: FAIL + + [X gain.gain.setTargetAtTime(1,1,-1) did not throw an exception.] + expected: FAIL + + [X gain.gain.setValueCurveAtTime([[object Float32Array\]\],-1,1) threw "TypeError" instead of function RangeError() {\n [native code\]\n}.] + expected: FAIL + + [X gain.gain.setValueCurveAtTime([[object Float32Array\]\],1,-1) threw "TypeError" instead of function RangeError() {\n [native code\]\n}.] + expected: FAIL + + [X gain.gain.setValueCurveAtTime(curve, 1, 0) threw "TypeError" instead of function RangeError() {\n [native code\]\n}.] + expected: FAIL + + [< [special cases 1\] 8 out of 8 assertions were failed.] + expected: FAIL + + [X gain.gain.exponentialRampToValueAtTime(0,1) did not throw an exception.] + expected: FAIL + + [X gain.gain.exponentialRampToValueAtTime(-1e-100,1) did not throw an exception.] + expected: FAIL + + [X gain.gain.exponentialRampToValueAtTime(1e-100,1) did not throw an exception.] + expected: FAIL + + [< [special cases 2\] 3 out of 3 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 2 out of 6 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini index 56df600f048..cbb02b814c0 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions.html.ini @@ -1,2 +1,35 @@ [audioparam-setValueCurve-exceptions.html] expected: ERROR + [X setValueCurveAtTime(curve, 0.0125, 0.0125) incorrectly threw TypeError: "g.gain.setValueCurveAtTime is not a function".] + expected: FAIL + + [X setValueAtTime(1, 0.018750000000000003) did not throw an exception.] + expected: FAIL + + [X linearRampToValueAtTime(1, 0.018750000000000003) did not throw an exception.] + expected: FAIL + + [X exponentialRampToValueAtTime(1, 0.018750000000000003) did not throw an exception.] + expected: FAIL + + [X setTargetAtTime(1, 0.018750000000000003, 1) did not throw an exception.] + expected: FAIL + + [< [setValueCurve\] 5 out of 6 assertions were failed.] + expected: FAIL + + [X setValueCurveAtTime(curve, 0.05, 0.1) incorrectly threw TypeError: "g.gain.setValueCurveAtTime is not a function".] + expected: FAIL + + [X setValueCurveAtTime(curve, 0.00625, 0.01) threw "TypeError" instead of NotSupportedError.] + expected: FAIL + + [X setValueCurveAtTime(curve, 0.018750000000000003, 0.01) threw "TypeError" instead of NotSupportedError.] + expected: FAIL + + [X setValueCurveAtTime(curve, 0.03125, 0.01) threw "TypeError" instead of NotSupportedError.] + expected: FAIL + + [X setValueCurveAtTime(curve, 0.043750000000000004, 0.01) threw "TypeError" instead of NotSupportedError.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini index 4969e59bbd1..ed0b9766226 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-summingjunction.html.ini @@ -1,2 +1,2 @@ [audioparam-summingjunction.html] - expected: ERROR + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini index 7394d9167aa..fb10576f028 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/automation-rate.html.ini @@ -1,2 +1,11 @@ [automation-rate.html] expected: ERROR + [X Set AudioBufferSourceNode.detune.automationRate to "a-rate" did not throw an exception.] + expected: FAIL + + [X Set AudioBufferSourceNode.playbackRate.automationRate to "a-rate" did not throw an exception.] + expected: FAIL + + [< [AudioBufferSourceNode\] 2 out of 4 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini index b85f8845f18..62baf631517 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini @@ -1,4 +1,5 @@ [setTargetAtTime-after-event-within-block.html] + expected: ERROR [Test setTargetAtTime after an event in the same processing block] expected: FAIL diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini index 03c2e023d4d..46d91bcf8d2 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini @@ -1,4 +1,5 @@ [setValueAtTime-within-block.html] + expected: ERROR [Test setValueAtTime with start time not on a block boundary] expected: FAIL diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html.ini new file mode 100644 index 00000000000..96c7333c9aa --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html.ini @@ -0,0 +1,2 @@ +[audioworklet-audioparam-size.https.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini index 3e3b5437281..c65b4e97e43 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html.ini @@ -1,4 +1,5 @@ [baseaudiocontext-audioworklet.https.html] + expected: ERROR [\n Checking BaseAudioContext.audioWorklet\n ] expected: FAIL diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini index 5db6179d6b6..05e059ad3c0 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html.ini @@ -6,3 +6,9 @@ [< [initialize\] 1 out of 1 assertions were failed.] expected: FAIL + [X context.createBiquadFilter does not exist. Got undefined.] + expected: FAIL + + [< [existence\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini index 4d75c400e84..ac202e63983 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html.ini @@ -1,2 +1,17 @@ [audiochannelmerger-basic.html] expected: ERROR + [X context.createChannelMerger() incorrectly threw TypeError: "context.createChannelMerger is not a function".] + expected: FAIL + + [X context.createChannelMerger(0) threw "TypeError" instead of IndexSizeError.] + expected: FAIL + + [X context.createChannelMerger(32) incorrectly threw TypeError: "context.createChannelMerger is not a function".] + expected: FAIL + + [X context.createChannelMerger(33) threw "TypeError" instead of IndexSizeError.] + expected: FAIL + + [< [exceptions-channels\] 4 out of 4 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini index 4e6601565ed..48bc3434924 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-channelsplitternode-interface/audiochannelsplitter.html.ini @@ -1,2 +1,11 @@ [audiochannelsplitter.html] expected: ERROR + [X createChannelSplitter(0) threw "TypeError" instead of IndexSizeError.] + expected: FAIL + + [X createChannelSplitter(33) threw "TypeError" instead of IndexSizeError.] + expected: FAIL + + [X splitternode = context.createChannelSplitter(32) incorrectly threw TypeError: "context.createChannelSplitter is not a function".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value.html.ini new file mode 100644 index 00000000000..231d4038bd0 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value.html.ini @@ -0,0 +1,2 @@ +[convolver-setBuffer-already-has-value.html] + expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini index b67478861c9..031e60e922d 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-delaynode-interface/delaynode-maxdelaylimit.html.ini @@ -1,2 +1,11 @@ [delaynode-maxdelaylimit.html] expected: ERROR + [X () => context.createDelay(180) threw "TypeError" instead of Delay length cannot be 180 seconds or more.] + expected: FAIL + + [X () => context.createDelay(0) threw "TypeError" instead of Delay length cannot be 0.] + expected: FAIL + + [X () => context.createDelay(-1) threw "TypeError" instead of Delay length cannot be negative.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini index f3299d77c26..f607ab5b6f6 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html.ini @@ -1,5 +1,4 @@ [ctor-gain.html] - expected: ERROR [X context = new OfflineAudioContext(...) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] expected: FAIL @@ -12,3 +11,33 @@ [X node0 instanceof GainNode is not equal to true. Got false.] expected: FAIL + [X node.channelCount is not equal to 17. Got 2.] + expected: FAIL + + [X new GainNode(c, {channelCount: 0}) did not throw an exception.] + expected: FAIL + + [X new GainNode(c, {channelCount: 99}) did not throw an exception.] + expected: FAIL + + [X node.channelCountMode after valid setter is not equal to clamped-max. Got max.] + expected: FAIL + + [X node.channelCountMode after valid setter is not equal to explicit. Got max.] + expected: FAIL + + [X node.channelCountMode after invalid setter is not equal to explicit. Got max.] + expected: FAIL + + [X node.channelInterpretation is not equal to discrete. Got speakers.] + expected: FAIL + + [X node.channelInterpretation after invalid setter is not equal to discrete. Got speakers.] + expected: FAIL + + [< [test AudioNodeOptions\] 8 out of 20 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 5 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini index 0d2ee9a750f..a5e4a81c792 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini @@ -1,5 +1,5 @@ [test-gainnode.html] - expected: ERROR + expected: CRASH [GainNode] expected: NOTRUN diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini index 155aaf9a9ef..9714afed1a4 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html.ini @@ -6,3 +6,9 @@ [< [initialize\] 1 out of 1 assertions were failed.] expected: FAIL + [X context.createIIRFilter does not exist. Got undefined.] + expected: FAIL + + [< [existence\] 1 out of 1 assertions were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini index f98237d5ae5..4aac1bfcd15 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter.html.ini @@ -1,2 +1,8 @@ [iirfilter.html] expected: ERROR + [X createIIRFilter with normalized coefficients incorrectly threw TypeError: "context.createIIRFilter is not a function".] + expected: FAIL + + [X createIIRFilter with unnormalized coefficients incorrectly threw TypeError: "context.createIIRFilter is not a function".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini index 71a9223566f..39e0f41ad9c 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini @@ -1,5 +1,4 @@ [ctor-offlineaudiocontext.html] - expected: ERROR [X new OfflineAudioContext(3) threw "ReferenceError" instead of TypeError.] expected: FAIL @@ -9,3 +8,33 @@ [X context = new OfflineAudioContext(3, 42, 12345) incorrectly threw ReferenceError: "OfflineAudioContext is not defined".] expected: FAIL + [X new OfflineAudioContext() did not throw an exception.] + expected: FAIL + + [X new OfflineAudioContext({}) did not throw an exception.] + expected: FAIL + + [X new OfflineAudioContext({"length":42}) did not throw an exception.] + expected: FAIL + + [X new OfflineAudioContext({"sampleRate":12345}) did not throw an exception.] + expected: FAIL + + [< [options-1\] 4 out of 10 assertions were failed.] + expected: FAIL + + [X new OfflineAudioContext({"length":42,"sampleRate":8000,"numberOfChannels":33}) did not throw an exception.] + expected: FAIL + + [X new OfflineAudioContext({"length":0,"sampleRate":8000}) did not throw an exception.] + expected: FAIL + + [X new OfflineAudioContext({"length":1,"sampleRate":1}) did not throw an exception.] + expected: FAIL + + [< [options-2\] 3 out of 3 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 2 out of 4 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini index 9112d9bdd39..e2a57f9d12b 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini @@ -1,4 +1,5 @@ [current-time-block-size.html] + expected: TIMEOUT [Test currentTime at completion of OfflineAudioContext rendering] - expected: FAIL + expected: TIMEOUT diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini index d9b88d010ea..a7cc51f5b36 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator.html.ini @@ -12,3 +12,39 @@ [X node0 instanceof OscillatorNode is not equal to true. Got false.] expected: FAIL + [X node0.type is not equal to sine. Got undefined.] + expected: FAIL + + [< [default constructor\] 1 out of 9 assertions were failed.] + expected: FAIL + + [X node.channelCount is not equal to 17. Got 2.] + expected: FAIL + + [X new OscillatorNode(c, {channelCount: 0}) did not throw an exception.] + expected: FAIL + + [X new OscillatorNode(c, {channelCount: 99}) did not throw an exception.] + expected: FAIL + + [X node.channelCountMode after valid setter is not equal to clamped-max. Got max.] + expected: FAIL + + [X node.channelCountMode after valid setter is not equal to explicit. Got max.] + expected: FAIL + + [X node.channelCountMode after invalid setter is not equal to explicit. Got max.] + expected: FAIL + + [X node.channelInterpretation is not equal to discrete. Got speakers.] + expected: FAIL + + [X node.channelInterpretation after invalid setter is not equal to discrete. Got speakers.] + expected: FAIL + + [< [test AudioNodeOptions\] 8 out of 20 assertions were failed.] + expected: FAIL + + [X node1.type is not equal to sawtooth. Got undefined.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini index 590a0e116bd..4ba526061c3 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini @@ -1,2 +1,11 @@ [panner-distance-clamping.html] expected: ERROR + [X new PannerNode(c, {refDistance: -1}) threw "ReferenceError" instead of RangeError.] + expected: FAIL + + [X new PannerNode(c, {refDistance: 0}) incorrectly threw ReferenceError: "PannerNode is not defined".] + expected: FAIL + + [X new PannerNode(c, {refDistance: 5e-324}) incorrectly threw ReferenceError: "PannerNode is not defined".] + expected: FAIL + From cf86020ef7755f5bf6df74a2eecb0a65c1ecc035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 27 Jul 2018 18:53:13 +0200 Subject: [PATCH 78/87] Fix interfaces wpt --- tests/wpt/mozilla/tests/mozilla/interfaces.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.html b/tests/wpt/mozilla/tests/mozilla/interfaces.html index 3d125d6f647..4b8234b472c 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.html +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.html @@ -12,6 +12,14 @@ // IMPORTANT: Do not change the list below without review from a DOM peer! test_interfaces([ "Attr", + "AudioBuffer", + "AudioBufferSourceNode", + "AudioContext", + "AudioDestinationNode", + "AudioNode", + "AudioParam", + "AudioScheduledSourceNode", + "BaseAudioContext", "BeforeUnloadEvent", "Blob", "CanvasGradient", @@ -63,6 +71,7 @@ test_interfaces([ "FileReader", "FocusEvent", "FormData", + "GainNode", "HashChangeEvent", "Headers", "History", @@ -160,6 +169,9 @@ test_interfaces([ "NodeFilter", "NodeIterator", "NodeList", + "OfflineAudioCompletionEvent", + "OfflineAudioContext", + "OscillatorNode", "PageTransitionEvent", "Performance", "PerformanceEntry", From 2dba4142ed749bbfdda7b710d2b89153a05e1caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 30 Jul 2018 13:34:02 +0200 Subject: [PATCH 79/87] Update manifest --- tests/wpt/mozilla/meta/MANIFEST.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 1204c6d188f..b755ff4f761 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -65272,7 +65272,7 @@ "testharness" ], "mozilla/interfaces.html": [ - "079065a1870bb9d3f790e9e8a3e17417c7195204", + "82d7e0dd52b70acf1210bc9bbf09be4d45cb64f7", "testharness" ], "mozilla/interfaces.js": [ From ce828c0071b2fb639b4c2db41601988a72868052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 30 Jul 2018 14:21:07 +0200 Subject: [PATCH 80/87] Get rooting out of AudioBuffer::new_inherited --- components/script/dom/audiobuffer.rs | 77 ++++++++++++++-------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 3f1c5f2f441..1119b3c868e 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -16,7 +16,6 @@ use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; use std::cmp::min; -use std::mem; use std::ptr::{self, NonNull}; // This range is defined by the spec. @@ -42,47 +41,14 @@ impl AudioBuffer { #[allow(unrooted_must_root)] #[allow(unsafe_code)] pub fn new_inherited( - global: &Window, number_of_channels: u32, length: u32, sample_rate: f32, - initial_data: Option<&[f32]>, ) -> AudioBuffer { - let cx = global.get_cx(); - let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get()); - rooted_vec!(let mut js_channels_); - for channel in 0..number_of_channels { - rooted!(in (cx) let mut array = ptr::null_mut::()); - let offset = (channel * length) as usize; - match initial_data { - Some(data) => { - let _ = unsafe { - Float32Array::create( - cx, - CreateWith::Slice(&data[offset..offset + (length as usize) - 1]), - array.handle_mut(), - ) - }; - }, - None => { - let _ = unsafe { - Float32Array::create( - cx, - CreateWith::Slice(&vec![0.; length as usize]), - array.handle_mut(), - ) - }; - } - } - let js_channel = Heap::default(); - js_channel.set(array.get()); - js_channels_.push(js_channel); - } - let js_channels = DomRefCell::new(Vec::new()); - mem::swap(&mut *js_channels.borrow_mut(), &mut *js_channels_); + let vec = (0..number_of_channels).map(|_| Heap::default()).collect(); AudioBuffer { reflector_: Reflector::new(), - js_channels, + js_channels: DomRefCell::new(vec), shared_channels: DomRefCell::new(ServoMediaAudioBuffer::new( number_of_channels as u8, length as usize, @@ -103,13 +69,13 @@ impl AudioBuffer { initial_data: Option<&[f32]>, ) -> DomRoot { let buffer = AudioBuffer::new_inherited( - global, number_of_channels, length, sample_rate, - initial_data, ); - reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap) + let buffer = reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap); + buffer.set_channels(initial_data); + buffer } // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer @@ -131,6 +97,39 @@ impl AudioBuffer { )) } + #[allow(unsafe_code)] + pub fn set_channels(&self, initial_data: Option<&[f32]>) { + let global = self.global(); + let cx = global.get_cx(); + let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get()); + let chans = self.js_channels.borrow_mut(); + for channel in 0..self.number_of_channels { + rooted!(in (cx) let mut array = ptr::null_mut::()); + let offset = (channel * self.length) as usize; + match initial_data { + Some(data) => { + let _ = unsafe { + Float32Array::create( + cx, + CreateWith::Slice(&data[offset..offset + (self.length as usize) - 1]), + array.handle_mut(), + ) + }; + }, + None => { + let _ = unsafe { + Float32Array::create( + cx, + CreateWith::Slice(&vec![0.; self.length as usize]), + array.handle_mut(), + ) + }; + } + } + chans[channel as usize].set(array.get()); + } + } + #[allow(unsafe_code)] unsafe fn restore_js_channel_data(&self, cx: *mut JSContext) -> bool { for (i, channel) in self.js_channels.borrow_mut().iter().enumerate() { From 19e4c627a3eba62427c6e78101fdce0d47e6f325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 30 Jul 2018 15:12:27 +0200 Subject: [PATCH 81/87] Update manifest --- tests/wpt/mozilla/meta/MANIFEST.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index b755ff4f761..405b3071599 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -65272,7 +65272,7 @@ "testharness" ], "mozilla/interfaces.html": [ - "82d7e0dd52b70acf1210bc9bbf09be4d45cb64f7", + "7a40b9215fe7c1f65d57384ecacbd9f691af3710", "testharness" ], "mozilla/interfaces.js": [ From 3b8cb83e04c74dae9c633c735204acf6305f0de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 30 Jul 2018 18:50:36 +0200 Subject: [PATCH 82/87] Make OfflineAudioContextOptions spec compliant --- components/script/dom/offlineaudiocontext.rs | 40 +++++++++---------- .../dom/webidls/OfflineAudioContext.webidl | 6 +-- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index 24c4596b8be..4490d5df6f9 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -41,22 +41,32 @@ pub struct OfflineAudioContext { impl OfflineAudioContext { #[allow(unrooted_must_root)] - fn new_inherited(options: &OfflineAudioContextOptions) -> OfflineAudioContext { + fn new_inherited(channel_count: u32, + length: u32, + sample_rate: f32) -> OfflineAudioContext { + let options = ServoMediaOfflineAudioContextOptions { + channels: channel_count as u8, + length: length as usize, + sample_rate, + }; let context = BaseAudioContext::new_inherited( - BaseAudioContextOptions::OfflineAudioContext(options.into()), + BaseAudioContextOptions::OfflineAudioContext(options), ); OfflineAudioContext { context, - channel_count: options.numberOfChannels, - length: options.length, + channel_count, + length, rendering_started: Cell::new(false), pending_rendering_promise: Default::default(), } } #[allow(unrooted_must_root)] - fn new(window: &Window, options: &OfflineAudioContextOptions) -> DomRoot { - let context = OfflineAudioContext::new_inherited(options); + fn new(window: &Window, + channel_count: u32, + length: u32, + sample_rate: f32) -> DomRoot { + let context = OfflineAudioContext::new_inherited(channel_count, length, sample_rate); reflect_dom_object(Box::new(context), window, OfflineAudioContextBinding::Wrap) } @@ -64,7 +74,7 @@ impl OfflineAudioContext { window: &Window, options: &OfflineAudioContextOptions, ) -> Fallible> { - Ok(OfflineAudioContext::new(window, options)) + Ok(OfflineAudioContext::new(window, options.numberOfChannels, options.length, *options.sampleRate)) } pub fn Constructor_( @@ -82,11 +92,7 @@ impl OfflineAudioContext { return Err(Error::NotSupported); } - let mut options = OfflineAudioContextOptions::empty(); - options.numberOfChannels = number_of_channels; - options.length = length; - options.sampleRate = sample_rate; - Ok(OfflineAudioContext::new(window, &options)) + Ok(OfflineAudioContext::new(window, number_of_channels, length, *sample_rate)) } } @@ -166,13 +172,3 @@ impl OfflineAudioContextMethods for OfflineAudioContext { promise } } - -impl<'a> From<&'a OfflineAudioContextOptions> for ServoMediaOfflineAudioContextOptions { - fn from(options: &OfflineAudioContextOptions) -> Self { - Self { - channels: options.numberOfChannels as u8, - length: options.length as usize, - sample_rate: *options.sampleRate, - } - } -} diff --git a/components/script/dom/webidls/OfflineAudioContext.webidl b/components/script/dom/webidls/OfflineAudioContext.webidl index 688d4ec6f0a..0155f9eb73d 100644 --- a/components/script/dom/webidls/OfflineAudioContext.webidl +++ b/components/script/dom/webidls/OfflineAudioContext.webidl @@ -8,12 +8,12 @@ dictionary OfflineAudioContextOptions { unsigned long numberOfChannels = 1; - unsigned long length = 0; - float sampleRate = 48000.; + required unsigned long length; + required float sampleRate; }; [Exposed=Window, - Constructor (optional OfflineAudioContextOptions contextOptions), + Constructor (OfflineAudioContextOptions contextOptions), Constructor (unsigned long numberOfChannels, unsigned long length, float sampleRate)] interface OfflineAudioContext : BaseAudioContext { readonly attribute unsigned long length; From b738d9a912fc04aa22da5751995c51cd80c2a1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 30 Jul 2018 19:54:55 +0200 Subject: [PATCH 83/87] Throw if AudioBufferSourceNode.Start params are negative --- components/script/dom/audiobuffer.rs | 22 +++++++------------ .../script/dom/audiobuffersourcenode.rs | 22 +++++++++++++++++-- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 1119b3c868e..c95a04cdac3 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -40,11 +40,7 @@ pub struct AudioBuffer { impl AudioBuffer { #[allow(unrooted_must_root)] #[allow(unsafe_code)] - pub fn new_inherited( - number_of_channels: u32, - length: u32, - sample_rate: f32, - ) -> AudioBuffer { + pub fn new_inherited(number_of_channels: u32, length: u32, sample_rate: f32) -> AudioBuffer { let vec = (0..number_of_channels).map(|_| Heap::default()).collect(); AudioBuffer { reflector_: Reflector::new(), @@ -68,11 +64,7 @@ impl AudioBuffer { sample_rate: f32, initial_data: Option<&[f32]>, ) -> DomRoot { - let buffer = AudioBuffer::new_inherited( - number_of_channels, - length, - sample_rate, - ); + let buffer = AudioBuffer::new_inherited(number_of_channels, length, sample_rate); let buffer = reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap); buffer.set_channels(initial_data); buffer @@ -84,8 +76,9 @@ impl AudioBuffer { options: &AudioBufferOptions, ) -> Fallible> { if options.numberOfChannels > MAX_CHANNEL_COUNT || - *options.sampleRate < MIN_SAMPLE_RATE || - *options.sampleRate > MAX_SAMPLE_RATE { + *options.sampleRate < MIN_SAMPLE_RATE || + *options.sampleRate > MAX_SAMPLE_RATE + { return Err(Error::NotSupported); } Ok(AudioBuffer::new( @@ -124,7 +117,7 @@ impl AudioBuffer { array.handle_mut(), ) }; - } + }, } chans[channel as usize].set(array.get()); } @@ -167,7 +160,8 @@ impl AudioBuffer { typedarray!(in(cx) let array: Float32Array = channel.get()); if let Ok(array) = array { let data = array.to_vec(); - let _ = JS_DetachArrayBuffer(cx, channel.handle(), DetachDataDisposition::KeepData); + let _ = + JS_DetachArrayBuffer(cx, channel.handle(), DetachDataDisposition::KeepData); data } else { return None; diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 2aad2004c20..79841e38e22 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -179,9 +179,27 @@ impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { fn Start( &self, when: Finite, - _offset: Option>, - _duration: Option>, + offset: Option>, + duration: Option>, ) -> Fallible<()> { + if *when < 0. { + return Err(Error::Range("'when' must be a positive value".to_owned())); + } + + if let Some(offset) = offset { + if *offset < 0. { + return Err(Error::Range("'offset' must be a positive value".to_owned())); + } + } + + if let Some(duration) = duration { + if *duration < 0. { + return Err(Error::Range( + "'duration' must be a positive value".to_owned(), + )); + } + } + if let Some(buffer) = self.buffer.get() { let buffer = buffer.acquire_contents(); self.source_node From a1fe48d721d8d59e91efd00fd85cc2cca217bdde Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 30 Jul 2018 12:50:02 -0700 Subject: [PATCH 84/87] Use JS_GetArrayBufferViewBuffer with JS_DetachArrayBuffer --- components/script/dom/audiobuffer.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index c95a04cdac3..3c98cd8a86c 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -11,8 +11,10 @@ use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; -use js::jsapi::{DetachDataDisposition, Heap, JSAutoCompartment, JSContext, JSObject, JS_DetachArrayBuffer}; +use js::jsapi::{DetachDataDisposition, Heap, JSAutoCompartment, JSContext, JSObject}; +use js::jsapi::JS_GetArrayBufferViewBuffer; use js::rust::CustomAutoRooterGuard; +use js::rust::wrappers::JS_DetachArrayBuffer; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; use std::cmp::min; @@ -160,8 +162,12 @@ impl AudioBuffer { typedarray!(in(cx) let array: Float32Array = channel.get()); if let Ok(array) = array { let data = array.to_vec(); - let _ = - JS_DetachArrayBuffer(cx, channel.handle(), DetachDataDisposition::KeepData); + let mut is_shared = false; + rooted!(in (cx) let view_buffer = + JS_GetArrayBufferViewBuffer(cx, channel.handle(), &mut is_shared)); + // This buffer is always created unshared + debug_assert!(!is_shared); + let _ = JS_DetachArrayBuffer(cx, view_buffer.handle(), DetachDataDisposition::KeepData); data } else { return None; From 2c19814becd2105c891238b68d435360395ce508 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 30 Jul 2018 15:21:40 -0700 Subject: [PATCH 85/87] 48000 -> 44100 --- components/script/dom/audiocontext.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index ec43498e29c..519a73972a5 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -241,7 +241,7 @@ impl From for LatencyCategory { impl<'a> From<&'a AudioContextOptions> for RealTimeAudioContextOptions { fn from(options: &AudioContextOptions) -> Self { Self { - sample_rate: *options.sampleRate.unwrap_or(Finite::wrap(48000.)), + sample_rate: *options.sampleRate.unwrap_or(Finite::wrap(44100.)), latency_hint: options.latencyHint.into(), } } From 1bb34b1aa9c7a8936b47bee5e1953f52cad0611c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 30 Jul 2018 15:23:52 -0700 Subject: [PATCH 86/87] Bump servo-media --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 290400fa191..54022a2bd90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3136,7 +3136,7 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" +source = "git+https://github.com/servo/media#06774e4a05aee58d62d3facc8388c3ff175edec0" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", @@ -3146,7 +3146,7 @@ dependencies = [ [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" +source = "git+https://github.com/servo/media#06774e4a05aee58d62d3facc8388c3ff175edec0" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3158,7 +3158,7 @@ dependencies = [ [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" +source = "git+https://github.com/servo/media#06774e4a05aee58d62d3facc8388c3ff175edec0" dependencies = [ "byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3176,7 +3176,7 @@ dependencies = [ [[package]] name = "servo-media-player" version = "0.1.0" -source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" +source = "git+https://github.com/servo/media#06774e4a05aee58d62d3facc8388c3ff175edec0" [[package]] name = "servo-skia" @@ -3273,7 +3273,7 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#e5183ddee5249707c57eb49a76bc7587d5a73216" +source = "git+https://github.com/servo/media#06774e4a05aee58d62d3facc8388c3ff175edec0" dependencies = [ "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", From 2daf9ff3eb3006101b36aa2e1a31b9024d9f3b0d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 30 Jul 2018 17:35:53 -0700 Subject: [PATCH 87/87] Update wpt expectations --- .../wpt/metadata/webaudio/historical.html.ini | 13 + .../webaudio/idlharness.https.html.ini | 4 - .../webaudio/idlharness.https.window.js.ini | 4 + .../audiobuffersource-basic.html.ini | 10 +- .../audiobuffersource-ended.html.ini | 2 +- .../audiobuffersource-grain.html.ini | 2 - .../audiobuffersource-multi-channels.html.ini | 2 +- ...audiobuffersource-one-sample-loop.html.ini | 10 +- .../audiobuffersource-start.html.ini | 28 +- .../audiosource-onended.html.ini | 2 - .../audiosource-time-limits.html.ini | 16 +- .../note-grain-on-play.html.ini | 2 +- .../note-grain-on-timing.html.ini | 22 +- .../sample-accurate-scheduling.html.ini | 13 +- .../audiocontextoptions.html.ini | 17 +- .../audionode-disconnect.html.ini | 2 +- .../channel-mode-interp-basic.html.ini | 2 - ...aram-exponentialRampToValueAtTime.html.ini | 307 ++++++++++++++++- .../audioparam-large-endtime.html.ini | 2 - ...udioparam-linearRampToValueAtTime.html.ini | 307 ++++++++++++++++- .../audioparam-setTargetAtTime.html.ini | 310 +++++++++++++++++- .../audioparam-setValueAtTime.html.ini | 2 - ...etAtTime-after-event-within-block.html.ini | 1 - .../setValueAtTime-within-block.html.ini | 1 - .../test-gainnode.html.ini | 2 +- .../ctor-offlineaudiocontext.html.ini | 3 + .../current-time-block-size.html.ini | 5 - .../panner-distance-clamping.html.ini | 3 + 28 files changed, 1058 insertions(+), 36 deletions(-) create mode 100644 tests/wpt/metadata/webaudio/historical.html.ini delete mode 100644 tests/wpt/metadata/webaudio/idlharness.https.html.ini create mode 100644 tests/wpt/metadata/webaudio/idlharness.https.window.js.ini delete mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini delete mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini delete mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini delete mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini delete mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini delete mode 100644 tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini diff --git a/tests/wpt/metadata/webaudio/historical.html.ini b/tests/wpt/metadata/webaudio/historical.html.ini new file mode 100644 index 00000000000..3279a2dc99f --- /dev/null +++ b/tests/wpt/metadata/webaudio/historical.html.ini @@ -0,0 +1,13 @@ +[historical.html] + [dopplerFactor member should not exist on the AudioListener.] + expected: FAIL + + [speedOfSound member should not exist on the AudioListener.] + expected: FAIL + + [setVelocity member should not exist on the AudioListener.] + expected: FAIL + + [setVelocity should not exist on PannerNodes.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/idlharness.https.html.ini b/tests/wpt/metadata/webaudio/idlharness.https.html.ini deleted file mode 100644 index 64d4148b7a2..00000000000 --- a/tests/wpt/metadata/webaudio/idlharness.https.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[idlharness.https.html] - [WebAudio IDL tests] - expected: FAIL - diff --git a/tests/wpt/metadata/webaudio/idlharness.https.window.js.ini b/tests/wpt/metadata/webaudio/idlharness.https.window.js.ini new file mode 100644 index 00000000000..6357a1f2de5 --- /dev/null +++ b/tests/wpt/metadata/webaudio/idlharness.https.window.js.ini @@ -0,0 +1,4 @@ +[idlharness.https.window.html] + [idlharness] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini index c4a1a127826..85539401e15 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-basic.html.ini @@ -1,5 +1,4 @@ [audiobuffersource-basic.html] - expected: ERROR [X start(-1) did not throw an exception.] expected: FAIL @@ -9,3 +8,12 @@ [X start(0,0,-1) threw "InvalidStateError" instead of function RangeError() {\n [native code\]\n}.] expected: FAIL + [X stop(-1) did not throw an exception.] + expected: FAIL + + [< [start/stop exceptions\] 1 out of 12 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini index 6d26244d4cb..9a7eb9930ba 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-ended.html.ini @@ -1,2 +1,2 @@ [audiobuffersource-ended.html] - expected: ERROR + expected: TIMEOUT diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini deleted file mode 100644 index e91945998e8..00000000000 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-grain.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[audiobuffersource-grain.html] - expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini index d85973ca825..dbb920ce081 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini @@ -1,2 +1,2 @@ [audiobuffersource-multi-channels.html] - expected: ERROR + expected: TIMEOUT diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini index e0cf64c8248..ec4723759dc 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini @@ -1,2 +1,10 @@ [audiobuffersource-one-sample-loop.html] - expected: ERROR + [X Rendered data: Expected 1 for all values but found 998 unexpected values: \n\tIndex\tActual\n\t[1\]\t0\n\t[2\]\t0\n\t[3\]\t0\n\t[4\]\t0\n\t...and 994 more errors.] + expected: FAIL + + [< [one-sample-loop\] 1 out of 1 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini index b63ac8ba155..57682be74f1 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-start.html.ini @@ -1,2 +1,28 @@ [audiobuffersource-start.html] - expected: ERROR + [X Case 0: start(when): implicitly play whole buffer from beginning to end expected to be equal to the array [0,1,2,3,4,5,6,7,0,0,0,0,0,0,0,0...\] but differs in 7 places:\n\tIndex\tActual\t\t\tExpected\n\t[1\]\t9.0000000000000000e+0\t1.0000000000000000e+0\n\t[2\]\t1.8000000000000000e+1\t2.0000000000000000e+0\n\t[3\]\t2.7000000000000000e+1\t3.0000000000000000e+0\n\t[4\]\t3.6000000000000000e+1\t4.0000000000000000e+0\n\t...and 3 more errors.] + expected: FAIL + + [X Case 1: start(when, 0): play whole buffer from beginning to end explicitly giving offset of 0 expected to be equal to the array [0,1,2,3,4,5,6,7,0,0,0,0,0,0,0,0...\] but differs in 7 places:\n\tIndex\tActual\t\t\tExpected\n\t[1\]\t0.0000000000000000e+0\t1.0000000000000000e+0\n\t[2\]\t0.0000000000000000e+0\t2.0000000000000000e+0\n\t[3\]\t0.0000000000000000e+0\t3.0000000000000000e+0\n\t[4\]\t0.0000000000000000e+0\t4.0000000000000000e+0\n\t...and 3 more errors.] + expected: FAIL + + [X Case 2: start(when, 0, 8_frames): play whole buffer from beginning to end explicitly giving offset of 0 and duration of 8 frames expected to be equal to the array [0,1,2,3,4,5,6,7,0,0,0,0,0,0,0,0...\] but differs in 7 places:\n\tIndex\tActual\t\t\tExpected\n\t[1\]\t0.0000000000000000e+0\t1.0000000000000000e+0\n\t[2\]\t0.0000000000000000e+0\t2.0000000000000000e+0\n\t[3\]\t0.0000000000000000e+0\t3.0000000000000000e+0\n\t[4\]\t0.0000000000000000e+0\t4.0000000000000000e+0\n\t...and 3 more errors.] + expected: FAIL + + [X Case 3: start(when, 4_frames): play with explicit non-zero offset expected to be equal to the array [4,5,6,7,0,0,0,0,0,0,0,0,0,0,0,0...\] but differs in 4 places:\n\tIndex\tActual\t\t\tExpected\n\t[0\]\t0.0000000000000000e+0\t4.0000000000000000e+0\n\t[1\]\t0.0000000000000000e+0\t5.0000000000000000e+0\n\t[2\]\t0.0000000000000000e+0\t6.0000000000000000e+0\n\t[3\]\t0.0000000000000000e+0\t7.0000000000000000e+0\n\t...and 0 more errors.] + expected: FAIL + + [X Case 4: start(when, 4_frames, 4_frames): play with explicit non-zero offset and duration expected to be equal to the array [4,5,6,7,0,0,0,0,0,0,0,0,0,0,0,0...\] but differs in 4 places:\n\tIndex\tActual\t\t\tExpected\n\t[0\]\t0.0000000000000000e+0\t4.0000000000000000e+0\n\t[1\]\t0.0000000000000000e+0\t5.0000000000000000e+0\n\t[2\]\t0.0000000000000000e+0\t6.0000000000000000e+0\n\t[3\]\t0.0000000000000000e+0\t7.0000000000000000e+0\n\t...and 0 more errors.] + expected: FAIL + + [X Case 5: start(when, 7_frames): play with explicit non-zero offset near end of buffer expected to be equal to the array [7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...\] but differs in 1 places:\n\tIndex\tActual\t\t\tExpected\n\t[0\]\t0.0000000000000000e+0\t7.0000000000000000e+0] + expected: FAIL + + [X Case 8: start(when, 0, 15_frames): play with whole buffer, with long duration (clipped) expected to be equal to the array [0,1,2,3,4,5,6,7,0,0,0,0,0,0,0,0...\] but differs in 7 places:\n\tIndex\tActual\t\t\tExpected\n\t[1\]\t0.0000000000000000e+0\t1.0000000000000000e+0\n\t[2\]\t0.0000000000000000e+0\t2.0000000000000000e+0\n\t[3\]\t0.0000000000000000e+0\t3.0000000000000000e+0\n\t[4\]\t0.0000000000000000e+0\t4.0000000000000000e+0\n\t...and 3 more errors.] + expected: FAIL + + [< [Tests AudioBufferSourceNode start()\] 7 out of 18 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini deleted file mode 100644 index 57fb1bf99f3..00000000000 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-onended.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[audiosource-onended.html] - expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini index b1b1fdea573..d053c0ab346 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini @@ -1,2 +1,16 @@ [audiosource-time-limits.html] - expected: ERROR + [X Output from AudioBufferSource.stop(1e+300): Expected 1 for all values but found 999 unexpected values: \n\tIndex\tActual\n\t[0\]\t0\n\t[1\]\t0\n\t[2\]\t0\n\t[3\]\t0\n\t...and 995 more errors.] + expected: FAIL + + [< [buffersource: huge stop time\] 1 out of 1 assertions were failed.] + expected: FAIL + + [X Peak amplitude from oscillator.stop(1e+300) is not greater than 0. Got 0.] + expected: FAIL + + [< [oscillator: huge stop time\] 1 out of 1 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 2 out of 2 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini index dcc2b107271..9436c34dc50 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-play.html.ini @@ -1,2 +1,2 @@ [note-grain-on-play.html] - expected: ERROR + expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini index a6ee1a51c20..b9048a3781b 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/note-grain-on-timing.html.ini @@ -1,2 +1,22 @@ [note-grain-on-timing.html] - expected: ERROR + [X Number of start frames is not equal to 100. Got 1.] + expected: FAIL + + [X Number of end frames is not equal to 100. Got 1.] + expected: FAIL + + [X Pulse 0 boundary expected to be equal to the array [0,441\] but differs in 1 places:\n\tIndex\tActual\t\t\tExpected\n\t[1\]\t4.8520000000000000e+3\t4.4100000000000000e+2] + expected: FAIL + + [X Number of grains that started at the correct time is not equal to 100. Got 1.] + expected: FAIL + + [X Number of grains out of 100 that ended at the wrong time is not equal to 0. Got 1.] + expected: FAIL + + [< [Test timing of noteGrainOn\] 5 out of 6 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini index 3d60a2897b1..2ee30ad13b8 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini @@ -1,2 +1,13 @@ [sample-accurate-scheduling.html] - expected: ERROR + [X Non-zero sample found at sample offset 176399 is not true. Got false.] + expected: FAIL + + [X Number of impulses found is not equal to 9. Got 2.] + expected: FAIL + + [< [test\] 2 out of 4 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini index 2eaee7d5a46..d9038be4060 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html.ini @@ -1,2 +1,17 @@ [audiocontextoptions.html] - expected: CRASH + expected: TIMEOUT + [X default baseLatency is not greater than 0. Got 0.] + expected: FAIL + + [< [test-audiocontextoptions-latencyHint-basic\] 1 out of 9 assertions were failed.] + expected: FAIL + + [X context = new AudioContext({'latencyHint': interactiveLatency/2}) incorrectly threw TypeError: "'0' is not a valid enum value for enumeration 'AudioContextLatencyCategory'.".] + expected: FAIL + + [X context = new AudioContext({'latencyHint': validLatency}) incorrectly threw TypeError: "'0' is not a valid enum value for enumeration 'AudioContextLatencyCategory'.".] + expected: FAIL + + [X creating two high latency contexts incorrectly threw TypeError: "'0' is not a valid enum value for enumeration 'AudioContextLatencyCategory'.".] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini index 45d61e35bb6..f7cf32b3f68 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect.html.ini @@ -1,2 +1,2 @@ [audionode-disconnect.html] - expected: ERROR + expected: TIMEOUT diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini deleted file mode 100644 index ba388d1c837..00000000000 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audionode-interface/channel-mode-interp-basic.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[channel-mode-interp-basic.html] - expected: CRASH diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini index 96150248f5b..4058485dd3c 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime.html.ini @@ -1,2 +1,307 @@ [audioparam-exponentialRampToValueAtTime.html] - expected: ERROR + [X Max error for test 0 at offset 1322 is not less than or equal to 0.00001222. Got 0.004971347529273832.] + expected: FAIL + + [X Max error for test 1 at offset 2645 is not less than or equal to 0.00001222. Got 0.00507232754748583.] + expected: FAIL + + [X Max error for test 2 at offset 3968 is not less than or equal to 0.00001222. Got 0.005072288986783049.] + expected: FAIL + + [X Max error for test 3 at offset 5291 is not less than or equal to 0.00001222. Got 0.005177453099763553.] + expected: FAIL + + [X Max error for test 4 at offset 6614 is not less than or equal to 0.00001222. Got 0.005177414562697979.] + expected: FAIL + + [X Max error for test 5 at offset 7937 is not less than or equal to 0.00001222. Got 0.005287028393264749.] + expected: FAIL + + [X Max error for test 6 at offset 9260 is not less than or equal to 0.00001222. Got 0.005286989916402489.] + expected: FAIL + + [X Max error for test 7 at offset 10583 is not less than or equal to 0.00001222. Got 0.005401342058686055.] + expected: FAIL + + [X Max error for test 8 at offset 11906 is not less than or equal to 0.00001222. Got 0.00540130368332191.] + expected: FAIL + + [X Max error for test 9 at offset 13229 is not less than or equal to 0.00001222. Got 0.005520708240934441.] + expected: FAIL + + [X Max error for test 10 at offset 14552 is not less than or equal to 0.00001222. Got 0.005520670013722852.] + expected: FAIL + + [X Max error for test 11 at offset 15875 is not less than or equal to 0.00001222. Got 0.005645469482076645.] + expected: FAIL + + [X Max error for test 12 at offset 17198 is not less than or equal to 0.00001222. Got 0.005645431455758545.] + expected: FAIL + + [X Max error for test 13 at offset 18521 is not less than or equal to 0.00001222. Got 0.005776000004233634.] + expected: FAIL + + [X Max error for test 14 at offset 19844 is not less than or equal to 0.00001222. Got 0.0057759622384759915.] + expected: FAIL + + [X Max error for test 15 at offset 21167 is not less than or equal to 0.00001222. Got 0.0059127094586828586.] + expected: FAIL + + [X Max error for test 16 at offset 22490 is not less than or equal to 0.00001222. Got 0.005912672021051084.] + expected: FAIL + + [X Max error for test 17 at offset 23813 is not less than or equal to 0.00001222. Got 0.006056047220282001.] + expected: FAIL + + [X Max error for test 18 at offset 25136 is not less than or equal to 0.00001222. Got 0.006056010187369548.] + expected: FAIL + + [X Max error for test 19 at offset 26459 is not less than or equal to 0.00001222. Got 0.006206507322052307.] + expected: FAIL + + [X Max error for test 20 at offset 27782 is not less than or equal to 0.00001222. Got 0.006206470780796884.] + expected: FAIL + + [X Max error for test 21 at offset 29105 is not less than or equal to 0.00001222. Got 0.0063646341440895165.] + expected: FAIL + + [X Max error for test 22 at offset 30428 is not less than or equal to 0.00001222. Got 0.00636459819331172.] + expected: FAIL + + [X Max error for test 23 at offset 31751 is not less than or equal to 0.00001222. Got 0.006531028994848638.] + expected: FAIL + + [X Max error for test 24 at offset 33074 is not less than or equal to 0.00001222. Got 0.0065309937470566844.] + expected: FAIL + + [X Max error for test 25 at offset 34397 is not less than or equal to 0.00001222. Got 0.006706357752496105.] + expected: FAIL + + [X Max error for test 26 at offset 35720 is not less than or equal to 0.00001222. Got 0.006706323336010292.] + expected: FAIL + + [X Max error for test 27 at offset 37043 is not less than or equal to 0.00001222. Got 0.006891359771030949.] + expected: FAIL + + [X Max error for test 28 at offset 38366 is not less than or equal to 0.00001222. Got 0.00689132633249392.] + expected: FAIL + + [X Max error for test 29 at offset 39689 is not less than or equal to 0.00001222. Got 0.007086858302333446.] + expected: FAIL + + [X Max error for test 30 at offset 41012 is not less than or equal to 0.00001222. Got 0.007086826009688193.] + expected: FAIL + + [X Max error for test 31 at offset 42335 is not less than or equal to 0.00001222. Got 0.007293772743964152.] + expected: FAIL + + [X Max error for test 32 at offset 43658 is not less than or equal to 0.00001222. Got 0.0072937417900018064.] + expected: FAIL + + [X Max error for test 33 at offset 44981 is not less than or equal to 0.00001222. Got 0.007513133097079656.] + expected: FAIL + + [X Max error for test 34 at offset 46304 is not less than or equal to 0.00001222. Got 0.007513103703685007.] + expected: FAIL + + [X Max error for test 35 at offset 47627 is not less than or equal to 0.00001222. Got 0.0077460971141775446.] + expected: FAIL + + [X Max error for test 36 at offset 48950 is not less than or equal to 0.00001222. Got 0.00774606953743358.] + expected: FAIL + + [X Max error for test 37 at offset 50273 is not less than or equal to 0.00001222. Got 0.00799390921649094.] + expected: FAIL + + [X Max error for test 38 at offset 51596 is not less than or equal to 0.00001222. Got 0.007993945275544895.] + expected: FAIL + + [X Max error for test 39 at offset 52919 is not less than or equal to 0.00001222. Got 0.008258169028622094.] + expected: FAIL + + [X Max error for test 40 at offset 54242 is not less than or equal to 0.00001222. Got 0.008258272128077778.] + expected: FAIL + + [X Max error for test 41 at offset 55565 is not less than or equal to 0.00001222. Got 0.008540497771090037.] + expected: FAIL + + [X Max error for test 42 at offset 56888 is not less than or equal to 0.00001222. Got 0.008540543388584421.] + expected: FAIL + + [X Max error for test 43 at offset 58211 is not less than or equal to 0.00001222. Got 0.008842814255529671.] + expected: FAIL + + [X Max error for test 44 at offset 59534 is not less than or equal to 0.00001222. Got 0.008842932469887153.] + expected: FAIL + + [X Max error for test 45 at offset 60857 is not less than or equal to 0.00001222. Got 0.009167318952047627.] + expected: FAIL + + [X Max error for test 46 at offset 62180 is not less than or equal to 0.00001222. Got 0.009167376648625705.] + expected: FAIL + + [X Max error for test 47 at offset 63503 is not less than or equal to 0.00001222. Got 0.009516547638069068.] + expected: FAIL + + [X Max error for test 48 at offset 64826 is not less than or equal to 0.00001222. Got 0.009516684552275934.] + expected: FAIL + + [X Max error for test 49 at offset 66149 is not less than or equal to 0.00001222. Got 0.009893514080660987.] + expected: FAIL + + [X Max error for test 50 at offset 67472 is not less than or equal to 0.00001222. Got 0.009893510977195341.] + expected: FAIL + + [X Max error for test 51 at offset 68795 is not less than or equal to 0.00001222. Got 0.010301411434863215.] + expected: FAIL + + [X Max error for test 52 at offset 70118 is not less than or equal to 0.00001222. Got 0.010301571864146954.] + expected: FAIL + + [X Max error for test 53 at offset 71441 is not less than or equal to 0.00001222. Got 0.010744562213274482.] + expected: FAIL + + [X Max error for test 54 at offset 72764 is not less than or equal to 0.00001222. Got 0.010744572666723327.] + expected: FAIL + + [X Max error for test 55 at offset 74087 is not less than or equal to 0.00001222. Got 0.01122737314374763.] + expected: FAIL + + [X Max error for test 56 at offset 75410 is not less than or equal to 0.00001222. Got 0.011227478948691283.] + expected: FAIL + + [X Max error for test 57 at offset 76733 is not less than or equal to 0.00001222. Got 0.01175580623231679.] + expected: FAIL + + [X Max error for test 58 at offset 78056 is not less than or equal to 0.00001222. Got 0.011755835641619888.] + expected: FAIL + + [X Max error for test 59 at offset 79379 is not less than or equal to 0.00001222. Got 0.012336239163652849.] + expected: FAIL + + [X Max error for test 60 at offset 80702 is not less than or equal to 0.00001222. Got 0.012336376203148012.] + expected: FAIL + + [X Max error for test 61 at offset 82025 is not less than or equal to 0.00001222. Got 0.012977176838334303.] + expected: FAIL + + [X Max error for test 62 at offset 83348 is not less than or equal to 0.00001222. Got 0.01297723326480682.] + expected: FAIL + + [X Max error for test 63 at offset 84671 is not less than or equal to 0.00001222. Got 0.013688247738325734.] + expected: FAIL + + [X Max error for test 64 at offset 85994 is not less than or equal to 0.00001222. Got 0.013688321971339096.] + expected: FAIL + + [X Max error for test 65 at offset 87317 is not less than or equal to 0.00001222. Got 0.014481760747876011.] + expected: FAIL + + [X Max error for test 66 at offset 88640 is not less than or equal to 0.00001222. Got 0.014481856656908305.] + expected: FAIL + + [X Max error for test 67 at offset 89963 is not less than or equal to 0.00001222. Got 0.01537293577367861.] + expected: FAIL + + [X Max error for test 68 at offset 91286 is not less than or equal to 0.00001222. Got 0.015373058296300991.] + expected: FAIL + + [X Max error for test 69 at offset 92609 is not less than or equal to 0.00001222. Got 0.016380921220530496.] + expected: FAIL + + [X Max error for test 70 at offset 93932 is not less than or equal to 0.00001222. Got 0.016381078788684566.] + expected: FAIL + + [X Max error for test 71 at offset 95255 is not less than or equal to 0.00001222. Got 0.01753058059001621.] + expected: FAIL + + [X Max error for test 72 at offset 96578 is not less than or equal to 0.00001222. Got 0.01753077514543058.] + expected: FAIL + + [X Max error for test 73 at offset 97901 is not less than or equal to 0.00001222. Got 0.018853551375474058.] + expected: FAIL + + [X Max error for test 74 at offset 99224 is not less than or equal to 0.00001222. Got 0.018853800846327963.] + expected: FAIL + + [X Max error for test 75 at offset 100547 is not less than or equal to 0.00001222. Got 0.020392593309963868.] + expected: FAIL + + [X Max error for test 76 at offset 101870 is not less than or equal to 0.00001222. Got 0.02039291059393737.] + expected: FAIL + + [X Max error for test 77 at offset 103193 is not less than or equal to 0.00001222. Got 0.022205238153527315.] + expected: FAIL + + [X Max error for test 78 at offset 104516 is not less than or equal to 0.00001222. Got 0.022205561601247308.] + expected: FAIL + + [X Max error for test 79 at offset 105839 is not less than or equal to 0.00001222. Got 0.024371468038865658.] + expected: FAIL + + [X Max error for test 80 at offset 107162 is not less than or equal to 0.00001222. Got 0.024372089145737547.] + expected: FAIL + + [X Max error for test 81 at offset 108485 is not less than or equal to 0.00001222. Got 0.0270063795920686.] + expected: FAIL + + [X Max error for test 82 at offset 109808 is not less than or equal to 0.00001222. Got 0.027006863607415388.] + expected: FAIL + + [X Max error for test 83 at offset 111131 is not less than or equal to 0.00001222. Got 0.030279806361083936.] + expected: FAIL + + [X Max error for test 84 at offset 112454 is not less than or equal to 0.00001222. Got 0.030280498895388284.] + expected: FAIL + + [X Max error for test 85 at offset 113777 is not less than or equal to 0.00001222. Got 0.03445622424898759.] + expected: FAIL + + [X Max error for test 86 at offset 115100 is not less than or equal to 0.00001222. Got 0.03445703934642761.] + expected: FAIL + + [X Max error for test 87 at offset 116423 is not less than or equal to 0.00001222. Got 0.03996905609650592.] + expected: FAIL + + [X Max error for test 88 at offset 117746 is not less than or equal to 0.00001222. Got 0.03997048249087859.] + expected: FAIL + + [X Max error for test 89 at offset 119069 is not less than or equal to 0.00001222. Got 0.04758232055157862.] + expected: FAIL + + [X Max error for test 90 at offset 120392 is not less than or equal to 0.00001222. Got 0.047584013396256356.] + expected: FAIL + + [X Max error for test 91 at offset 121715 is not less than or equal to 0.00001222. Got 0.05877779461906339.] + expected: FAIL + + [X Max error for test 92 at offset 123038 is not less than or equal to 0.00001222. Got 0.05878033819291966.] + expected: FAIL + + [X Max error for test 93 at offset 124361 is not less than or equal to 0.00001222. Got 0.07686264332095362.] + expected: FAIL + + [X Max error for test 94 at offset 125684 is not less than or equal to 0.00001222. Got 0.07686707196371474.] + expected: FAIL + + [X Max error for test 95 at offset 127007 is not less than or equal to 0.00001222. Got 0.1110222263568349.] + expected: FAIL + + [X Max error for test 96 at offset 128330 is not less than or equal to 0.00001222. Got 0.11103236124822866.] + expected: FAIL + + [X Max error for test 97 at offset 129653 is not less than or equal to 0.00001222. Got 0.19983522770615608.] + expected: FAIL + + [X Max error for test 98 at offset 130976 is not less than or equal to 0.00001222. Got 0.19986539483609111.] + expected: FAIL + + [X Max error for test 99 at offset 130979 is not less than or equal to 0.00001222. Got 0.0010478736613536294.] + expected: FAIL + + [< [test\] 100 out of 102 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini deleted file mode 100644 index eacbf1d55b1..00000000000 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[audioparam-large-endtime.html] - expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini index 26787ed164e..f18dbc82cda 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime.html.ini @@ -1,2 +1,307 @@ [audioparam-linearRampToValueAtTime.html] - expected: ERROR + [X Max error for test 0 at offset 1322 is not less than or equal to 0.000001865. Got 0.004971382585870938.] + expected: FAIL + + [X Max error for test 1 at offset 2645 is not less than or equal to 0.000001865. Got 0.005072295510229919.] + expected: FAIL + + [X Max error for test 2 at offset 3968 is not less than or equal to 0.000001865. Got 0.005072305387543696.] + expected: FAIL + + [X Max error for test 3 at offset 5291 is not less than or equal to 0.000001865. Got 0.005177440159265024.] + expected: FAIL + + [X Max error for test 4 at offset 6614 is not less than or equal to 0.000001865. Got 0.005177473300879752.] + expected: FAIL + + [X Max error for test 5 at offset 7937 is not less than or equal to 0.000001865. Got 0.005286972284210275.] + expected: FAIL + + [X Max error for test 6 at offset 9260 is not less than or equal to 0.000001865. Got 0.005287029709955556.] + expected: FAIL + + [X Max error for test 7 at offset 10583 is not less than or equal to 0.000001865. Got 0.005401305351315997.] + expected: FAIL + + [X Max error for test 8 at offset 11906 is not less than or equal to 0.000001865. Got 0.005401323712834355.] + expected: FAIL + + [X Max error for test 9 at offset 13229 is not less than or equal to 0.000001865. Got 0.005520691792549967.] + expected: FAIL + + [X Max error for test 10 at offset 14552 is not less than or equal to 0.000001865. Got 0.00552073526720557.] + expected: FAIL + + [X Max error for test 11 at offset 15875 is not less than or equal to 0.000001865. Got 0.005645406858491471.] + expected: FAIL + + [X Max error for test 12 at offset 17198 is not less than or equal to 0.000001865. Got 0.005645476626856955.] + expected: FAIL + + [X Max error for test 13 at offset 18521 is not less than or equal to 0.000001865. Got 0.0057759579767177206.] + expected: FAIL + + [X Max error for test 14 at offset 19844 is not less than or equal to 0.000001865. Got 0.005775986398284702.] + expected: FAIL + + [X Max error for test 15 at offset 21167 is not less than or equal to 0.000001865. Got 0.005912689001894731.] + expected: FAIL + + [X Max error for test 16 at offset 22490 is not less than or equal to 0.000001865. Got 0.005912744713046106.] + expected: FAIL + + [X Max error for test 17 at offset 23813 is not less than or equal to 0.000001865. Got 0.006055977132018537.] + expected: FAIL + + [X Max error for test 18 at offset 25136 is not less than or equal to 0.000001865. Got 0.006056061515967637.] + expected: FAIL + + [X Max error for test 19 at offset 26459 is not less than or equal to 0.000001865. Got 0.00620645917849245.] + expected: FAIL + + [X Max error for test 20 at offset 27782 is not less than or equal to 0.000001865. Got 0.0062064996841445265.] + expected: FAIL + + [X Max error for test 21 at offset 29105 is not less than or equal to 0.000001865. Got 0.006364609063030028.] + expected: FAIL + + [X Max error for test 22 at offset 30428 is not less than or equal to 0.000001865. Got 0.006364679458219021.] + expected: FAIL + + [X Max error for test 23 at offset 31751 is not less than or equal to 0.000001865. Got 0.006530950267540621.] + expected: FAIL + + [X Max error for test 24 at offset 33074 is not less than or equal to 0.000001865. Got 0.0065310521960605565.] + expected: FAIL + + [X Max error for test 25 at offset 34397 is not less than or equal to 0.000001865. Got 0.006706302503957123.] + expected: FAIL + + [X Max error for test 26 at offset 35720 is not less than or equal to 0.000001865. Got 0.006706357743664959.] + expected: FAIL + + [X Max error for test 27 at offset 37043 is not less than or equal to 0.000001865. Got 0.0068913292960890915.] + expected: FAIL + + [X Max error for test 28 at offset 38366 is not less than or equal to 0.000001865. Got 0.006891335371900766.] + expected: FAIL + + [X Max error for test 29 at offset 39689 is not less than or equal to 0.000001865. Got 0.007086769460824398.] + expected: FAIL + + [X Max error for test 30 at offset 41012 is not less than or equal to 0.000001865. Got 0.007086892787027758.] + expected: FAIL + + [X Max error for test 31 at offset 42335 is not less than or equal to 0.000001865. Got 0.007293709140558525.] + expected: FAIL + + [X Max error for test 32 at offset 43658 is not less than or equal to 0.000001865. Got 0.0072937826617006625.] + expected: FAIL + + [X Max error for test 33 at offset 44981 is not less than or equal to 0.000001865. Got 0.007513096249085025.] + expected: FAIL + + [X Max error for test 34 at offset 46304 is not less than or equal to 0.000001865. Got 0.007513117110837575.] + expected: FAIL + + [X Max error for test 35 at offset 47627 is not less than or equal to 0.000001865. Got 0.007745996270211642.] + expected: FAIL + + [X Max error for test 36 at offset 48950 is not less than or equal to 0.000001865. Got 0.007746146186898846.] + expected: FAIL + + [X Max error for test 37 at offset 50273 is not less than or equal to 0.000001865. Got 0.007993897169413747.] + expected: FAIL + + [X Max error for test 38 at offset 51596 is not less than or equal to 0.000001865. Got 0.007993993846002342.] + expected: FAIL + + [X Max error for test 39 at offset 52919 is not less than or equal to 0.000001865. Got 0.008258188108327222.] + expected: FAIL + + [X Max error for test 40 at offset 54242 is not less than or equal to 0.000001865. Got 0.008258228229559253.] + expected: FAIL + + [X Max error for test 41 at offset 55565 is not less than or equal to 0.000001865. Got 0.008540448218182686.] + expected: FAIL + + [X Max error for test 42 at offset 56888 is not less than or equal to 0.000001865. Got 0.00854063192705488.] + expected: FAIL + + [X Max error for test 43 at offset 58211 is not less than or equal to 0.000001865. Got 0.00884279670524028.] + expected: FAIL + + [X Max error for test 44 at offset 59534 is not less than or equal to 0.000001865. Got 0.008842923444757374.] + expected: FAIL + + [X Max error for test 45 at offset 60857 is not less than or equal to 0.000001865. Got 0.009167335753064386.] + expected: FAIL + + [X Max error for test 46 at offset 62180 is not less than or equal to 0.000001865. Got 0.009167401649722278.] + expected: FAIL + + [X Max error for test 47 at offset 63503 is not less than or equal to 0.000001865. Got 0.009516487875647071.] + expected: FAIL + + [X Max error for test 48 at offset 64826 is not less than or equal to 0.000001865. Got 0.009516715715078188.] + expected: FAIL + + [X Max error for test 49 at offset 66149 is not less than or equal to 0.000001865. Got 0.009893413433050018.] + expected: FAIL + + [X Max error for test 50 at offset 67472 is not less than or equal to 0.000001865. Got 0.009893580398436517.] + expected: FAIL + + [X Max error for test 51 at offset 68795 is not less than or equal to 0.000001865. Got 0.010301425392126383.] + expected: FAIL + + [X Max error for test 52 at offset 70118 is not less than or equal to 0.000001865. Got 0.010301588395931705.] + expected: FAIL + + [X Max error for test 53 at offset 71441 is not less than or equal to 0.000001865. Got 0.01074447077838395.] + expected: FAIL + + [X Max error for test 54 at offset 72764 is not less than or equal to 0.000001865. Got 0.010744630049297078.] + expected: FAIL + + [X Max error for test 55 at offset 74087 is not less than or equal to 0.000001865. Got 0.01122734013080757.] + expected: FAIL + + [X Max error for test 56 at offset 75410 is not less than or equal to 0.000001865. Got 0.011227562981803465.] + expected: FAIL + + [X Max error for test 57 at offset 76733 is not less than or equal to 0.000001865. Got 0.011755725728879002.] + expected: FAIL + + [X Max error for test 58 at offset 78056 is not less than or equal to 0.000001865. Got 0.01175594882979216.] + expected: FAIL + + [X Max error for test 59 at offset 79379 is not less than or equal to 0.000001865. Got 0.012336223486588924.] + expected: FAIL + + [X Max error for test 60 at offset 80702 is not less than or equal to 0.000001865. Got 0.012336447834689302.] + expected: FAIL + + [X Max error for test 61 at offset 82025 is not less than or equal to 0.000001865. Got 0.012977032107613464.] + expected: FAIL + + [X Max error for test 62 at offset 83348 is not less than or equal to 0.000001865. Got 0.01297733642594461.] + expected: FAIL + + [X Max error for test 63 at offset 84671 is not less than or equal to 0.000001865. Got 0.013688147253171168.] + expected: FAIL + + [X Max error for test 64 at offset 85994 is not less than or equal to 0.000001865. Got 0.01368837845955073.] + expected: FAIL + + [X Max error for test 65 at offset 87317 is not less than or equal to 0.000001865. Got 0.01448162324578537.] + expected: FAIL + + [X Max error for test 66 at offset 88640 is not less than or equal to 0.000001865. Got 0.01448194743680873.] + expected: FAIL + + [X Max error for test 67 at offset 89963 is not less than or equal to 0.000001865. Got 0.01537284838487537.] + expected: FAIL + + [X Max error for test 68 at offset 91286 is not less than or equal to 0.000001865. Got 0.015373187577813849.] + expected: FAIL + + [X Max error for test 69 at offset 92609 is not less than or equal to 0.000001865. Got 0.016380856349818174.] + expected: FAIL + + [X Max error for test 70 at offset 93932 is not less than or equal to 0.000001865. Got 0.016381215406334877.] + expected: FAIL + + [X Max error for test 71 at offset 95255 is not less than or equal to 0.000001865. Got 0.01753033724083315.] + expected: FAIL + + [X Max error for test 72 at offset 96578 is not less than or equal to 0.000001865. Got 0.017530827271874477.] + expected: FAIL + + [X Max error for test 73 at offset 97901 is not less than or equal to 0.000001865. Got 0.01885343466700245.] + expected: FAIL + + [X Max error for test 74 at offset 99224 is not less than or equal to 0.000001865. Got 0.01885396793151646.] + expected: FAIL + + [X Max error for test 75 at offset 100547 is not less than or equal to 0.000001865. Got 0.020392423027089844.] + expected: FAIL + + [X Max error for test 76 at offset 101870 is not less than or equal to 0.000001865. Got 0.020393074066344313.] + expected: FAIL + + [X Max error for test 77 at offset 103193 is not less than or equal to 0.000001865. Got 0.022205070948626313.] + expected: FAIL + + [X Max error for test 78 at offset 104516 is not less than or equal to 0.000001865. Got 0.022205803665596154.] + expected: FAIL + + [X Max error for test 79 at offset 105839 is not less than or equal to 0.000001865. Got 0.024371327061931274.] + expected: FAIL + + [X Max error for test 80 at offset 107162 is not less than or equal to 0.000001865. Got 0.02437224312212655.] + expected: FAIL + + [X Max error for test 81 at offset 108485 is not less than or equal to 0.000001865. Got 0.027006033852439857.] + expected: FAIL + + [X Max error for test 82 at offset 109808 is not less than or equal to 0.000001865. Got 0.027007111489952065.] + expected: FAIL + + [X Max error for test 83 at offset 111131 is not less than or equal to 0.000001865. Got 0.030279442811311768.] + expected: FAIL + + [X Max error for test 84 at offset 112454 is not less than or equal to 0.000001865. Got 0.03028084076877433.] + expected: FAIL + + [X Max error for test 85 at offset 113777 is not less than or equal to 0.000001865. Got 0.034455837602666496.] + expected: FAIL + + [X Max error for test 86 at offset 115100 is not less than or equal to 0.000001865. Got 0.03445758854939049.] + expected: FAIL + + [X Max error for test 87 at offset 116423 is not less than or equal to 0.000001865. Got 0.039968519116250927.] + expected: FAIL + + [X Max error for test 88 at offset 117746 is not less than or equal to 0.000001865. Got 0.03997099563742852.] + expected: FAIL + + [X Max error for test 89 at offset 119069 is not less than or equal to 0.000001865. Got 0.047581336103021205.] + expected: FAIL + + [X Max error for test 90 at offset 120392 is not less than or equal to 0.000001865. Got 0.047584752923298695.] + expected: FAIL + + [X Max error for test 91 at offset 121715 is not less than or equal to 0.000001865. Got 0.05877649592226442.] + expected: FAIL + + [X Max error for test 92 at offset 123038 is not less than or equal to 0.000001865. Got 0.05878170178485925.] + expected: FAIL + + [X Max error for test 93 at offset 124361 is not less than or equal to 0.000001865. Got 0.07686046970099752.] + expected: FAIL + + [X Max error for test 94 at offset 125684 is not less than or equal to 0.000001865. Got 0.0768694240525683.] + expected: FAIL + + [X Max error for test 95 at offset 127007 is not less than or equal to 0.000001865. Got 0.11101781971301485.] + expected: FAIL + + [X Max error for test 96 at offset 128330 is not less than or equal to 0.000001865. Got 0.11103647207884057.] + expected: FAIL + + [X Max error for test 97 at offset 129653 is not less than or equal to 0.000001865. Got 0.19981859470557914.] + expected: FAIL + + [X Max error for test 98 at offset 130976 is not less than or equal to 0.000001865. Got 0.19987906233523942.] + expected: FAIL + + [X Max error for test 99 at offset 130979 is not less than or equal to 0.000001865. Got 0.0007564072834763206.] + expected: FAIL + + [< [test\] 100 out of 102 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini index 5e01f268dac..f22e45740dd 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime.html.ini @@ -1,2 +1,310 @@ [audioparam-setTargetAtTime.html] - expected: ERROR + [X Number of tests started and ended at the correct time is not equal to 100. Got 1.] + expected: FAIL + + [X Max error for test 0 at offset 1322 is not less than or equal to 0.00065683. Got 0.990047280389914.] + expected: FAIL + + [X Max error for test 1 at offset 1323 is not less than or equal to 0.00065683. Got 0.98989898989899.] + expected: FAIL + + [X Max error for test 2 at offset 3968 is not less than or equal to 0.00065683. Got 0.9898451435112884.] + expected: FAIL + + [X Max error for test 3 at offset 3969 is not less than or equal to 0.00065683. Got 0.9896907216494846.] + expected: FAIL + + [X Max error for test 4 at offset 6614 is not less than or equal to 0.00065683. Got 0.9896346257350639.] + expected: FAIL + + [X Max error for test 5 at offset 6615 is not less than or equal to 0.00065683. Got 0.9894736842105263.] + expected: FAIL + + [X Max error for test 6 at offset 9260 is not less than or equal to 0.00065683. Got 0.9894151948002298.] + expected: FAIL + + [X Max error for test 7 at offset 9261 is not less than or equal to 0.00065683. Got 0.989247311827957.] + expected: FAIL + + [X Max error for test 8 at offset 11906 is not less than or equal to 0.00065683. Got 0.9891862723999705.] + expected: FAIL + + [X Max error for test 9 at offset 11907 is not less than or equal to 0.00065683. Got 0.989010989010989.] + expected: FAIL + + [X Max error for test 10 at offset 14552 is not less than or equal to 0.00065683. Got 0.9889472290923282.] + expected: FAIL + + [X Max error for test 11 at offset 14553 is not less than or equal to 0.00065683. Got 0.9887640449438202.] + expected: FAIL + + [X Max error for test 12 at offset 17198 is not less than or equal to 0.00065683. Got 0.9886973785205923.] + expected: FAIL + + [X Max error for test 13 at offset 17199 is not less than or equal to 0.00065683. Got 0.9885057471264368.] + expected: FAIL + + [X Max error for test 14 at offset 19844 is not less than or equal to 0.00065683. Got 0.988435970831659.] + expected: FAIL + + [X Max error for test 15 at offset 19845 is not less than or equal to 0.00065683. Got 0.9882352941176471.] + expected: FAIL + + [X Max error for test 16 at offset 22490 is not less than or equal to 0.00065683. Got 0.9881621851594479.] + expected: FAIL + + [X Max error for test 17 at offset 22491 is not less than or equal to 0.00065683. Got 0.9879518072289156.] + expected: FAIL + + [X Max error for test 18 at offset 25136 is not less than or equal to 0.00065683. Got 0.9878751210146629.] + expected: FAIL + + [X Max error for test 19 at offset 25137 is not less than or equal to 0.00065683. Got 0.9876543209876543.] + expected: FAIL + + [X Max error for test 20 at offset 27782 is not less than or equal to 0.00065683. Got 0.9875737883906436.] + expected: FAIL + + [X Max error for test 21 at offset 27783 is not less than or equal to 0.00065683. Got 0.9873417721518988.] + expected: FAIL + + [X Max error for test 22 at offset 30428 is not less than or equal to 0.00065683. Got 0.9872570963562539.] + expected: FAIL + + [X Max error for test 23 at offset 30429 is not less than or equal to 0.00065683. Got 0.987012987012987.] + expected: FAIL + + [X Max error for test 24 at offset 33074 is not less than or equal to 0.00065683. Got 0.9869238398588358.] + expected: FAIL + + [X Max error for test 25 at offset 33075 is not less than or equal to 0.00065683. Got 0.9866666666666667.] + expected: FAIL + + [X Max error for test 26 at offset 35720 is not less than or equal to 0.00065683. Got 0.9865726844007524.] + expected: FAIL + + [X Max error for test 27 at offset 35721 is not less than or equal to 0.00065683. Got 0.9863013698630136.] + expected: FAIL + + [X Max error for test 28 at offset 38366 is not less than or equal to 0.00065683. Got 0.9862021481787615.] + expected: FAIL + + [X Max error for test 29 at offset 38367 is not less than or equal to 0.00065683. Got 0.9859154929577465.] + expected: FAIL + + [X Max error for test 30 at offset 41012 is not less than or equal to 0.00065683. Got 0.9858105811822068.] + expected: FAIL + + [X Max error for test 31 at offset 41013 is not less than or equal to 0.00065683. Got 0.9855072463768116.] + expected: FAIL + + [X Max error for test 32 at offset 43658 is not less than or equal to 0.00065683. Got 0.9853961406282427.] + expected: FAIL + + [X Max error for test 33 at offset 43659 is not less than or equal to 0.00065683. Got 0.9850746268656716.] + expected: FAIL + + [X Max error for test 34 at offset 46304 is not less than or equal to 0.00065683. Got 0.9849567619626562.] + expected: FAIL + + [X Max error for test 35 at offset 46305 is not less than or equal to 0.00065683. Got 0.9846153846153847.] + expected: FAIL + + [X Max error for test 36 at offset 48950 is not less than or equal to 0.00065683. Got 0.984490124463403.] + expected: FAIL + + [X Max error for test 37 at offset 48951 is not less than or equal to 0.00065683. Got 0.9841269841269841.] + expected: FAIL + + [X Max error for test 38 at offset 51596 is not less than or equal to 0.00065683. Got 0.9839936102373862.] + expected: FAIL + + [X Max error for test 39 at offset 51597 is not less than or equal to 0.00065683. Got 0.9836065573770492.] + expected: FAIL + + [X Max error for test 40 at offset 54242 is not less than or equal to 0.00065683. Got 0.9834642550810092.] + expected: FAIL + + [X Max error for test 41 at offset 54243 is not less than or equal to 0.00065683. Got 0.9830508474576272.] + expected: FAIL + + [X Max error for test 42 at offset 56888 is not less than or equal to 0.00065683. Got 0.9828986892565407.] + expected: FAIL + + [X Max error for test 43 at offset 56889 is not less than or equal to 0.00065683. Got 0.9824561403508771.] + expected: FAIL + + [X Max error for test 44 at offset 59534 is not less than or equal to 0.00065683. Got 0.9822930656844523.] + expected: FAIL + + [X Max error for test 45 at offset 59535 is not less than or equal to 0.00065683. Got 0.9818181818181818.] + expected: FAIL + + [X Max error for test 46 at offset 62180 is not less than or equal to 0.00065683. Got 0.9816429723176522.] + expected: FAIL + + [X Max error for test 47 at offset 62181 is not less than or equal to 0.00065683. Got 0.9811320754716981.] + expected: FAIL + + [X Max error for test 48 at offset 64826 is not less than or equal to 0.00065683. Got 0.9809433244774503.] + expected: FAIL + + [X Max error for test 49 at offset 64827 is not less than or equal to 0.00065683. Got 0.9803921568627451.] + expected: FAIL + + [X Max error for test 50 at offset 67472 is not less than or equal to 0.00065683. Got 0.9801882315933432.] + expected: FAIL + + [X Max error for test 51 at offset 67473 is not less than or equal to 0.00065683. Got 0.9795918367346939.] + expected: FAIL + + [X Max error for test 52 at offset 70118 is not less than or equal to 0.00065683. Got 0.97937083095423.] + expected: FAIL + + [X Max error for test 53 at offset 70119 is not less than or equal to 0.00065683. Got 0.9787234042553191.] + expected: FAIL + + [X Max error for test 54 at offset 72764 is not less than or equal to 0.00065683. Got 0.9784830785336837.] + expected: FAIL + + [X Max error for test 55 at offset 72765 is not less than or equal to 0.00065683. Got 0.9777777777777777.] + expected: FAIL + + [X Max error for test 56 at offset 75410 is not less than or equal to 0.00065683. Got 0.9775154833769094.] + expected: FAIL + + [X Max error for test 57 at offset 75411 is not less than or equal to 0.00065683. Got 0.9767441860465116.] + expected: FAIL + + [X Max error for test 58 at offset 78056 is not less than or equal to 0.00065683. Got 0.9764567669470277.] + expected: FAIL + + [X Max error for test 59 at offset 78057 is not less than or equal to 0.00065683. Got 0.975609756097561.] + expected: FAIL + + [X Max error for test 60 at offset 80702 is not less than or equal to 0.00065683. Got 0.9752934214747024.] + expected: FAIL + + [X Max error for test 61 at offset 80703 is not less than or equal to 0.00065683. Got 0.9743589743589743.] + expected: FAIL + + [X Max error for test 62 at offset 83348 is not less than or equal to 0.00065683. Got 0.9740091305612436.] + expected: FAIL + + [X Max error for test 63 at offset 83349 is not less than or equal to 0.00065683. Got 0.972972972972973.] + expected: FAIL + + [X Max error for test 64 at offset 85994 is not less than or equal to 0.00065683. Got 0.9725839991647606.] + expected: FAIL + + [X Max error for test 65 at offset 85995 is not less than or equal to 0.00065683. Got 0.9714285714285714.] + expected: FAIL + + [X Max error for test 66 at offset 88640 is not less than or equal to 0.00065683. Got 0.9709935155615783.] + expected: FAIL + + [X Max error for test 67 at offset 88641 is not less than or equal to 0.00065683. Got 0.9696969696969697.] + expected: FAIL + + [X Max error for test 68 at offset 91286 is not less than or equal to 0.00065683. Got 0.9692071297374057.] + expected: FAIL + + [X Max error for test 69 at offset 91287 is not less than or equal to 0.00065683. Got 0.967741935483871.] + expected: FAIL + + [X Max error for test 70 at offset 93932 is not less than or equal to 0.00065683. Got 0.9671862719990767.] + expected: FAIL + + [X Max error for test 71 at offset 93933 is not less than or equal to 0.00065683. Got 0.9655172413793104.] + expected: FAIL + + [X Max error for test 72 at offset 96578 is not less than or equal to 0.00065683. Got 0.9648815365865586.] + expected: FAIL + + [X Max error for test 73 at offset 96579 is not less than or equal to 0.00065683. Got 0.9629629629629629.] + expected: FAIL + + [X Max error for test 74 at offset 99224 is not less than or equal to 0.00065683. Got 0.9622285887375713.] + expected: FAIL + + [X Max error for test 75 at offset 99225 is not less than or equal to 0.00065683. Got 0.96.] + expected: FAIL + + [X Max error for test 76 at offset 101870 is not less than or equal to 0.00065683. Got 0.9591420650055538.] + expected: FAIL + + [X Max error for test 77 at offset 101871 is not less than or equal to 0.00065683. Got 0.9565217391304348.] + expected: FAIL + + [X Max error for test 78 at offset 104516 is not less than or equal to 0.00065683. Got 0.9555062168024705.] + expected: FAIL + + [X Max error for test 79 at offset 104517 is not less than or equal to 0.00065683. Got 0.9523809523809523.] + expected: FAIL + + [X Max error for test 80 at offset 107162 is not less than or equal to 0.00065683. Got 0.9511600703170818.] + expected: FAIL + + [X Max error for test 81 at offset 107163 is not less than or equal to 0.00065683. Got 0.9473684210526315.] + expected: FAIL + + [X Max error for test 82 at offset 109808 is not less than or equal to 0.00065683. Got 0.9458729474346069.] + expected: FAIL + + [X Max error for test 83 at offset 109809 is not less than or equal to 0.00065683. Got 0.9411764705882352.] + expected: FAIL + + [X Max error for test 84 at offset 112454 is not less than or equal to 0.00065683. Got 0.939302156727807.] + expected: FAIL + + [X Max error for test 85 at offset 112455 is not less than or equal to 0.00065683. Got 0.9333333333333333.] + expected: FAIL + + [X Max error for test 86 at offset 115100 is not less than or equal to 0.00065683. Got 0.9309156097430662.] + expected: FAIL + + [X Max error for test 87 at offset 115101 is not less than or equal to 0.00065683. Got 0.9230769230769231.] + expected: FAIL + + [X Max error for test 88 at offset 117746 is not less than or equal to 0.00065683. Got 0.9198400003447016.] + expected: FAIL + + [X Max error for test 89 at offset 117747 is not less than or equal to 0.00065683. Got 0.9090909090909091.] + expected: FAIL + + [X Max error for test 90 at offset 120392 is not less than or equal to 0.00065683. Got 0.9045350614645049.] + expected: FAIL + + [X Max error for test 91 at offset 120393 is not less than or equal to 0.00065683. Got 0.8888888888888888.] + expected: FAIL + + [X Max error for test 92 at offset 123038 is not less than or equal to 0.00065683. Got 0.8820065951886947.] + expected: FAIL + + [X Max error for test 93 at offset 123039 is not less than or equal to 0.00065683. Got 0.8571428571428571.] + expected: FAIL + + [X Max error for test 94 at offset 125684 is not less than or equal to 0.00065683. Got 0.845561037037827.] + expected: FAIL + + [X Max error for test 95 at offset 125685 is not less than or equal to 0.00065683. Got 0.8.] + expected: FAIL + + [X Max error for test 96 at offset 128330 is not less than or equal to 0.00065683. Got 0.776538807317465.] + expected: FAIL + + [X Max error for test 97 at offset 128331 is not less than or equal to 0.00065683. Got 0.6666666666666642.] + expected: FAIL + + [X Max error for test 98 at offset 130976 is not less than or equal to 0.00065683. Got 0.595967750692577.] + expected: FAIL + + [X Max error for test 99 at offset 132299 is not less than or equal to 0.00065683. Got 0.9049431604462704.] + expected: FAIL + + [< [test\] 101 out of 102 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini deleted file mode 100644 index d2f0b5c9e18..00000000000 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueAtTime.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[audioparam-setValueAtTime.html] - expected: ERROR diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini index 62baf631517..b85f8845f18 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setTargetAtTime-after-event-within-block.html.ini @@ -1,5 +1,4 @@ [setTargetAtTime-after-event-within-block.html] - expected: ERROR [Test setTargetAtTime after an event in the same processing block] expected: FAIL diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini index 46d91bcf8d2..03c2e023d4d 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audioparam-interface/setValueAtTime-within-block.html.ini @@ -1,5 +1,4 @@ [setValueAtTime-within-block.html] - expected: ERROR [Test setValueAtTime with start time not on a block boundary] expected: FAIL diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini index a5e4a81c792..9fe9bc2b89e 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html.ini @@ -1,5 +1,5 @@ [test-gainnode.html] - expected: CRASH + expected: TIMEOUT [GainNode] expected: NOTRUN diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini index 39e0f41ad9c..3c7ee0d07ca 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html.ini @@ -38,3 +38,6 @@ [# AUDIT TASK RUNNER FINISHED: 2 out of 4 tasks were failed.] expected: FAIL + [# AUDIT TASK RUNNER FINISHED: 1 out of 4 tasks were failed.] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini deleted file mode 100644 index e2a57f9d12b..00000000000 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[current-time-block-size.html] - expected: TIMEOUT - [Test currentTime at completion of OfflineAudioContext rendering] - expected: TIMEOUT - diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini index 4ba526061c3..2a2a5490182 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html.ini @@ -9,3 +9,6 @@ [X new PannerNode(c, {refDistance: 5e-324}) incorrectly threw ReferenceError: "PannerNode is not defined".] expected: FAIL + [X new PannerNode(c, {refDistance: -1}) threw "ReferenceError" instead of function RangeError() {\n [native code\]\n}.] + expected: FAIL +