Changeset 241021 in webkit


Ignore:
Timestamp:
Feb 6, 2019 8:58:46 AM (5 years ago)
Author:
youenn@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r241018 r241021  
     12019-02-06  Youenn Fablet  <youenn@apple.com>
     2
     3        Disable audio ducking at Audio Unit setup time
     4        https://bugs.webkit.org/show_bug.cgi?id=194303
     5
     6        Reviewed by Eric Carlson.
     7
     8        When creating a CoreAudioCaptureSource, the audio unit might be
     9        reconfigured if a past audio capture was done.
     10        This might trigger audio ducking which is undone in startInternal.
     11        In some cases, startInternal will never call start.
     12        In that case, the audio unit will continue ducking the other processing.
     13        To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.
     14
     15        In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
     16        This might affect all applications.
     17        Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
     18        This has noticeable effects in the quality of audio being played on bluetooth devices.
     19
     20        Covered by manual tests.
     21
     22        * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
     23        (WebCore::CoreAudioSharedUnit::setupAudioUnit):
     24        (WebCore::CoreAudioSharedUnit::unduck):
     25        (WebCore::CoreAudioSharedUnit::startInternal):
     26        (WebCore::CoreAudioSharedUnit::captureFailed):
     27        (WebCore::CoreAudioSharedUnit::stopProducingData):
     28
    1292019-02-06  Antti Koivisto  <antti@apple.com>
    230
  • trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp

    r239531 r241021  
    123123    void stopInternal();
    124124
     125    void unduck();
     126
    125127    void verifyIsCapturing();
    126128    void devicesChanged();
     
    340342    m_suspended = false;
    341343
     344    unduck();
     345
    342346    return err;
     347}
     348
     349void CoreAudioSharedUnit::unduck()
     350{
     351    uint32_t outputDevice;
     352    if (!defaultOutputDevice(&outputDevice))
     353        AudioDeviceDuck(outputDevice, 1.0, nullptr, 0);
    343354}
    344355
     
    613624    }
    614625
    615     uint32_t outputDevice;
    616     if (!defaultOutputDevice(&outputDevice))
    617         AudioDeviceDuck(outputDevice, 1.0, nullptr, 0);
     626    unduck();
    618627
    619628    err = AudioOutputUnitStart(m_ioUnit);
     
    644653}
    645654
    646 
    647655void CoreAudioSharedUnit::captureFailed()
    648656{
    649657#if !RELEASE_LOG_DISABLED
    650     RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::captureFailed - capture failed\n");
     658    RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::captureFailed - capture failed");
    651659#endif
    652660    for (CoreAudioCaptureSource& client : m_clients)
     
    668676
    669677    stopInternal();
     678    cleanupAudioUnit();
    670679}
    671680
Note: See TracChangeset for help on using the changeset viewer.