Title: [186854] trunk/Source/WebCore
Revision
186854
Author
[email protected]
Date
2015-07-15 13:49:48 -0700 (Wed, 15 Jul 2015)

Log Message

[Mac] AirPlay route is not always set automatically
https://bugs.webkit.org/show_bug.cgi?id=146969

Reviewed by Jer Noble.

* Modules/mediasession/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Return early if there are
  no clients. Make the first client in the vector automatically play to the target if there
  is no other match and there is an active route.
(WebCore::WebMediaSessionManager::watchdogTimerFired): Call picker.invalidatePlaybackTargets,
  not stopMonitoringPlaybackTargets.

* platform/graphics/MediaPlaybackTargetPicker.cpp:
(WebCore::MediaPlaybackTargetPicker::invalidatePlaybackTargets): New.
* platform/graphics/MediaPlaybackTargetPicker.h:

* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
(WebCore::MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets): Do nothing, AirPlay
  automatically stops monitoring when appropriate and release the picker also releases
  the output context, which drops the route.
(WebCore::MediaPlaybackTargetPickerMac::invalidatePlaybackTargets): New.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (186853 => 186854)


--- trunk/Source/WebCore/ChangeLog	2015-07-15 20:36:01 UTC (rev 186853)
+++ trunk/Source/WebCore/ChangeLog	2015-07-15 20:49:48 UTC (rev 186854)
@@ -1,3 +1,28 @@
+2015-07-15  Eric Carlson  <[email protected]>
+
+        [Mac] AirPlay route is not always set automatically
+        https://bugs.webkit.org/show_bug.cgi?id=146969
+
+        Reviewed by Jer Noble.
+
+        * Modules/mediasession/WebMediaSessionManager.cpp:
+        (WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Return early if there are
+          no clients. Make the first client in the vector automatically play to the target if there
+          is no other match and there is an active route.
+        (WebCore::WebMediaSessionManager::watchdogTimerFired): Call picker.invalidatePlaybackTargets,
+          not stopMonitoringPlaybackTargets.
+
+        * platform/graphics/MediaPlaybackTargetPicker.cpp:
+        (WebCore::MediaPlaybackTargetPicker::invalidatePlaybackTargets): New.
+        * platform/graphics/MediaPlaybackTargetPicker.h:
+
+        * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
+        * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
+        (WebCore::MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets): Do nothing, AirPlay
+          automatically stops monitoring when appropriate and release the picker also releases
+          the output context, which drops the route.
+        (WebCore::MediaPlaybackTargetPickerMac::invalidatePlaybackTargets): New.
+
 2015-07-15  Anders Carlsson  <[email protected]>
 
         Remove forwarding headers that no longer point to valid headers

Modified: trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp (186853 => 186854)


--- trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp	2015-07-15 20:36:01 UTC (rev 186853)
+++ trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp	2015-07-15 20:49:48 UTC (rev 186854)
@@ -245,6 +245,9 @@
 
 void WebMediaSessionManager::configurePlaybackTargetClients()
 {
+    if (m_clientState.isEmpty())
+        return;
+
     size_t indexOfClientThatRequestedPicker = notFound;
     size_t indexOfLastClientToRequestPicker = notFound;
     size_t indexOfClientWillPlayToTarget = notFound;
@@ -269,6 +272,8 @@
         indexOfClientWillPlayToTarget = indexOfClientThatRequestedPicker;
     if (indexOfClientWillPlayToTarget == notFound && indexOfLastClientToRequestPicker != notFound)
         indexOfClientWillPlayToTarget = indexOfLastClientToRequestPicker;
+    if (indexOfClientWillPlayToTarget == notFound && haveActiveRoute)
+        indexOfClientWillPlayToTarget = 0;
 
     LOG(Media, "WebMediaSessionManager::configurePlaybackTargetClients - indexOfClientWillPlayToTarget = %zu", indexOfClientWillPlayToTarget);
 
@@ -288,7 +293,6 @@
 
     if (haveActiveRoute && indexOfClientWillPlayToTarget != notFound) {
         auto& state = m_clientState[indexOfClientWillPlayToTarget];
-
         if (!flagsAreSet(state->flags, MediaProducer::IsPlayingToExternalDevice))
             state->client.setShouldPlayToPlaybackTarget(state->contextId, true);
     }
@@ -410,7 +414,7 @@
     if (!m_playbackTarget)
         return;
 
-    targetPicker().stopMonitoringPlaybackTargets();
+    targetPicker().invalidatePlaybackTargets();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.cpp (186853 => 186854)


--- trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.cpp	2015-07-15 20:36:01 UTC (rev 186853)
+++ trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.cpp	2015-07-15 20:49:48 UTC (rev 186854)
@@ -55,6 +55,11 @@
     ASSERT_NOT_REACHED();
 }
 
+void MediaPlaybackTargetPicker::invalidatePlaybackTargets()
+{
+    ASSERT_NOT_REACHED();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Modified: trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h (186853 => 186854)


--- trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h	2015-07-15 20:36:01 UTC (rev 186853)
+++ trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h	2015-07-15 20:49:48 UTC (rev 186854)
@@ -53,6 +53,7 @@
     virtual void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute);
     virtual void startingMonitoringPlaybackTargets();
     virtual void stopMonitoringPlaybackTargets();
+    virtual void invalidatePlaybackTargets();
 
 protected:
     explicit MediaPlaybackTargetPicker(Client&);

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h (186853 => 186854)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h	2015-07-15 20:36:01 UTC (rev 186853)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h	2015-07-15 20:49:48 UTC (rev 186854)
@@ -44,10 +44,11 @@
 
     WEBCORE_EXPORT static std::unique_ptr<MediaPlaybackTargetPickerMac> create(MediaPlaybackTargetPicker::Client&);
 
-    virtual void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute) override;
-    virtual void startingMonitoringPlaybackTargets() override;
-    virtual void stopMonitoringPlaybackTargets() override;
-    
+    void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute) override;
+    void startingMonitoringPlaybackTargets() override;
+    void stopMonitoringPlaybackTargets() override;
+    void invalidatePlaybackTargets() override;
+
     void availableDevicesDidChange();
     void currentDeviceDidChange();
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm (186853 => 186854)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm	2015-07-15 20:36:01 UTC (rev 186853)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm	2015-07-15 20:49:48 UTC (rev 186854)
@@ -188,7 +188,13 @@
 void MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets()
 {
     LOG(Media, "MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets");
+    // Nothing to do, AirPlay takes care of this automatically.
+}
 
+void MediaPlaybackTargetPickerMac::invalidatePlaybackTargets()
+{
+    LOG(Media, "MediaPlaybackTargetPickerMac::invalidatePlaybackTargets");
+
     if (m_outputDeviceMenuController) {
         [m_outputDeviceMenuController removeObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDeviceAvailableKeyName];
         [m_outputDeviceMenuController removeObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDevicePickedKeyName];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to