[webkit-changes] [WebKit/WebKit] f07840: Continue running the audio unit even if microphone...

youennf noreply at github.com
Tue Sep 17 00:30:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f078400396ccb6f110537517333f81594652e74e
      https://github.com/WebKit/WebKit/commit/f078400396ccb6f110537517333f81594652e74e
  Author: Youenn Fablet <youenn at apple.com>
  Date:   2024-09-17 (Tue, 17 Sep 2024)

  Changed paths:
    M LayoutTests/fast/mediastream/microphone-change-while-muted-expected.txt
    M LayoutTests/fast/mediastream/microphone-change-while-muted.html
    M Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp
    M Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.h
    M Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp

  Log Message:
  -----------
  Continue running the audio unit even if microphone tracks are all muted
rdar://135801398
https://bugs.webkit.org/show_bug.cgi?id=279515

Reviewed by Eric Carlson.

For AirPods mute API, we need the audio unit to run so that we can react to unmuting through AirPods.
Similarly for voice detection, we need to continue running the audio unit to get voice detection.

For that reason, we are now always keeping the audio unit running when it has CoreAudioCaptureSource clients,
even though those clients are not requiring to get microphone samples.

We are now running the audio unit if:
- it has clients.
- it has no client but is being used to render audio.

In case of input device disappearing, since we are now continuing to run the audio unit to detect voice detection or get AirPods unmuting,
we can no longer pretend to have muted capture without a device.
For that reason, we are now failing when the device disappears, even if capture is muted.
We update BaseAudioSharedUnit::devicesChanged and LayoutTests/fast/mediastream/microphone-change-while-muted.html accordingly.

Given running the audio unit can consume some CPU, we might want to stop capture for pages that muted microphone tracks and have been idle for some time.
This will be done in a follow-up.

* LayoutTests/fast/mediastream/microphone-change-while-muted-expected.txt:
* LayoutTests/fast/mediastream/microphone-change-while-muted.html:
* Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp:
(WebCore::BaseAudioSharedUnit::removeClient):
(WebCore::BaseAudioSharedUnit::devicesChanged):
(WebCore::BaseAudioSharedUnit::captureFailed):
(WebCore::BaseAudioSharedUnit::stopProducingData):
(WebCore::BaseAudioSharedUnit::setIsRenderingAudio):
(WebCore::BaseAudioSharedUnit::stopRunning):
* Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.h:
(WebCore::BaseAudioSharedUnit::shouldContinueRunning const):
(WebCore::BaseAudioSharedUnit::isListeningToVoiceActivity const): Deleted.
* Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp:
(WebCore::CoreAudioSharedUnit::reconfigureAudioUnit):

Canonical link: https://commits.webkit.org/283755@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list