Increase CoreAudio render audio buffer sizes for WebRTC
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jul 2017 19:34:33 +0000 (19:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jul 2017 19:34:33 +0000 (19:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174508

Patch by Youenn Fablet <youenn@apple.com> on 2017-07-14
Reviewed by Eric Carlson.

Covered by manually testing audio rendering through WebRTC sites.

* platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
(WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit): Setting audio buffer size equivalent to 20 ms.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219517 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp

index 6e2c1f3..0e9b0ef 100644 (file)
@@ -1,3 +1,15 @@
+2017-07-14  Youenn Fablet  <youenn@apple.com>
+
+        Increase CoreAudio render audio buffer sizes for WebRTC
+        https://bugs.webkit.org/show_bug.cgi?id=174508
+
+        Reviewed by Eric Carlson.
+
+        Covered by manually testing audio rendering through WebRTC sites.
+
+        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
+        (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit): Setting audio buffer size equivalent to 20 ms.
+
 2017-07-14  Brady Eidson  <beidson@apple.com>
 
         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
index 5e60b9b..ddcafcc 100644 (file)
@@ -38,8 +38,6 @@
 
 namespace WebCore {
 
-const int renderBufferSize = 128;
-
 AudioTrackPrivateMediaStreamCocoa::AudioTrackPrivateMediaStreamCocoa(MediaStreamTrackPrivate& track)
     : AudioTrackPrivateMediaStream(track)
 {
@@ -163,7 +161,7 @@ AudioComponentInstance AudioTrackPrivateMediaStreamCocoa::createAudioUnit(CAAudi
         return nullptr;
     }
 
-    AudioSession::sharedSession().setPreferredBufferSize(renderBufferSize);
+    AudioSession::sharedSession().setPreferredBufferSize(AudioSession::sharedSession().sampleRate() / 50);
 
     return remoteIOUnit;
 }