Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 72ecec37175ba1f2b5c1437474200be1550f639e
      
https://github.com/WebKit/WebKit/commit/72ecec37175ba1f2b5c1437474200be1550f639e
  Author: Andy Estes <[email protected]>
  Date:   2025-10-07 (Tue, 07 Oct 2025)

  Changed paths:
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLMediaElement.h
    M Source/WebCore/platform/audio/AudioSession.h
    M Source/WebCore/platform/cocoa/VideoPresentationModel.h
    M Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.h
    M Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.messages.in
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm
    M Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm

  Log Message:
  -----------
  [iOS] Requesting route sharing policy and UID can needlessly wake up a 
suspended WebContent process
https://bugs.webkit.org/show_bug.cgi?id=300345
rdar://162147160

Reviewed by Jer Noble.

When the UI process receives a 
VideoPresentationManagerProxy::AudioSessionCategoryChanged message,
VideoPresentationInterfaceIOS sends a message back to the WebContent process 
asking for the audio
session's route sharing policy and routing context UID. If the WebContent 
process had suspended
just after sending VideoPresentationManagerProxy::AudioSessionCategoryChanged 
then this second
message will resume it, and whenever a WebContent process resumes 
MediaSessionManager also resumes
media playback if necessary, potentially causing the audio session category to 
change again. This
results in a feedback loop where a WebContent process that should be suspended 
is resumed to handle
a VideoPresentationManager::RequestRouteSharingPolicyAndContextUID message, 
which resumes media
playback, which changes the audio session category, which sends another
VideoPresentationManager::RequestRouteSharingPolicyAndContextUID message, ad 
infinitum.

This issue was previously worked around in 297956@main by partially reverting 
296380@main. The
pre-296380@main behavior was to send 
VideoPresentationManager::RequestRouteSharingPolicyAndContextUID
to the WebPageProxy's current WebContent process, which after a process swap on 
navigation is no
longer the process that contained the media element tracked by the 
VideoPresentationInterface
sending the message. Since that process is not suspended, the feedback loop 
would be broken.

This change fixes the issue by removing the need to send
VideoPresentationManager::RequestRouteSharingPolicyAndContextUID in response to
VideoPresentationManagerProxy::AudioSessionCategoryChanged. Instead, 
VideoPresentationInterfaceIOS
is notified whenever an audio session's route sharing policy or routing context 
UID is changed,
reconfiguring its AVPlayerViewController as necessary. Since this also breaks 
the feedback loop,
the part of 296380@main that was reverted in 297956@main can be restored.

* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::initializeMediaSession):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::routingContextUIDDidChange):
* Source/WebCore/html/HTMLMediaElement.h:
(WebCore::HTMLMediaElementClient::routingContextUIDChanged):
* Source/WebCore/platform/audio/AudioSession.h:
(WebCore::AudioSessionConfigurationChangeObserver::hardwareMutedStateDidChange):
(WebCore::AudioSessionConfigurationChangeObserver::routingContextUIDDidChange):
* Source/WebCore/platform/cocoa/VideoPresentationModel.h:
(WebCore::VideoPresentationModelClient::routingContextUIDChanged):
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.h:
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm:
(WebCore::VideoPresentationModelVideoElement::routingContextUIDChanged):
* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h:
* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm:
(WebCore::VideoPresentationInterfaceIOS::audioSessionCategoryChanged):
(WebCore::VideoPresentationInterfaceIOS::routingContextUIDChanged):
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.messages.in:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm:
(WebKit::VideoPresentationModelContext::routingContextUIDChanged):
(WebKit::VideoPresentationManagerProxy::requestRouteSharingPolicyAndContextUID):
(WebKit::VideoPresentationManagerProxy::routingContextUIDChanged):
* Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::configurationChanged):
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h:
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm:
(WebKit::VideoPresentationInterfaceContext::routingContextUIDChanged):
(WebKit::VideoPresentationManager::routingContextUIDChanged):

Canonical link: https://commits.webkit.org/301190@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