New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add preservesPitch tests #24405
Add preservesPitch tests #24405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The review process for this patch is being conducted in the Chromium project.
b20bbcd
to
a69f2a4
Compare
634b909
to
0ade20b
Compare
This CL adds Web Platform Tests that check the behavior of the preservesPitch flag. The tests rely on WebAudio to analyze the frequency of an Audio element, as the playback rate changes. Firefox's mozPreservePitch does not affect MediaElementAudioSourceNode, which means that these tests won't work on Firefox. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1648277 Change-Id: Ic25d474f96e32eb8d8584188d879a018daa6ae73 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2259375 Commit-Queue: Thomas Guilbert <tguilbert@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Cr-Commit-Position: refs/heads/master@{#787947}
0ade20b
to
46005c7
Compare
@tguilbert-google this export PR has gotten stuck and not merged automatically because the test appears to be flaky on Firefox. Here are the results copied from Taskcluster logs:
I think that Firefox actually doesn't preserve pitch when connected to Web Audio and should fail some of these tests, but why are the tests flaky? And what's going on with the "but got 0" failures? That seems more like what you'd get if the analyser got silence. |
Having tinkered a bit with the test locally, I think I see the problem. The test simply waits for a timeupdate event, but that timeupdate event could be fired before there's enough data to analyse. Waiting until function waitUntil(time) {
return new Promise((resolve) => {
audio.ontimeupdate = () => {
if (audio.currentTime >= time) {
resolve();
}
};
});
} |
This CL changes preservesPitch tests to wait until the audioElement's currentTime is at least 0.5 seconds before trying to detect the pitch. Without this check, the test can try to detect the pitch before the audio has played enough, which can return a dominant frequency of 0Hz and fail the test. The CL also makes a few stylistic changes, and fixes an off-by-one error in the number of increments used to calculate frequencies. Bug: 1096238 Change-Id: I6e98e172862a47bea1c4026737138293914f7906 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2298281 Auto-Submit: Thomas Guilbert <tguilbert@chromium.org> Commit-Queue: Philip Jägenstedt <foolip@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Cr-Commit-Position: refs/heads/master@{#788535}
A fix has landed in https://chromium-review.googlesource.com/c/chromium/src/+/2298281, I'll include that in this PR too. |
https://wpt.fyi/results/html/semantics/embedded-content/media-elements/preserves-pitch.html?label=pr_head&max-count=1&pr=24405 reveals that the tests don't work on Safari. There are some typos, but also WebAudio/web-audio-api#2218 is causing problems. I will land this PR now and send some fixes. |
I've sent fixes in #24599. |
This CL adds Web Platform Tests that check the behavior of the
preservesPitch flag.
The tests rely on WebAudio to analyze the frequency of an Audio element,
as the playback rate changes.
Firefox's mozPreservePitch does not affect MediaElementAudioSourceNode,
which means that these tests won't work on Firefox. See:
https://bugzilla.mozilla.org/show_bug.cgi?id=1648277
Change-Id: Ic25d474f96e32eb8d8584188d879a018daa6ae73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2259375
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787947}
Edited by @foolip to also include a commit with stability fixes: