Title: [241156] branches/safari-607-branch/Source/WebCore
Revision
241156
Author
[email protected]
Date
2019-02-07 15:36:41 -0800 (Thu, 07 Feb 2019)

Log Message

Cherry-pick r241021. rdar://problem/47893607

    Disable audio ducking at Audio Unit setup time
    https://bugs.webkit.org/show_bug.cgi?id=194303

    Reviewed by Eric Carlson.

    When creating a CoreAudioCaptureSource, the audio unit might be
    reconfigured if a past audio capture was done.
    This might trigger audio ducking which is undone in startInternal.
    In some cases, startInternal will never call start.
    In that case, the audio unit will continue ducking the other processing.
    To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.

    In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
    This might affect all applications.
    Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
    This has noticeable effects in the quality of audio being played on bluetooth devices.

    Covered by manual tests.

    * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
    (WebCore::CoreAudioSharedUnit::setupAudioUnit):
    (WebCore::CoreAudioSharedUnit::unduck):
    (WebCore::CoreAudioSharedUnit::startInternal):
    (WebCore::CoreAudioSharedUnit::captureFailed):
    (WebCore::CoreAudioSharedUnit::stopProducingData):

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

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (241155 => 241156)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-07 23:36:38 UTC (rev 241155)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-07 23:36:41 UTC (rev 241156)
@@ -1,5 +1,66 @@
 2019-02-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r241021. rdar://problem/47893607
+
+    Disable audio ducking at Audio Unit setup time
+    https://bugs.webkit.org/show_bug.cgi?id=194303
+    
+    Reviewed by Eric Carlson.
+    
+    When creating a CoreAudioCaptureSource, the audio unit might be
+    reconfigured if a past audio capture was done.
+    This might trigger audio ducking which is undone in startInternal.
+    In some cases, startInternal will never call start.
+    In that case, the audio unit will continue ducking the other processing.
+    To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.
+    
+    In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
+    This might affect all applications.
+    Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
+    This has noticeable effects in the quality of audio being played on bluetooth devices.
+    
+    Covered by manual tests.
+    
+    * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+    (WebCore::CoreAudioSharedUnit::setupAudioUnit):
+    (WebCore::CoreAudioSharedUnit::unduck):
+    (WebCore::CoreAudioSharedUnit::startInternal):
+    (WebCore::CoreAudioSharedUnit::captureFailed):
+    (WebCore::CoreAudioSharedUnit::stopProducingData):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-06  Youenn Fablet  <[email protected]>
+
+            Disable audio ducking at Audio Unit setup time
+            https://bugs.webkit.org/show_bug.cgi?id=194303
+
+            Reviewed by Eric Carlson.
+
+            When creating a CoreAudioCaptureSource, the audio unit might be
+            reconfigured if a past audio capture was done.
+            This might trigger audio ducking which is undone in startInternal.
+            In some cases, startInternal will never call start.
+            In that case, the audio unit will continue ducking the other processing.
+            To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.
+
+            In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
+            This might affect all applications.
+            Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
+            This has noticeable effects in the quality of audio being played on bluetooth devices.
+
+            Covered by manual tests.
+
+            * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+            (WebCore::CoreAudioSharedUnit::setupAudioUnit):
+            (WebCore::CoreAudioSharedUnit::unduck):
+            (WebCore::CoreAudioSharedUnit::startInternal):
+            (WebCore::CoreAudioSharedUnit::captureFailed):
+            (WebCore::CoreAudioSharedUnit::stopProducingData):
+
+2019-02-07  Alan Coon  <[email protected]>
+
         Cherry-pick r241018. rdar://problem/47893623
 
     RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver

Modified: branches/safari-607-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (241155 => 241156)


--- branches/safari-607-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2019-02-07 23:36:38 UTC (rev 241155)
+++ branches/safari-607-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2019-02-07 23:36:41 UTC (rev 241156)
@@ -122,6 +122,8 @@
     OSStatus startInternal();
     void stopInternal();
 
+    void unduck();
+
     void verifyIsCapturing();
     void devicesChanged();
     void captureFailed();
@@ -339,9 +341,18 @@
     m_ioUnitInitialized = true;
     m_suspended = false;
 
+    unduck();
+
     return err;
 }
 
+void CoreAudioSharedUnit::unduck()
+{
+    uint32_t outputDevice;
+    if (!defaultOutputDevice(&outputDevice))
+        AudioDeviceDuck(outputDevice, 1.0, nullptr, 0);
+}
+
 OSStatus CoreAudioSharedUnit::configureMicrophoneProc()
 {
     AURenderCallbackStruct callback = { microphoneCallback, this };
@@ -612,9 +623,7 @@
         ASSERT(m_ioUnit);
     }
 
-    uint32_t outputDevice;
-    if (!defaultOutputDevice(&outputDevice))
-        AudioDeviceDuck(outputDevice, 1.0, nullptr, 0);
+    unduck();
 
     err = AudioOutputUnitStart(m_ioUnit);
     if (err) {
@@ -643,11 +652,10 @@
     captureFailed();
 }
 
-
 void CoreAudioSharedUnit::captureFailed()
 {
 #if !RELEASE_LOG_DISABLED
-    RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::captureFailed - capture failed\n");
+    RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::captureFailed - capture failed");
 #endif
     for (CoreAudioCaptureSource& client : m_clients)
         client.captureFailed();
@@ -667,6 +675,7 @@
         return;
 
     stopInternal();
+    cleanupAudioUnit();
 }
 
 OSStatus CoreAudioSharedUnit::suspend()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to