mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 874869 - Disallow setting AudioNode.channelCount to zero; r=roc
This commit is contained in:
parent
398c464eef
commit
8225f28a47
@ -315,6 +315,8 @@ AudioNodeStream::ObtainInputBlock(AudioChunk& aTmpChunk, uint32_t aPortIndex)
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(outputChannelCount > 0, "How did this happen?");
|
||||
|
||||
AllocateAudioBlock(outputChannelCount, &aTmpChunk);
|
||||
float silenceChannel[WEBAUDIO_BLOCK_SIZE] = {0.f};
|
||||
// The static storage here should be 1KB, so it's fine
|
||||
|
15
content/media/test/crashtests/874869.html
Normal file
15
content/media/test/crashtests/874869.html
Normal file
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
var Context0= new AudioContext()
|
||||
var Panner0=Context0.createPanner();
|
||||
var BufferSource3=Context0.createBufferSource();
|
||||
Panner0.channelCount=0;
|
||||
BufferSource3.connect(Panner0);
|
||||
BufferSource3.buffer=function(){
|
||||
var length=1;
|
||||
var Buffer=Context0.createBuffer(1,length,'44200');
|
||||
var bufferData= Buffer.getChannelData(0);
|
||||
for (var i = 0; i < length; ++i) { bufferData[i] = 255;};
|
||||
return Buffer;
|
||||
}();
|
||||
|
||||
</script>
|
@ -15,3 +15,4 @@ skip-if(Android||B2G) load 789075-1.html # load failed, bug 833371 for B2G
|
||||
load 844563.html
|
||||
load 846612.html
|
||||
load 852838.html
|
||||
load 874869.html
|
||||
|
@ -159,8 +159,12 @@ public:
|
||||
virtual uint16_t NumberOfOutputs() const { return 1; }
|
||||
|
||||
uint32_t ChannelCount() const { return mChannelCount; }
|
||||
void SetChannelCount(uint32_t aChannelCount)
|
||||
void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv)
|
||||
{
|
||||
if (aChannelCount == 0) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
}
|
||||
mChannelCount = aChannelCount;
|
||||
SendChannelMixingParametersToStream();
|
||||
}
|
||||
|
@ -91,6 +91,10 @@ function createNode(context, buffer, destination) {
|
||||
is(source.channelCountMode, "max", "Correct channelCountMode for the source node");
|
||||
is(source.channelInterpretation, "speakers", "Correct channelCountInterpretation for the source node");
|
||||
|
||||
expectException(function() {
|
||||
source.channelCount = 0;
|
||||
}, DOMException.NOT_SUPPORTED_ERR);
|
||||
|
||||
source.buffer = buffer;
|
||||
ok(source.buffer, "Source node should have a buffer now");
|
||||
|
||||
|
@ -36,6 +36,7 @@ interface AudioNode : EventTarget {
|
||||
readonly attribute unsigned long numberOfOutputs;
|
||||
|
||||
// Channel up-mixing and down-mixing rules for all inputs.
|
||||
[SetterThrows]
|
||||
attribute unsigned long channelCount;
|
||||
attribute ChannelCountMode channelCountMode;
|
||||
attribute ChannelInterpretation channelInterpretation;
|
||||
|
Loading…
Reference in New Issue
Block a user