Title: [241021] trunk/Source/WebCore
- Revision
- 241021
- Author
- you...@apple.com
- Date
- 2019-02-06 08:58:46 -0800 (Wed, 06 Feb 2019)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (241020 => 241021)
--- trunk/Source/WebCore/ChangeLog 2019-02-06 16:30:43 UTC (rev 241020)
+++ trunk/Source/WebCore/ChangeLog 2019-02-06 16:58:46 UTC (rev 241021)
@@ -1,3 +1,31 @@
+2019-02-06 Youenn Fablet <you...@apple.com>
+
+ 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-06 Antti Koivisto <an...@apple.com>
RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (241020 => 241021)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2019-02-06 16:30:43 UTC (rev 241020)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2019-02-06 16:58:46 UTC (rev 241021)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes