Bug 1532151 [wpt PR 15520] - Add support for AudioContextOptions sampleRate, a=testonly

Automatic update from web-platform-tests
Add support for AudioContextOptions sampleRate

Optional sampleRate parameter to AudioContextOptions, if provided then
the AudioContext will run at this sampleRate, otherwise it will run at
the hardware rate.

Running the AudioContext at a lower sample rate can allow running a
heavier graph on low-end devices, for example if a given device is able
to run with X nodes at a sample rate of 48k, it can support roughly
2X nodes at 24k or 4X nodes at 12k.

Bug: 432248
Change-Id: I835f28b4625763bd6a6ddbee9b89636ef8a8a066
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1482957
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Andrew MacPherson <andrew.macpherson@soundtrap.com>
Cr-Commit-Position: refs/heads/master@{#638498}

--

wpt-commits: 9b994b36003246370b352fa70c563866a8443e4e
wpt-pr: 15520
This commit is contained in:
Andrew MacPherson 2019-03-26 13:54:45 +00:00 коммит произвёл James Graham
Родитель 40d93d4e04
Коммит 6af51aaeac
1 изменённых файлов: 39 добавлений и 0 удалений

Просмотреть файл

@ -156,6 +156,45 @@
});
});
audit.define(
{
label: 'test-audiocontextoptions-sampleRate',
description:
'Test creating contexts with non-default sampleRate values.'
},
function(task, should) {
// A sampleRate of 1 is unlikely to be supported on any browser,
// test that this rate is rejected.
should(
() => {
context = new AudioContext({sampleRate: 1})
},
'context = new AudioContext({sampleRate: 1})')
.throw(DOMException);
// A sampleRate of 1,000,000 is unlikely to be supported on any
// browser, test that this rate is also rejected.
should(
() => {
context = new AudioContext({sampleRate: 1000000})
},
'context = new AudioContext({sampleRate: 1000000})')
.throw(DOMException);
should(
() => {
context = new AudioContext({sampleRate: 24000})
},
'context = new AudioContext({sampleRate: 24000})')
.notThrow();
should(
context.sampleRate, 'sampleRate inrange')
.beEqualTo(24000);
context.close();
task.done();
});
audit.run();
</script>
</body>