Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1f39259fc689b6378cb21d319d893e7aec752d74
      
https://github.com/WebKit/WebKit/commit/1f39259fc689b6378cb21d319d893e7aec752d74
  Author: Youenn Fablet <[email protected]>
  Date:   2024-12-01 (Sun, 01 Dec 2024)

  Changed paths:
    M Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
    M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp
    M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h
    M Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp
    M Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.h
    M Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSource.h
    M Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp
    M Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.h

  Log Message:
  -----------
  Do not mute CoreAudioSharedUnit if capturing page is going away
rdar://140620024
https://bugs.webkit.org/show_bug.cgi?id=283751

Reviewed by Jean-Yves Avenard.

If a page that is capturing and playing audio gets navigated away, we do not 
want to mute the CoreAudioSharedUnit.
This would trigger a mute notification that is not meaningful since capture and 
playing audio is finishing.

To do this, we make sure to end sources right when the last track related to 
the source is stopped.
Before the patch, we would stop the source and later on, after GC, we would end 
things.
This is done by updating RemoteRealtimeMediaSource.

We also implement CoreAudioCaptureSource::endProducingData to first unregister 
as a client and then stop the CoreAudioSharedUnit.
This way, when stopping the CoreAudioSharedUnit, we know whether all sources 
are gone or whether some sources are temporarily muted.

When stopping and there is no remaining CoreAudioSharedUnit clients, we do not 
mute the CoreAudioSharedUnit right away, as we may be stopping the 
CoreAudioSharedUnit very soon.
Instead we schedule a timer that will mute if needed.

Manually tested by doing the following:
1. Load https://webrtc.github.io/samples/src/content/peerconnection/pc1/, click 
start, call. Reload the page and observe the OS is not playing the mute 
notification.
2. Load https://webrtc.github.io/samples/src/content/peerconnection/pc1/, and 
from web inspector, stop the video track and the audio track. After 1 second, 
the mute notification will be played and the microphone OS indicator will go 
away.

* Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::endProducingData):
* Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h:
* Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp:
(WebCore::CoreAudioSharedUnit::CoreAudioSharedUnit):
(WebCore::CoreAudioSharedUnit::updateMutedState):
(WebCore::CoreAudioSharedUnit::updateMutedStateTimerFired):
* Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.h:
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSource.h:
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::endProducingData): Deleted.
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to