Title: [220859] trunk/Source/WebCore
Revision
220859
Author
[email protected]
Date
2017-08-17 09:11:07 -0700 (Thu, 17 Aug 2017)

Log Message

[Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
https://bugs.webkit.org/show_bug.cgi?id=175631

Patch by Youenn Fablet <[email protected]> on 2017-08-17
Reviewed by Eric Carlson.

* platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
(PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220858 => 220859)


--- trunk/Source/WebCore/ChangeLog	2017-08-17 15:19:38 UTC (rev 220858)
+++ trunk/Source/WebCore/ChangeLog	2017-08-17 16:11:07 UTC (rev 220859)
@@ -1,3 +1,13 @@
+2017-08-17  Youenn Fablet  <[email protected]>
+
+        [Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
+        https://bugs.webkit.org/show_bug.cgi?id=175631
+
+        Reviewed by Eric Carlson.
+
+        * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
+        (PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.
+
 2017-08-17  Antti Koivisto  <[email protected]>
 
         RenderListItem - Avoid render tree mutation during layout

Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp (220858 => 220859)


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp	2017-08-17 15:19:38 UTC (rev 220858)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp	2017-08-17 16:11:07 UTC (rev 220859)
@@ -42,8 +42,12 @@
 {
     LOG(Media, "PlatformMediaSessionManager::updateSessionState() - types: Video(%d), Audio(%d), WebAudio(%d)", count(PlatformMediaSession::Video), count(PlatformMediaSession::Audio), count(PlatformMediaSession::WebAudio));
 
-    if (has(PlatformMediaSession::WebAudio) || has(PlatformMediaSession::MediaStreamCapturingAudio))
+    if (has(PlatformMediaSession::WebAudio))
         AudioSession::sharedSession().setPreferredBufferSize(kWebAudioBufferSize);
+    // In case of audio capture, we want to grab 20 ms chunks to limit the latency so that it is not noticeable by users
+    // while having a large enough buffer so that the audio rendering remains stable, hence a computation based on sample rate.
+    else if (has(PlatformMediaSession::MediaStreamCapturingAudio))
+        AudioSession::sharedSession().setPreferredBufferSize(AudioSession::sharedSession().sampleRate() / 50);
     else if ((has(PlatformMediaSession::Video) || has(PlatformMediaSession::Audio)) && Settings::lowPowerVideoAudioBufferSizeEnabled()) {
         // FIXME: <http://webkit.org/b/116725> Figure out why enabling the code below
         // causes media LayoutTests to fail on 10.8.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to