LibWeb: Populate AudioTimestamp dictionaries

Return the required AudioTimestamp members from getOutputTimestamp even
while the WebAudio rendering graph does not yet produce output timing.
This keeps the generated bindings from unwrapping missing required
fields.

Add a crash test that exercises AudioContext.getOutputTimestamp().
This commit is contained in:
Andreas Kling 2026-05-22 18:46:51 +02:00 committed by Andreas Kling
parent 804bf2532b
commit c997de97c3
2 changed files with 14 additions and 2 deletions

View file

@ -135,8 +135,15 @@ void AudioContext::visit_edges(Cell::Visitor& visitor)
// https://www.w3.org/TR/webaudio/#dom-audiocontext-getoutputtimestamp
Bindings::AudioTimestamp AudioContext::get_output_timestamp()
{
dbgln("(STUBBED) getOutputTimestamp()");
return {};
// If the context's rendering graph has not yet processed a block of audio, then
// getOutputTimestamp call returns an AudioTimestamp instance with both members
// containing zero.
// FIXME: Once we process audio blocks, report the current output stream position
// and the corresponding performance time here.
return {
.context_time = 0.0,
.performance_time = 0.0,
};
}
// https://www.w3.org/TR/webaudio/#dom-audiocontext-resume

View file

@ -0,0 +1,5 @@
<!DOCTYPE html>
<script>
const context = new AudioContext();
context.getOutputTimestamp();
</script>