- Revision
- 264177
- Author
- [email protected]
- Date
- 2020-07-09 09:57:19 -0700 (Thu, 09 Jul 2020)
Log Message
Reset AVSystemController_PIDToInheritApplicationStateFrom when mediaserverd dies
https://bugs.webkit.org/show_bug.cgi?id=214112
<rdar://problem/65229214>
Reviewed by Jer Noble.
Source/WebCore:
Tested manually because this can only be tested by killing a system process while
capturing on iOS hardware.
* platform/audio/cocoa/MediaSessionManagerCocoa.h: Add task queue accessor.
(WebCore::MediaSessionManagerCocoa::taskQueue):
* platform/audio/ios/MediaSessionHelperIOS.h:
(WebCore::MediaSessionHelperClient::mediaServerConnectionDied):
* platform/audio/ios/MediaSessionHelperIOS.mm:
(MediaSessionHelperiOS::mediaServerConnectionDied): Renamed from carPlayServerDied.
Inform clients if we previously set the PID proxy.
(-[WebMediaSessionHelper initWithCallback:]): Call mediaServerConnectionDied.
(-[WebMediaSessionHelper mediaServerConnectionDied:]): Ditto.
(MediaSessionHelperiOS::carPlayServerDied): Deleted.
(-[WebMediaSessionHelper carPlayServerDied:]): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::mediaServerConnectionDied): Call providePresentingApplicationPID
if we previously set the PID proxy.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::captureSessionRuntimeError): Don't try to restart the
session immediately since this is called directly from the notification handler.
Source/WebKit:
* GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
(WebKit::RemoteMediaSessionHelperProxy::providePresentingApplicationPID): Don't bother
tracking whether or not providePresentingApplicationPID has been called, the session
helper already does that.
* GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (264176 => 264177)
--- trunk/Source/WebCore/ChangeLog 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebCore/ChangeLog 2020-07-09 16:57:19 UTC (rev 264177)
@@ -1,3 +1,36 @@
+2020-07-09 Eric Carlson <[email protected]>
+
+ Reset AVSystemController_PIDToInheritApplicationStateFrom when mediaserverd dies
+ https://bugs.webkit.org/show_bug.cgi?id=214112
+ <rdar://problem/65229214>
+
+ Reviewed by Jer Noble.
+
+ Tested manually because this can only be tested by killing a system process while
+ capturing on iOS hardware.
+
+ * platform/audio/cocoa/MediaSessionManagerCocoa.h: Add task queue accessor.
+ (WebCore::MediaSessionManagerCocoa::taskQueue):
+
+ * platform/audio/ios/MediaSessionHelperIOS.h:
+ (WebCore::MediaSessionHelperClient::mediaServerConnectionDied):
+ * platform/audio/ios/MediaSessionHelperIOS.mm:
+ (MediaSessionHelperiOS::mediaServerConnectionDied): Renamed from carPlayServerDied.
+ Inform clients if we previously set the PID proxy.
+ (-[WebMediaSessionHelper initWithCallback:]): Call mediaServerConnectionDied.
+ (-[WebMediaSessionHelper mediaServerConnectionDied:]): Ditto.
+ (MediaSessionHelperiOS::carPlayServerDied): Deleted.
+ (-[WebMediaSessionHelper carPlayServerDied:]): Deleted.
+
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::mediaServerConnectionDied): Call providePresentingApplicationPID
+ if we previously set the PID proxy.
+
+ * platform/mediastream/mac/AVVideoCaptureSource.mm:
+ (WebCore::AVVideoCaptureSource::captureSessionRuntimeError): Don't try to restart the
+ session immediately since this is called directly from the notification handler.
+
2020-07-09 Clark Wang <[email protected]>
Set Restrictions for channelCount, channelCountMode for PannerNode
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h (264176 => 264177)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2020-07-09 16:57:19 UTC (rev 264177)
@@ -82,6 +82,8 @@
PlatformMediaSession* nowPlayingEligibleSession();
+ GenericTaskQueue<Timer>& taskQueue() { return m_taskQueue; }
+
private:
#if !RELEASE_LOG_DISABLED
const char* logClassName() const override { return "MediaSessionManagerCocoa"; }
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.h (264176 => 264177)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.h 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.h 2020-07-09 16:57:19 UTC (rev 264177)
@@ -42,6 +42,7 @@
virtual void applicationDidEnterBackground(SuspendedUnderLock) = 0;
virtual void applicationWillBecomeInactive() = 0;
virtual void applicationDidBecomeActive() = 0;
+ virtual void mediaServerConnectionDied() { };
enum class HasAvailableTargets : bool { No, Yes };
virtual void externalOutputDeviceAvailableDidChange(HasAvailableTargets) = 0;
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.mm (264176 => 264177)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.mm 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.mm 2020-07-09 16:57:19 UTC (rev 264177)
@@ -98,7 +98,7 @@
void applicationWillBecomeInactive();
void applicationDidBecomeActive();
#if HAVE(CELESTIAL)
- void carPlayServerDied();
+ void mediaServerConnectionDied();
void updateCarPlayIsConnected(Optional<bool>&&);
#endif
#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR) && !PLATFORM(MACCATALYST) && !PLATFORM(WATCHOS)
@@ -226,9 +226,16 @@
}
#if HAVE(CELESTIAL)
-void MediaSessionHelperiOS::carPlayServerDied()
+void MediaSessionHelperiOS::mediaServerConnectionDied()
{
updateCarPlayIsConnected(WTF::nullopt);
+
+ if (!m_havePresentedApplicationPID)
+ return;
+
+ m_havePresentedApplicationPID = false;
+ for (auto& client : m_clients)
+ client.mediaServerConnectionDied();
}
void MediaSessionHelperiOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIsConnected)
@@ -333,7 +340,7 @@
#if HAVE(CELESTIAL)
if (canLoadAVSystemController_ServerConnectionDiedNotification())
- [center addObserver:self selector:@selector(carPlayServerDied:) name:getAVSystemController_ServerConnectionDiedNotification() object:nil];
+ [center addObserver:self selector:@selector(mediaServerConnectionDied:) name:getAVSystemController_ServerConnectionDiedNotification() object:nil];
if (canLoadAVSystemController_CarPlayIsConnectedDidChangeNotification())
[center addObserver:self selector:@selector(carPlayIsConnectedDidChange:) name:getAVSystemController_CarPlayIsConnectedDidChangeNotification() object:nil];
#endif
@@ -512,16 +519,16 @@
}
#if HAVE(CELESTIAL)
-- (void)carPlayServerDied:(NSNotification *)notification
+- (void)mediaServerConnectionDied:(NSNotification *)notification
{
if (!_callback)
return;
- LOG(Media, "-[WebMediaSessionHelper carPlayServerDied:]");
+ LOG(Media, "-[WebMediaSessionHelper mediaServerConnectionDied:]");
UNUSED_PARAM(notification);
callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self)]() mutable {
if (auto* callback = protectedSelf->_callback)
- callback->carPlayServerDied();
+ callback->mediaServerConnectionDied();
});
}
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (264176 => 264177)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2020-07-09 16:57:19 UTC (rev 264177)
@@ -76,6 +76,7 @@
void applicationDidEnterBackground(SuspendedUnderLock) final;
void applicationWillBecomeInactive() final;
void applicationDidBecomeActive() final;
+ void mediaServerConnectionDied() final;
void externalOutputDeviceAvailableDidChange(HasAvailableTargets) final;
void activeAudioRouteDidChange(ShouldPause) final;
void activeVideoRouteDidChange(SupportsAirPlayVideo, Ref<MediaPlaybackTarget>&&) final;
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (264176 => 264177)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2020-07-09 16:57:19 UTC (rev 264177)
@@ -115,6 +115,19 @@
#endif
}
+void MediaSessionManageriOS::mediaServerConnectionDied()
+{
+ ALWAYS_LOG(LOGIDENTIFIER, m_havePresentedApplicationPID);
+
+ if (!m_havePresentedApplicationPID)
+ return;
+
+ m_havePresentedApplicationPID = false;
+ taskQueue().enqueueTask([] () {
+ providePresentingApplicationPID();
+ });
+}
+
void MediaSessionManageriOS::providePresentingApplicationPID()
{
MediaSessionHelper::sharedHelper().providePresentingApplicationPID(presentingApplicationPID());
Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (264176 => 264177)
--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm 2020-07-09 16:57:19 UTC (rev 264177)
@@ -615,14 +615,18 @@
#if PLATFORM(IOS_FAMILY)
void AVVideoCaptureSource::captureSessionRuntimeError(RetainPtr<NSError> error)
{
- ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, [[error localizedDescription] UTF8String]);
+ auto identifier = LOGIDENTIFIER;
+ ERROR_LOG_IF(loggerPtr(), identifier, [error code], ", ", [[error localizedDescription] UTF8String]);
if (!m_isRunning || error.get().code != AVErrorMediaServicesWereReset)
return;
- // Try to restart the session, but reset m_isRunning immediately so if it fails we won't try again.
- [m_session startRunning];
- m_isRunning = [m_session isRunning];
+ scheduleDeferredTask([this, identifier] {
+ // Try to restart the session, but reset m_isRunning immediately so if it fails we won't try again.
+ ERROR_LOG_IF(loggerPtr(), identifier, "restarting session");
+ [m_session startRunning];
+ m_isRunning = [m_session isRunning];
+ });
}
void AVVideoCaptureSource::captureSessionBeginInterruption(RetainPtr<NSNotification> notification)
Modified: trunk/Source/WebKit/ChangeLog (264176 => 264177)
--- trunk/Source/WebKit/ChangeLog 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebKit/ChangeLog 2020-07-09 16:57:19 UTC (rev 264177)
@@ -1,3 +1,17 @@
+2020-07-09 Eric Carlson <[email protected]>
+
+ Reset AVSystemController_PIDToInheritApplicationStateFrom when mediaserverd dies
+ https://bugs.webkit.org/show_bug.cgi?id=214112
+ <rdar://problem/65229214>
+
+ Reviewed by Jer Noble.
+
+ * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
+ (WebKit::RemoteMediaSessionHelperProxy::providePresentingApplicationPID): Don't bother
+ tracking whether or not providePresentingApplicationPID has been called, the session
+ helper already does that.
+ * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
+
2020-07-09 Wenson Hsieh <[email protected]>
[iOS] Occasional crash under -[UIView _setViewDelegate:] when presenting date and time pickers
Modified: trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp (264176 => 264177)
--- trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp 2020-07-09 16:57:19 UTC (rev 264177)
@@ -67,10 +67,6 @@
void RemoteMediaSessionHelperProxy::providePresentingApplicationPID(int pid)
{
- if (m_providedApplicationPID)
- return;
-
- m_providedApplicationPID = true;
MediaSessionHelper::sharedHelper().providePresentingApplicationPID(pid);
}
Modified: trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h (264176 => 264177)
--- trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h 2020-07-09 16:31:33 UTC (rev 264176)
+++ trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h 2020-07-09 16:57:19 UTC (rev 264177)
@@ -61,7 +61,6 @@
void activeAudioRouteDidChange(ShouldPause) final;
void activeVideoRouteDidChange(SupportsAirPlayVideo, Ref<WebCore::MediaPlaybackTarget>&&) final;
- bool m_providedApplicationPID { false };
bool m_isMonitoringWirelessRoutes { false };
GPUConnectionToWebProcess& m_gpuConnection;
};