mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Throw on out-of-bounds channelCount in AudioNodes
This commit is contained in:
parent
0ac861ca94
commit
28c21421ca
9 changed files with 44 additions and 38 deletions
|
@ -44,9 +44,14 @@ impl AudioNode {
|
|||
options: &AudioNodeOptions,
|
||||
number_of_inputs: u32,
|
||||
number_of_outputs: u32,
|
||||
) -> AudioNode {
|
||||
) -> Fallible<AudioNode> {
|
||||
if let Some(c) = options.channelCount {
|
||||
if c == 0 || c > MAX_CHANNEL_COUNT {
|
||||
return Err(Error::NotSupported);
|
||||
}
|
||||
}
|
||||
let node_id = context.audio_context_impl().create_node(node_type);
|
||||
AudioNode::new_inherited_for_id(node_id, context, options, number_of_inputs, number_of_outputs)
|
||||
Ok(AudioNode::new_inherited_for_id(node_id, context, options, number_of_inputs, number_of_outputs))
|
||||
}
|
||||
|
||||
pub fn new_inherited_for_id(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue