Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't try to take log2 of 0 when using mono audio channels. #26611
+5
−1
Conversation
highfive
commented
May 22, 2020
|
Heads up! This PR modifies the following files:
|
|
@bors-servo try=wpt |
highfive
commented
May 22, 2020
bors-servo
added a commit
that referenced
this pull request
May 22, 2020
Don't try to take log2 of 0 when using mono audio channels. This avoids a panic when loading rooms in Hubs.
|
|
|
We also shouldn't be using log2 at all, ideally we can do |
This was referenced May 22, 2020
|
I now can't reproduce this panic on Hubs without this PR applied, and I haven't been able to reproduce the panic in a page using a mono audio buffer: <script>
var context = new AudioContext();
var buffer = context.createBuffer(1, 22050, 22050);
for (var channel = 0; channel < buffer.numberOfChannels; channel++) {
// This gives us the actual ArrayBuffer that contains the data
var nowBuffering = buffer.getChannelData(channel);
for (var i = 0; i < buffer.length; i++) {
// Math.random() is in [0; 1.0]
// audio needs to be in [-1.0; 1.0]
nowBuffering[i] = Math.random() * 2 - 1;
}
}
var source = context.createBufferSource();
source.buffer = buffer;
source.connect(context.destination);
source.start();
</script>Since I don't really want to merge changes that can't clearly show an improvement, I'm going to close this PR. We can reopen it if we find a way to trigger the problem again. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
jdm commentedMay 22, 2020
This avoids a panic when loading rooms in Hubs.