Bug 264247
Summary: | getOutputTimestamp() seems to use wrong time scale | ||
---|---|---|---|
Product: | WebKit | Reporter: | chrisguttandin |
Component: | Web Audio | Assignee: | Chris Dumez <cdumez> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | cdumez, jer.noble, webkit-bug-importer, youennf |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
chrisguttandin
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
<rdar://problem/118323705>
Chris Dumez
```
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
Pull request: https://github.com/WebKit/WebKit/pull/24994
EWS
Committed 275237@main (33172dfe163a): <https://commits.webkit.org/275237@main>
Reviewed commits have been landed. Closing PR #24994 and removing active labels.