Looks great! I only have a few nits and one request.
/**
* Returns a promise that resolves with an array of AudioBuffers once all
* resources have loaded.
* @param {!BaseAudioContext} context
* @param {!Array<string>} urls
* @return {!Promise<!Array<!AudioBuffer>>}
*/
function loadBuffers(context, urls) {
return new Promise((resolve, reject) => {
const loader = new BufferLoader(context, urls, resolve, reject);
loader.load();
});
}
Could you create this file loading utility function in `audit-util.js`?
Eventually we want to remove all the references to `buffer-loader.js` because it is very outdated.
const kMinSnrDb = 110.97;
Can you also add comments for this?
const [expectedBuffer, decodedBuffer] = await loadBuffers(
context,
[
'resources/webm-decode-expected.wav',
'test-webm.webm',
]);
Is this formatting the result from the eslint?
assert_equals(decodedBuffer.length, expectedBuffer.length, 'Frame count');
formatting: column wrap
// Per-channel verification.
Seems redundant.
for (let c = 0; c < expectedBuffer.numberOfChannels; ++c) {
use `channel` instead
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Looking good overall, I have some nits and a question.
<script src="../../resources/audit-util.js"></script>
It looks like this is used for `computeSNR`. Based on Hongchan's comment, is the plan to keep `audit-util.js` for various utility functions? Should we consider renaming it at some point?
// Basic sanity checks.
```suggestion
// Basic checks.
```
https://developers.google.com/style/inclusive-documentation
// Compute signal-to-noise ratio (SNR) using the same argument order
// as the original audit.js test (actual first, reference second).
I don't think we need to directly reference how audit.js used to do things, since we are removing it.
```suggestion
// Compute signal-to-noise ratio (SNR).
```
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
* Returns a promise that resolves with an array of AudioBuffers once all
* resources have loaded.
* @param {!BaseAudioContext} context
* @param {!Array<string>} urls
* @return {!Promise<!Array<!AudioBuffer>>}
*/
function loadBuffers(context, urls) {
return new Promise((resolve, reject) => {
const loader = new BufferLoader(context, urls, resolve, reject);
loader.load();
});
}
Could you create this file loading utility function in `audit-util.js`?
Eventually we want to remove all the references to `buffer-loader.js` because it is very outdated.
Done
Can you also add comments for this?
Done
const [expectedBuffer, decodedBuffer] = await loadBuffers(
context,
[
'resources/webm-decode-expected.wav',
'test-webm.webm',
]);
Is this formatting the result from the eslint?
Copilot
// Basic sanity checks.
```suggestion
// Basic checks.
```
https://developers.google.com/style/inclusive-documentation
I removed the entire commment is it fine?
// Basic sanity checks.
Punith NayakSeems redundant.
Done
assert_equals(decodedBuffer.length, expectedBuffer.length, 'Frame count');
Punith Nayakformatting: column wrap
Done
// Per-channel verification.
Punith NayakSeems redundant.
Done
for (let c = 0; c < expectedBuffer.numberOfChannels; ++c) {
Punith Nayakuse `channel` instead
Done
// Compute signal-to-noise ratio (SNR) using the same argument order
// as the original audit.js test (actual first, reference second).
I don't think we need to directly reference how audit.js used to do things, since we are removing it.
```suggestion// Compute signal-to-noise ratio (SNR).
```
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
<script src="../../resources/audit-util.js"></script>
It looks like this is used for `computeSNR`. Based on Hongchan's comment, is the plan to keep `audit-util.js` for various utility functions? Should we consider renaming it at some point?
Yes, I think we need a utils file. Renaming it would be a better idea
Code-Review | +1 |
<script src="../../resources/audit-util.js"></script>
Punith NayakIt looks like this is used for `computeSNR`. Based on Hongchan's comment, is the plan to keep `audit-util.js` for various utility functions? Should we consider renaming it at some point?
Yes, I think we need a utils file. Renaming it would be a better idea
Acknowledged. It doesn't have to be in this CL, but let's make a plan for where to collect utility functions.
// Basic sanity checks.
Punith Nayak```suggestion
// Basic checks.
```
https://developers.google.com/style/inclusive-documentation
I removed the entire commment is it fine?
Yes, that's fine. Thank you.
for (let channel = 0; channel < expectedBuffer.numberOfChannels; ++channel) {
Please wrap this line.
assert_greater_than_equal(snrDb, kMinSnrDb, `SNR for channel ${channel}`);
Please wrap this line.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const [expectedBuffer, decodedBuffer] = await loadBuffers(
context,
[
'resources/webm-decode-expected.wav',
'test-webm.webm',
]);
Punith NayakIs this formatting the result from the eslint?
Copilot
Acknowledged
const loader = new BufferLoader(context, urls, resolve, reject);
This line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
for (let channel = 0; channel < expectedBuffer.numberOfChannels; ++channel) {
Punith NayakPlease wrap this line.
Done
assert_greater_than_equal(snrDb, kMinSnrDb, `SNR for channel ${channel}`);
Punith NayakPlease wrap this line.
Done
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
On Thu, May 29, 2025, 4:03 PM Punith Nayak (Gerrit) <noreply-gerritcodereview+_N5KpHfhDWZOsU2BQtDnvg==@> wrote: chromium.org
On Thu, May 29, 2025, 4:03 PM Punith Nayak (Gerrit) <noreply-gerritcodereview+_N5KpHfhDWZOsU2BQtDnvg==@> wrote: chromium.org
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
<script src="../../resources/buffer-loader.js"></script>
We can remove this line now, I think.
const loader = new BufferLoader(context, urls, resolve, reject);
This line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Do we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Do we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
I think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Hongchan ChoiDo we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
I think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Hey if am understading this correctly, are we planing to ship all the code from buffer-loader.js to audio-utils.js? and vanish buffer-loader.j
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Hongchan ChoiDo we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
Punith NayakI think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Hey if am understading this correctly, are we planing to ship all the code from buffer-loader.js to audio-utils.js? and vanish buffer-loader.j
We decided to inline the code from BufferLoader here, using `fetch` instead of `XMLHttpRequest`. buffer-loader.js can be removed once nothing uses it anymore.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
<script src="../../resources/buffer-loader.js"></script>
We can remove this line now, I think.
Done
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Hongchan ChoiDo we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
Punith NayakI think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Michael WilsonHey if am understading this correctly, are we planing to ship all the code from buffer-loader.js to audio-utils.js? and vanish buffer-loader.j
We decided to inline the code from BufferLoader here, using `fetch` instead of `XMLHttpRequest`. buffer-loader.js can be removed once nothing uses it anymore.
In a web page running in a browser you cannot use fetch() to read a file:// URL I feel
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Hongchan ChoiDo we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
Punith NayakI think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Michael WilsonHey if am understading this correctly, are we planing to ship all the code from buffer-loader.js to audio-utils.js? and vanish buffer-loader.j
Punith NayakWe decided to inline the code from BufferLoader here, using `fetch` instead of `XMLHttpRequest`. buffer-loader.js can be removed once nothing uses it anymore.
In a web page running in a browser you cannot use fetch() to read a file:// URL I feel
What we can do is : We will use fetch, but fall back to XHR whenever the absolute URL points to a file.
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Hongchan ChoiDo we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
Punith NayakI think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Michael WilsonHey if am understading this correctly, are we planing to ship all the code from buffer-loader.js to audio-utils.js? and vanish buffer-loader.j
Punith NayakWe decided to inline the code from BufferLoader here, using `fetch` instead of `XMLHttpRequest`. buffer-loader.js can be removed once nothing uses it anymore.
Punith NayakIn a web page running in a browser you cannot use fetch() to read a file:// URL I feel
What we can do is : We will use fetch, but fall back to XHR whenever the absolute URL points to a file.
Both fetch() or XMLHttpRequest don't work with the local file system. You will need a web server.
The current patch set might work, but I am interested in deprecating the XMLHttpRequest from the code. Please refer the code example I provided in the last sync meeting.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Hongchan ChoiDo we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
Punith NayakI think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Michael WilsonHey if am understading this correctly, are we planing to ship all the code from buffer-loader.js to audio-utils.js? and vanish buffer-loader.j
Punith NayakWe decided to inline the code from BufferLoader here, using `fetch` instead of `XMLHttpRequest`. buffer-loader.js can be removed once nothing uses it anymore.
Punith NayakIn a web page running in a browser you cannot use fetch() to read a file:// URL I feel
Hongchan ChoiWhat we can do is : We will use fetch, but fall back to XHR whenever the absolute URL points to a file.
Both fetch() or XMLHttpRequest don't work with the local file system. You will need a web server.
The current patch set might work, but I am interested in deprecating the XMLHttpRequest from the code. Please refer the code example I provided in the last sync meeting.
Based on our most recent discussion, since this is in a central location it's fine to use `XMLHttpRequest` for this CL and try to work out the issue with `fetch` later.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +0 |
const loader = new BufferLoader(context, urls, resolve, reject);
Michael WilsonThis line still relies on `BufferLoader`. I think you'd have to implement the loading functionality here in this file so we don't have any dependency on the old library file.
Hongchan ChoiDo we want to do this in this CL, or is it enough to hide the details behind this function and re-implement `BufferLoader` in a follow-up CL?
Punith NayakI think it needs to be done here in this CL. Luckily it worked in this case because the BufferLoader class was globally loaded from a different script file.
Michael WilsonHey if am understading this correctly, are we planing to ship all the code from buffer-loader.js to audio-utils.js? and vanish buffer-loader.j
Punith NayakWe decided to inline the code from BufferLoader here, using `fetch` instead of `XMLHttpRequest`. buffer-loader.js can be removed once nothing uses it anymore.
Punith NayakIn a web page running in a browser you cannot use fetch() to read a file:// URL I feel
Hongchan ChoiWhat we can do is : We will use fetch, but fall back to XHR whenever the absolute URL points to a file.
Michael WilsonBoth fetch() or XMLHttpRequest don't work with the local file system. You will need a web server.
The current patch set might work, but I am interested in deprecating the XMLHttpRequest from the code. Please refer the code example I provided in the last sync meeting.
Based on our most recent discussion, since this is in a central location it's fine to use `XMLHttpRequest` for this CL and try to work out the issue with `fetch` later.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
LGTM
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
LGTM with nit
for (let i = 0; i < reference.length; ++i) {
assert_approx_equals(
actual[i], reference[i], kAbsTolerance,
`Channel ${channel}, sample ${i}`);
}
nit: If this will be used widely in multiple tests, it is probably a good idea to add this as a new method to a utility file. It's up to you whether do it here or in separate CL.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Michael WilsonLGTM with nit
Hi Alvin, could you please +1 if you think this is mergable?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Michael WilsonLGTM with nit
Hi Alvin, could you please +1 if you think this is mergable?
Done!
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[WebAudio] Migrate webm decoding test from audit.js to testharness.js
Replaces audit.js usage with testharness.js while preserving all original
test logic and validations, including SNR checks and frame-level comparisons.
Bug: 396477778
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5658720433340416
Sample build with failed test: https://ci.chromium.org/b/8712404747455593089
Affected test(s):
[ninja://:blink_web_tests/webaudio/codec-tests/webm/webm-decode.html](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2F:blink_web_tests%2Fwebaudio%2Fcodec-tests%2Fwebm%2Fwebm-decode.html?q=VHash%3A8b2de2ca283257e5)
A revert for this change was not created because the builder that this CL broke is not watched by gardeners, therefore less important. You can consider revert this CL, fix forward or let builder owners resolve it themselves.
If this is a false positive, please report it at http://b.corp.google.com/createIssue?component=1199205&description=Analysis%3A+https%3A%2F%2Fci.chromium.org%2Fui%2Fp%2Fchromium%2Fbisection%2Ftest-analysis%2Fb%2F5658720433340416&format=PLAIN&priority=P3&title=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F6603253&type=BUG
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hey @mjwi...@chromium.org
The Win11 bot is running properly. Please start any other necessary bots that you have access to, so the patch remains stable and doesn't get reverted.
Code-Review | +1 |
Hey @mjwi...@chromium.org
The Win11 bot is running properly. Please start any other necessary bots that you have access to, so the patch remains stable and doesn't get reverted.
I see "expectedly failed" in the mac15.arm64-blink-rel results, so I think we should be good. Let's monitor after landing this.
LGTM
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
LGTM
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +2 |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[WebAudio] [Re-land] Migrate webm decoding test from audit.js to testharness.js
Replaces audit.js usage with testharness.js while preserving all original
test logic and validations, including SNR checks and frame-level comparisons.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |