Title: [284689] trunk/Source/WebKit
Revision
284689
Author
[email protected]
Date
2021-10-22 09:31:34 -0700 (Fri, 22 Oct 2021)

Log Message

REGRESSION (Safari 15 - iOS15): [WebRTC] Increased audio latency while playing webrtc audio stream over audio element
https://bugs.webkit.org/show_bug.cgi?id=230903
<rdar://problem/83692944>

Reviewed by Eric Carlson.

We used to render audio tracks in process and are now doing rendering in GPU process.
Current implementation requests data with a fixed chunk size, that we were setting as the max of preferred buffer size and web audio chunk size.
If we are reading too close to the end of data in AudioSampleDataSource, we will delay reading the data by this buffer size. This triggers delay but allows getting a consistent rendering.
To reduce delay, we are now using the maximum of web audio chunk size and 10 ms chunk size, as WebRTC tracks are usually manipulating 10 ms chunks.

Manually tested.

* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (284688 => 284689)


--- trunk/Source/WebKit/ChangeLog	2021-10-22 16:27:09 UTC (rev 284688)
+++ trunk/Source/WebKit/ChangeLog	2021-10-22 16:31:34 UTC (rev 284689)
@@ -1,3 +1,20 @@
+2021-10-22  Youenn Fablet  <[email protected]>
+
+        REGRESSION (Safari 15 - iOS15): [WebRTC] Increased audio latency while playing webrtc audio stream over audio element
+        https://bugs.webkit.org/show_bug.cgi?id=230903
+        <rdar://problem/83692944>
+
+        Reviewed by Eric Carlson.
+
+        We used to render audio tracks in process and are now doing rendering in GPU process.
+        Current implementation requests data with a fixed chunk size, that we were setting as the max of preferred buffer size and web audio chunk size.
+        If we are reading too close to the end of data in AudioSampleDataSource, we will delay reading the data by this buffer size. This triggers delay but allows getting a consistent rendering.
+        To reduce delay, we are now using the maximum of web audio chunk size and 10 ms chunk size, as WebRTC tracks are usually manipulating 10 ms chunks.
+
+        Manually tested.
+
+        * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp:
+
 2021-10-22  Per Arne Vollan <[email protected]>
 
         [macOS] Add needed syscall

Modified: trunk/Source/WebKit/GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp (284688 => 284689)


--- trunk/Source/WebKit/GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp	2021-10-22 16:27:09 UTC (rev 284688)
+++ trunk/Source/WebKit/GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp	2021-10-22 16:31:34 UTC (rev 284689)
@@ -142,7 +142,8 @@
             callback({ }, 0);
             return;
         }
-        m_frameChunkSize = std::max(WebCore::AudioUtilities::renderQuantumSize, WebCore::AudioSession::sharedSession().preferredBufferSize());
+        size_t tenMsSampleSize = description->sampleRate() * 10 / 1000;
+        m_frameChunkSize = std::max(WebCore::AudioUtilities::renderQuantumSize, tenMsSampleSize);
         callback(*description, m_frameChunkSize);
     });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to