Title: [245199] trunk/Source/WebCore
Revision
245199
Author
[email protected]
Date
2019-05-10 16:29:56 -0700 (Fri, 10 May 2019)

Log Message

[iOS] HTMLMediaElement sometimes doesn't send 'webkitplaybacktargetavailabilitychanged' event
https://bugs.webkit.org/show_bug.cgi?id=197793
<rdar://problem/46429187>

Reviewed by Jer Noble.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::MediaElementSession): Initialize m_hasPlaybackTargets.

* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange): Log
target availability.
(-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): Call the client
externalOutputDeviceAvailableDidChange method after the AVRouteDetector is available.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (245198 => 245199)


--- trunk/Source/WebCore/ChangeLog	2019-05-10 23:25:28 UTC (rev 245198)
+++ trunk/Source/WebCore/ChangeLog	2019-05-10 23:29:56 UTC (rev 245199)
@@ -1,3 +1,20 @@
+2019-05-10  Eric Carlson  <[email protected]>
+
+        [iOS] HTMLMediaElement sometimes doesn't send 'webkitplaybacktargetavailabilitychanged' event
+        https://bugs.webkit.org/show_bug.cgi?id=197793
+        <rdar://problem/46429187>
+
+        Reviewed by Jer Noble.
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::MediaElementSession): Initialize m_hasPlaybackTargets.
+
+        * platform/audio/ios/MediaSessionManagerIOS.mm:
+        (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange): Log
+        target availability.
+        (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): Call the client 
+        externalOutputDeviceAvailableDidChange method after the AVRouteDetector is available.
+
 2019-05-09  Geoffrey Garen  <[email protected]>
 
         Downgrade RELEASE_ASSERT TO RELEASE_LOG_FAULT for SQLite Class A files

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (245198 => 245199)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2019-05-10 23:25:28 UTC (rev 245198)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2019-05-10 23:29:56 UTC (rev 245199)
@@ -110,6 +110,7 @@
     , m_restrictions(NoRestrictions)
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     , m_targetAvailabilityChangedTimer(*this, &MediaElementSession::targetAvailabilityChangedTimerFired)
+    , m_hasPlaybackTargets(PlatformMediaSessionManager::sharedManager().hasWirelessTargetsAvailable())
 #endif
     , m_mainContentCheckTimer(*this, &MediaElementSession::mainContentCheckTimerFired)
     , m_clientDataBufferingTimer(*this, &MediaElementSession::clientDataBufferingTimerFired)

Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (245198 => 245199)


--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h	2019-05-10 23:25:28 UTC (rev 245198)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h	2019-05-10 23:29:56 UTC (rev 245199)
@@ -121,8 +121,8 @@
 
 #if PLATFORM(IOS_FAMILY)
     virtual void configureWireLessTargetMonitoring() { }
+#endif
     virtual bool hasWirelessTargetsAvailable() { return false; }
-#endif
 
     void setCurrentSession(PlatformMediaSession&);
     PlatformMediaSession* currentSession() const;

Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (245198 => 245199)


--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2019-05-10 23:25:28 UTC (rev 245198)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2019-05-10 23:29:56 UTC (rev 245199)
@@ -183,9 +183,14 @@
 void MediaSessionManageriOS::externalOutputDeviceAvailableDidChange()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    forEachSession([haveTargets = [m_objcObserver hasWirelessTargetsAvailable]] (PlatformMediaSession& session, size_t) {
+
+    auto haveTargets = [m_objcObserver hasWirelessTargetsAvailable];
+    ALWAYS_LOG(LOGIDENTIFIER, haveTargets);
+
+    forEachSession([haveTargets] (PlatformMediaSession& session, size_t) {
         session.externalOutputDeviceAvailableDidChange(haveTargets);
     });
+
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -289,6 +294,8 @@
             protectedSelf->_routeDetector = adoptNS([PAL::allocAVRouteDetectorInstance() init]);
             protectedSelf->_routeDetector.get().routeDetectionEnabled = protectedSelf->_monitoringAirPlayRoutes;
             [[NSNotificationCenter defaultCenter] addObserver:protectedSelf selector:@selector(wirelessRoutesAvailableDidChange:) name:AVRouteDetectorMultipleRoutesDetectedDidChangeNotification object:protectedSelf->_routeDetector.get()];
+
+            protectedSelf->_callback->externalOutputDeviceAvailableDidChange();
             END_BLOCK_OBJC_EXCEPTIONS
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to