Title: [199383] trunk/Source/WebCore
Revision
199383
Author
[email protected]
Date
2016-04-12 13:40:41 -0700 (Tue, 12 Apr 2016)

Log Message

[iOS] do not exit AirPlay when the screen locks
https://bugs.webkit.org/show_bug.cgi?id=156502
<rdar://problem/24616592>

Reviewed by Jer Noble.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction): Add logging.
(WebCore::HTMLMediaElement::purgeBufferedDataIfPossible): Don't tell the media engine to purge
  data if it is playing to a wireless target because that will drop the connection.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted): Add logging.
(WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget): Drive by fix: iOS doesn't
  have an explicit playbackTarget, don't test for it.
(WebCore::MediaElementSession::isPlayingToWirelessPlaybackTarget): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (199382 => 199383)


--- trunk/Source/WebCore/ChangeLog	2016-04-12 20:06:26 UTC (rev 199382)
+++ trunk/Source/WebCore/ChangeLog	2016-04-12 20:40:41 UTC (rev 199383)
@@ -1,3 +1,22 @@
+2016-04-12  Eric Carlson  <[email protected]>
+
+        [iOS] do not exit AirPlay when the screen locks
+        https://bugs.webkit.org/show_bug.cgi?id=156502
+        <rdar://problem/24616592>
+
+        Reviewed by Jer Noble.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction): Add logging.
+        (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible): Don't tell the media engine to purge 
+          data if it is playing to a wireless target because that will drop the connection.
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::playbackPermitted): Add logging.
+        (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget): Drive by fix: iOS doesn't 
+          have an explicit playbackTarget, don't test for it.
+        (WebCore::MediaElementSession::isPlayingToWirelessPlaybackTarget): Ditto.
+
 2016-04-12  Gavin Barraclough  <[email protected]>
 
         WebKit should adopt journal_mode=wal for all SQLite databases.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (199382 => 199383)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-04-12 20:06:26 UTC (rev 199382)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-04-12 20:40:41 UTC (rev 199383)
@@ -6667,12 +6667,16 @@
 
 bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const
 {
-    if (type != PlatformMediaSession::EnteringBackground)
+    if (type != PlatformMediaSession::EnteringBackground) {
+        LOG(Media, "HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(%p) - returning false because type != PlatformMediaSession::EnteringBackground", this);
         return false;
+    }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    if (m_player && m_player->isCurrentPlaybackTargetWireless())
+    if (m_player && m_player->isCurrentPlaybackTargetWireless()) {
+        LOG(Media, "HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(%p) - returning true because m_player->isCurrentPlaybackTargetWireless is true", this);
         return true;
+    }
 #endif
     if (m_videoFullscreenMode & VideoFullscreenModePictureInPicture)
         return true;
@@ -6780,6 +6784,11 @@
     if (!MemoryPressureHandler::singleton().isUnderMemoryPressure() && PlatformMediaSessionManager::sharedManager().sessionCanLoadMedia(*m_mediaSession))
         return;
 
+    if (isPlayingToWirelessPlaybackTarget()) {
+        LOG(Media, "HTMLMediaElement::purgeBufferedDataIfPossible(%p) - early return because m_player->isCurrentPlaybackTargetWireless is true", this);
+        return;
+    }
+
     // This is called to relieve memory pressure. Turning off buffering causes the media playback
     // daemon to release memory associated with queued-up video frames.
     // We turn it back on right away, but new frames won't get loaded unless playback is resumed.

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (199382 => 199383)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2016-04-12 20:06:26 UTC (rev 199382)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2016-04-12 20:40:41 UTC (rev 199383)
@@ -362,16 +362,20 @@
 
 bool MediaElementSession::canPlayToWirelessPlaybackTarget() const
 {
+#if !PLATFORM(IOS)
     if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
         return false;
+#endif
 
     return client().canPlayToWirelessPlaybackTarget();
 }
 
 bool MediaElementSession::isPlayingToWirelessPlaybackTarget() const
 {
+#if !PLATFORM(IOS)
     if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
         return false;
+#endif
 
     return client().isPlayingToWirelessPlaybackTarget();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to