<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>264247</bug_id>
          
          <creation_ts>2023-11-06 02:33:21 -0800</creation_ts>
          <short_desc>getOutputTimestamp() seems to use wrong time scale</short_desc>
          <delta_ts>2024-02-23 07:59:31 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Audio</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>chrisguttandin</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>cdumez</cc>
    
    <cc>jer.noble</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1990129</commentid>
    <comment_count>0</comment_count>
    <who name="">chrisguttandin</who>
    <bug_when>2023-11-06 02:33:21 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1992068</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-11-13 02:34:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/118323705&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2016289</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-02-22 21:01:42 -0800</bug_when>
    <thetext>```
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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2016292</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-02-22 21:23:05 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/24994</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2016384</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-02-23 07:59:28 -0800</bug_when>
    <thetext>Committed 275237@main (33172dfe163a): &lt;https://commits.webkit.org/275237@main&gt;

Reviewed commits have been landed. Closing PR #24994 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>