- Revision
- 249008
- Author
- [email protected]
- Date
- 2019-08-22 08:45:26 -0700 (Thu, 22 Aug 2019)
Log Message
Cherry-pick r248962. rdar://problem/54579627
Adopt AVSystemController_ActiveAudioRouteDidChangeNotification
https://bugs.webkit.org/show_bug.cgi?id=200992
<rdar://problem/54408993>
Reviewed by Eric Carlson.
When the system notifies us that the active audio route has changed in such a way
that necessitates pausing, pause all media sessions, exempting those that are
associated with WebRTC, since "pausing" an active audio conference isn't really
possible.
* Modules/mediastream/MediaStream.h:
* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::shouldOverridePauseDuringRouteChange const):
* platform/audio/PlatformMediaSession.h:
(WebCore::PlatformMediaSessionClient::shouldOverridePauseDuringRouteChange const):
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::activeRouteDidChange):
(-[WebMediaSessionHelper initWithCallback:]):
(-[WebMediaSessionHelper activeAudioRouteDidChange:]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (249007 => 249008)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-08-22 15:34:06 UTC (rev 249007)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-08-22 15:45:26 UTC (rev 249008)
@@ -1,5 +1,58 @@
2019-08-21 Kocsen Chung <[email protected]>
+ Cherry-pick r248962. rdar://problem/54579627
+
+ Adopt AVSystemController_ActiveAudioRouteDidChangeNotification
+ https://bugs.webkit.org/show_bug.cgi?id=200992
+ <rdar://problem/54408993>
+
+ Reviewed by Eric Carlson.
+
+ When the system notifies us that the active audio route has changed in such a way
+ that necessitates pausing, pause all media sessions, exempting those that are
+ associated with WebRTC, since "pausing" an active audio conference isn't really
+ possible.
+
+ * Modules/mediastream/MediaStream.h:
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::PlatformMediaSession::shouldOverridePauseDuringRouteChange const):
+ * platform/audio/PlatformMediaSession.h:
+ (WebCore::PlatformMediaSessionClient::shouldOverridePauseDuringRouteChange const):
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::activeRouteDidChange):
+ (-[WebMediaSessionHelper initWithCallback:]):
+ (-[WebMediaSessionHelper activeAudioRouteDidChange:]):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-08-21 Jer Noble <[email protected]>
+
+ Adopt AVSystemController_ActiveAudioRouteDidChangeNotification
+ https://bugs.webkit.org/show_bug.cgi?id=200992
+ <rdar://problem/54408993>
+
+ Reviewed by Eric Carlson.
+
+ When the system notifies us that the active audio route has changed in such a way
+ that necessitates pausing, pause all media sessions, exempting those that are
+ associated with WebRTC, since "pausing" an active audio conference isn't really
+ possible.
+
+ * Modules/mediastream/MediaStream.h:
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::PlatformMediaSession::shouldOverridePauseDuringRouteChange const):
+ * platform/audio/PlatformMediaSession.h:
+ (WebCore::PlatformMediaSessionClient::shouldOverridePauseDuringRouteChange const):
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::activeRouteDidChange):
+ (-[WebMediaSessionHelper initWithCallback:]):
+ (-[WebMediaSessionHelper activeAudioRouteDidChange:]):
+
+2019-08-21 Kocsen Chung <[email protected]>
+
Cherry-pick r248974. rdar://problem/54579634
[Mail] Tapping top of message scrolls back to copied text instead of top of the message
Modified: branches/safari-608-branch/Source/WebCore/Modules/mediastream/MediaStream.h (249007 => 249008)
--- branches/safari-608-branch/Source/WebCore/Modules/mediastream/MediaStream.h 2019-08-22 15:34:06 UTC (rev 249007)
+++ branches/safari-608-branch/Source/WebCore/Modules/mediastream/MediaStream.h 2019-08-22 15:45:26 UTC (rev 249008)
@@ -165,6 +165,7 @@
bool canProduceAudio() const final;
Document* hostingDocument() const final { return document(); }
bool processingUserGestureForMedia() const final;
+ bool shouldOverridePauseDuringRouteChange() const { return true; }
// ActiveDOMObject API.
void stop() final;
Modified: branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp (249007 => 249008)
--- branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2019-08-22 15:34:06 UTC (rev 249007)
+++ branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2019-08-22 15:45:26 UTC (rev 249008)
@@ -393,6 +393,11 @@
return m_client.hasMediaStreamSource() && otherSession.m_client.hasMediaStreamSource();
}
+bool PlatformMediaSession::shouldOverridePauseDuringRouteChange() const
+{
+ return m_client.shouldOverridePauseDuringRouteChange();
+}
+
#if !RELEASE_LOG_DISABLED
WTFLogChannel& PlatformMediaSession::logChannel() const
{
Modified: branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (249007 => 249008)
--- branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2019-08-22 15:34:06 UTC (rev 249007)
+++ branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2019-08-22 15:45:26 UTC (rev 249008)
@@ -192,6 +192,7 @@
#endif
bool canPlayConcurrently(const PlatformMediaSession&) const;
+ bool shouldOverridePauseDuringRouteChange() const;
protected:
PlatformMediaSessionClient& client() const { return m_client; }
@@ -261,6 +262,8 @@
virtual void processIsSuspendedChanged() { }
+ virtual bool shouldOverridePauseDuringRouteChange() const { return false; }
+
protected:
virtual ~PlatformMediaSessionClient() = default;
};
Modified: branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (249007 => 249008)
--- branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2019-08-22 15:34:06 UTC (rev 249007)
+++ branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2019-08-22 15:45:26 UTC (rev 249008)
@@ -50,6 +50,7 @@
#if HAVE(CELESTIAL)
void carPlayServerDied();
void updateCarPlayIsConnected(Optional<bool>&&);
+ void activeRouteDidChange(Optional<bool>&&);
#endif
private:
Modified: branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (249007 => 249008)
--- branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2019-08-22 15:34:06 UTC (rev 249007)
+++ branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2019-08-22 15:45:26 UTC (rev 249008)
@@ -60,6 +60,8 @@
SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_CarPlayIsConnectedDidChangeNotification, NSString *)
SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_CarPlayIsConnectedNotificationParameter, NSString *)
SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_ServerConnectionDiedNotification, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_ActiveAudioRouteDidChangeNotification, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_ActiveAudioRouteDidChangeNotificationParameter_ShouldPause, NSString *)
#endif
using namespace WebCore;
@@ -223,6 +225,17 @@
setIsPlayingToAutomotiveHeadUnit([[[getAVSystemControllerClass() sharedAVSystemController] attributeForKey:getAVSystemController_CarPlayIsConnectedAttribute()] boolValue]);
}
+
+void MediaSessionManageriOS::activeRouteDidChange(Optional<bool>&& shouldPause)
+{
+ if (!shouldPause || !shouldPause.value())
+ return;
+
+ forEachSession([](auto& session) {
+ if (!session.shouldOverridePauseDuringRouteChange())
+ session.pauseSession();
+ });
+}
#endif
} // namespace WebCore
@@ -254,6 +267,8 @@
[center addObserver:self selector:@selector(carPlayServerDied:) name:getAVSystemController_ServerConnectionDiedNotification() object:nil];
if (canLoadAVSystemController_CarPlayIsConnectedDidChangeNotification())
[center addObserver:self selector:@selector(carPlayIsConnectedDidChange:) name:getAVSystemController_CarPlayIsConnectedDidChangeNotification() object:nil];
+ if (canLoadAVSystemController_ActiveAudioRouteDidChangeNotification())
+ [center addObserver:self selector:@selector(activeAudioRouteDidChange:) name:getAVSystemController_ActiveAudioRouteDidChangeNotification() object:nil];
#endif
// Now playing won't work unless we turn on the delivery of remote control events.
@@ -484,6 +499,26 @@
callback->updateCarPlayIsConnected(WTFMove(carPlayIsConnected));
});
}
+
+- (void)activeAudioRouteDidChange:(NSNotification *)notification
+{
+ if (!_callback)
+ return;
+
+ UNUSED_PARAM(notification);
+ Optional<bool> shouldPause;
+ if (notification && canLoadAVSystemController_ActiveAudioRouteDidChangeNotificationParameter_ShouldPause()) {
+ NSNumber* nsShouldPause = [notification.userInfo valueForKey:getAVSystemController_ActiveAudioRouteDidChangeNotificationParameter_ShouldPause()];
+ if (nsShouldPause)
+ shouldPause = nsShouldPause.boolValue;
+ }
+
+ callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self), shouldPause = WTFMove(shouldPause)]() mutable {
+ if (auto* callback = protectedSelf->_callback)
+ callback->activeRouteDidChange(WTFMove(shouldPause));
+ });
+
+}
#endif // HAVE(CELESTIAL)
@end