-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 275237@main (33172df). https://bugs.webkit.org/show_bug.c…
…gi?id=264247 getOutputTimestamp() seems to use wrong time scale https://bugs.webkit.org/show_bug.cgi?id=264247 rdar://118323705 Reviewed by Eric Carlson. The time returned by getOutputTimestamp() was incorrectly divided by the sample rate. Fix this so the value returned is correct and matches Chrome and Firefox. * LayoutTests/webaudio/getOutputTimestamp-expected.txt: Added. * LayoutTests/webaudio/getOutputTimestamp.html: Added. * Source/WebCore/platform/audio/AudioDestinationResampler.cpp: (WebCore::AudioDestinationResampler::render): Canonical link: https://commits.webkit.org/275237@main Canonical link: https://commits.webkit.org/274313.183@webkitglib/2.44
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Validate the value returned by AudioContext.getOutputTimestamp() | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS contextTime > 0.090 is true | ||
PASS contextTime <= audioContext.currentTime is true | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<DOCTYPE html> | ||
<html> | ||
<body> | ||
<script src="../resources/js-test.js"></script> | ||
<script> | ||
description("Validate the value returned by AudioContext.getOutputTimestamp()"); | ||
jsTestIsAsync = true; | ||
|
||
const audioContext = new AudioContext(); | ||
const gainNode = new GainNode(audioContext, { gain: 0.01 }); | ||
const oscillatorNode = new OscillatorNode(audioContext); | ||
|
||
oscillatorNode.connect(gainNode).connect(audioContext.destination); | ||
oscillatorNode.start(); | ||
|
||
handle = setInterval(() => { | ||
if (audioContext.currentTime < 0.100) | ||
return; | ||
clearInterval(handle); | ||
|
||
contextTime = audioContext.getOutputTimestamp().contextTime; | ||
shouldBeTrue("contextTime > 0.090"); | ||
shouldBeTrue("contextTime <= audioContext.currentTime"); | ||
finishJSTest(); | ||
}, 10); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters