WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
264247
getOutputTimestamp() seems to use wrong time scale
https://bugs.webkit.org/show_bug.cgi?id=264247
Summary
getOutputTimestamp() seems to use wrong time scale
chrisguttandin
Reported
2023-11-06 02:33:21 PST
The contextTime returned by getOutputTimestamp() seems to be devided by the sampleRate of the AudioContext. Please take a look at this demo to reproduce the bug:
https://stackblitz.com/edit/js-ndbao2?file=index.html,index.js
. The contextTime is very small but ends up being a reasonable value when multiplied by the sampleRate. Please also note that the contextTime currently seems to drift away in relation to currentTime. It starts out being smaller than currentTime (as it is in Chrome and Firefox) but soon drifts away until it eventually gets larger than currentTime.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-11-13 02:34:14 PST
<
rdar://problem/118323705
>
Chris Dumez
Comment 2
2024-02-22 21:01:42 PST
``` diff --git a/Source/WebCore/platform/audio/AudioDestinationResampler.cpp b/Source/WebCore/platform/audio/AudioDestinationResampler.cpp index efd262000a29..257d72887a19 100644 --- a/Source/WebCore/platform/audio/AudioDestinationResampler.cpp +++ b/Source/WebCore/platform/audio/AudioDestinationResampler.cpp @@ -109,7 +109,7 @@ size_t AudioDestinationResampler::pullRendered(size_t numberOfFrames) bool AudioDestinationResampler::render(double sampleTime, MonotonicTime hostTime, size_t framesToRender) { m_outputTimestamp = { - Seconds { sampleTime / sampleRate() }, + Seconds { sampleTime }, hostTime }; // When there is a AudioWorklet, we do rendering on the AudioWorkletThread. ``` Need to write a test case.
Chris Dumez
Comment 3
2024-02-22 21:23:05 PST
Pull request:
https://github.com/WebKit/WebKit/pull/24994
EWS
Comment 4
2024-02-23 07:59:28 PST
Committed
275237@main
(33172dfe163a): <
https://commits.webkit.org/275237@main
> Reviewed commits have been landed. Closing PR #24994 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug