Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (191167 => 191168)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-10-16 06:28:51 UTC (rev 191168)
@@ -1,5 +1,20 @@
2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+ Merge r190434. rdar://problem/22865007
+
+ 2015-10-01 Eric Carlson <eric.carl...@apple.com>
+
+ [iOS] AirPlay should not stop when the screen locks
+ https://bugs.webkit.org/show_bug.cgi?id=148315
+ <rdar://problem/22770703>
+
+ Reviewed by Jer Noble.
+
+ * media/video-interruption-with-resume-allowing-play.html:
+ * media/video-interruption-with-resume-not-allowing-play.html:
+
+2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+
Merge r191077. rdar://problem/22993325
2015-10-14 Alex Christensen <achristen...@webkit.org>
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt (191167 => 191168)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt 2015-10-16 06:28:51 UTC (rev 191168)
@@ -6,7 +6,7 @@
EVENT(playing)
EXPECTED (video.paused == 'false') OK
-RUN(internals.beginMediaSessionInterruption())
+RUN(internals.beginMediaSessionInterruption('System'))
100ms timer fired...
EXPECTED (video.paused == 'true') OK
@@ -16,7 +16,7 @@
EXPECTED (video.paused == 'false') OK
EXPECTED (video.paused == 'false') OK
-RUN(internals.beginMediaSessionInterruption())
+RUN(internals.beginMediaSessionInterruption('System'))
100ms timer fired...
EXPECTED (video.paused == 'true') OK
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html (191167 => 191168)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html 2015-10-16 06:28:51 UTC (rev 191168)
@@ -12,7 +12,7 @@
case "playing":
testExpected("video.paused", false);
state = "interrupted";
- run("internals.beginMediaSessionInterruption()");;
+ run("internals.beginMediaSessionInterruption('System')");;
setTimeout(checkState, 100);
consoleWrite("");
break;
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt (191167 => 191168)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt 2015-10-16 06:28:51 UTC (rev 191168)
@@ -5,7 +5,7 @@
RUN(video.play())
EVENT(playing)
-RUN(internals.beginMediaSessionInterruption())
+RUN(internals.beginMediaSessionInterruption('System'))
100ms timer fired...
EXPECTED (video.paused == 'true') OK
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html (191167 => 191168)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html 2015-10-16 06:28:51 UTC (rev 191168)
@@ -7,7 +7,7 @@
function playing()
{
- run("internals.beginMediaSessionInterruption()");;
+ run("internals.beginMediaSessionInterruption('System')");;
setTimeout(checkState, 100);
}
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-16 06:28:51 UTC (rev 191168)
@@ -1,5 +1,51 @@
2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+ Merge r190434. rdar://problem/22865007
+
+ 2015-10-01 Eric Carlson <eric.carl...@apple.com>
+
+ [iOS] AirPlay should not stop when the screen locks
+ https://bugs.webkit.org/show_bug.cgi?id=148315
+ <rdar://problem/22770703>
+
+ Reviewed by Jer Noble.
+
+ Tested by media/video-interruption-with-resume-allowing-play.html
+ media/video-interruption-with-resume-not-allowing-play.html
+
+ * Modules/webaudio/AudioContext.h: overrideBackgroundPlaybackRestriction ->
+ shouldOverrideBackgroundPlaybackRestriction.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::suspendPlayback): Fix a typo in the logging.
+ (WebCore::HTMLMediaElement::mayResumePlayback): Ditto.
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction): Renamed from
+ overrideBackgroundPlaybackRestriction.
+ (WebCore::HTMLMediaElement::overrideBackgroundPlaybackRestriction): Deleted.
+ * html/HTMLMediaElement.h:
+
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::stateName):
+ (WebCore::interruptionName): New, log the name of the interruption.
+ (WebCore::PlatformMediaSession::beginInterruption): Log the interruption type. Don't
+ increment the interruption counter if we are going to ignore it. Incorporate logic
+ from doInterruption.
+ (WebCore::PlatformMediaSession::doInterruption): Deleted.
+ (WebCore::PlatformMediaSession::shouldDoInterruption): Deleted.
+ (WebCore::PlatformMediaSession::forceInterruption): Deleted.
+
+ * platform/audio/PlatformMediaSession.h: Add SuspendedUnderLock interruption type.
+ * platform/audio/PlatformMediaSessionManager.cpp:
+ (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground): Deleted.
+ * platform/audio/PlatformMediaSessionManager.h:
+
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Call beginInterruption
+ when appropriate.
+
+2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+
Rollout r188486. rdar://problem/22707497
2015-10-15 Matthew Hanson <matthew_han...@apple.com>
Modified: branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h 2015-10-16 06:28:51 UTC (rev 191168)
@@ -322,7 +322,7 @@
virtual void suspendPlayback() override;
virtual bool canReceiveRemoteControlCommands() const override { return false; }
virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override { }
- virtual bool overrideBackgroundPlaybackRestriction() const override { return false; }
+ bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override { return false; }
// EventTarget
virtual void refEventTarget() override { ref(); }
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-10-16 06:28:51 UTC (rev 191168)
@@ -6348,14 +6348,14 @@
void HTMLMediaElement::suspendPlayback()
{
- LOG(Media, "HTMLMediaElement::pausePlayback(%p) - paused = %s", this, boolString(paused()));
+ LOG(Media, "HTMLMediaElement::suspendPlayback(%p) - paused = %s", this, boolString(paused()));
if (!paused())
pause();
}
void HTMLMediaElement::mayResumePlayback(bool shouldResume)
{
- LOG(Media, "HTMLMediaElement::resumePlayback(%p) - paused = %s", this, boolString(paused()));
+ LOG(Media, "HTMLMediaElement::mayResumePlayback(%p) - paused = %s", this, boolString(paused()));
if (paused() && shouldResume)
play();
}
@@ -6397,8 +6397,11 @@
}
}
-bool HTMLMediaElement::overrideBackgroundPlaybackRestriction() const
+bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const
{
+ if (type != PlatformMediaSession::EnteringBackground)
+ return false;
+
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
if (m_player && m_player->isCurrentPlaybackTargetWireless())
return true;
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h 2015-10-16 06:28:51 UTC (rev 191168)
@@ -725,7 +725,7 @@
virtual double mediaSessionCurrentTime() const override { return currentTime(); }
virtual bool canReceiveRemoteControlCommands() const override { return true; }
virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override;
- virtual bool overrideBackgroundPlaybackRestriction() const override;
+ bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override;
virtual void pageMutedStateDidChange() override;
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2015-10-16 06:28:51 UTC (rev 191168)
@@ -39,17 +39,31 @@
#if !LOG_DISABLED
static const char* stateName(PlatformMediaSession::State state)
{
-#define CASE(state) case PlatformMediaSession::state: return #state
+#define STATE_CASE(state) case PlatformMediaSession::state: return #state
switch (state) {
- CASE(Idle);
- CASE(Playing);
- CASE(Paused);
- CASE(Interrupted);
+ STATE_CASE(Idle);
+ STATE_CASE(Playing);
+ STATE_CASE(Paused);
+ STATE_CASE(Interrupted);
}
ASSERT_NOT_REACHED();
return "";
}
+
+static const char* interruptionName(PlatformMediaSession::InterruptionType type)
+{
+#define INTERRUPTION_CASE(type) case PlatformMediaSession::type: return #type
+ switch (type) {
+ INTERRUPTION_CASE(SystemSleep);
+ INTERRUPTION_CASE(EnteringBackground);
+ INTERRUPTION_CASE(SystemInterruption);
+ INTERRUPTION_CASE(SuspendedUnderLock);
+ }
+
+ ASSERT_NOT_REACHED();
+ return "";
+}
#endif
std::unique_ptr<PlatformMediaSession> PlatformMediaSession::create(PlatformMediaSessionClient& client)
@@ -79,47 +93,21 @@
m_state = state;
}
-void PlatformMediaSession::doInterruption()
-{
- m_stateToRestore = state();
- m_notifyingClient = true;
- setState(Interrupted);
- client().suspendPlayback();
- m_notifyingClient = false;
-}
-
-bool PlatformMediaSession::shouldDoInterruption(InterruptionType type)
-{
- return type != EnteringBackground || !client().overrideBackgroundPlaybackRestriction();
-}
-
void PlatformMediaSession::beginInterruption(InterruptionType type)
{
- LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);
+ LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption type = %s, interruption count = %i", this, stateName(m_state), interruptionName(type), m_interruptionCount);
- if (++m_interruptionCount > 1 || !shouldDoInterruption(type))
+ if (++m_interruptionCount > 1)
return;
- doInterruption();
-}
-
-void PlatformMediaSession::forceInterruption(InterruptionType type)
-{
- LOG(Media, "PlatformMediaSession::forceInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);
-
- // beginInterruption() must have been called before calling this function.
- if (!m_interruptionCount) {
- ASSERT_NOT_REACHED();
+ if (client().shouldOverrideBackgroundPlaybackRestriction(type))
return;
- }
- // The purpose of this function is to override the decision which was made by
- // beginInterruption(). If it was decided to interrupt the media session there,
- // then nothing should be done here.
- if (shouldDoInterruption(type))
- return;
-
- doInterruption();
+ m_stateToRestore = state();
+ m_notifyingClient = true;
+ setState(Interrupted);
+ client().suspendPlayback();
+ m_notifyingClient = false;
}
void PlatformMediaSession::endInterruption(EndInterruptionFlags flags)
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2015-10-16 06:28:51 UTC (rev 191168)
@@ -74,16 +74,14 @@
SystemSleep,
EnteringBackground,
SystemInterruption,
+ SuspendedUnderLock,
};
enum EndInterruptionFlags {
NoFlags = 0,
MayResumePlaying = 1 << 0,
};
- void doInterruption();
- bool shouldDoInterruption(InterruptionType);
void beginInterruption(InterruptionType);
- void forceInterruption(InterruptionType);
void endInterruption(EndInterruptionFlags);
void applicationWillEnterForeground() const;
@@ -179,7 +177,7 @@
virtual void setShouldBufferData(bool) { }
virtual bool elementIsHidden() const { return false; }
- virtual bool overrideBackgroundPlaybackRestriction() const = 0;
+ virtual bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const = 0;
virtual void wirelessRoutesAvailableDidChange() { }
virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) { }
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2015-10-16 06:28:51 UTC (rev 191168)
@@ -289,20 +289,6 @@
}
}
-void PlatformMediaSessionManager::applicationDidEnterBackground(bool isSuspendedUnderLock) const
-{
- LOG(Media, "PlatformMediaSessionManager::applicationDidEnterBackground");
-
- if (!isSuspendedUnderLock)
- return;
-
- Vector<PlatformMediaSession*> sessions = m_sessions;
- for (auto* session : sessions) {
- if (m_restrictions[session->mediaType()] & BackgroundProcessPlaybackRestricted)
- session->forceInterruption(PlatformMediaSession::EnteringBackground);
- }
-}
-
void PlatformMediaSessionManager::applicationWillEnterForeground() const
{
LOG(Media, "PlatformMediaSessionManager::applicationWillEnterForeground");
@@ -324,8 +310,8 @@
if (!m_isApplicationInBackground || !(m_restrictions[session.mediaType()] & BackgroundProcessPlaybackRestricted))
return;
- if (session.state() != PlatformMediaSession::Interrupted && session.shouldDoInterruption(PlatformMediaSession::EnteringBackground))
- session.doInterruption();
+ if (session.state() != PlatformMediaSession::Interrupted)
+ session.beginInterruption(PlatformMediaSession::EnteringBackground);
}
#if !PLATFORM(COCOA)
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-10-16 06:28:51 UTC (rev 191168)
@@ -56,7 +56,6 @@
WEBCORE_EXPORT void applicationWillEnterForeground() const;
WEBCORE_EXPORT void applicationWillEnterBackground() const;
- WEBCORE_EXPORT void applicationDidEnterBackground(bool isSuspendedUnderLock) const;
void stopAllMediaPlaybackForDocument(const Document*);
WEBCORE_EXPORT void stopAllMediaPlaybackForProcess();
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2015-10-16 06:28:51 UTC (rev 191168)
@@ -48,6 +48,7 @@
void externalOutputDeviceAvailableDidChange();
virtual bool hasWirelessTargetsAvailable() override;
+ void applicationDidEnterBackground(bool isSuspendedUnderLock);
private:
friend class PlatformMediaSessionManager;
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-10-16 06:28:51 UTC (rev 191168)
@@ -248,6 +248,21 @@
session->externalOutputDeviceAvailableDidChange(haveTargets);
}
+void MediaSessionManageriOS::applicationDidEnterBackground(bool isSuspendedUnderLock)
+{
+ LOG(Media, "MediaSessionManageriOS::applicationDidEnterBackground");
+
+ if (!isSuspendedUnderLock)
+ return;
+
+ Vector<PlatformMediaSession*> sessions = this->sessions();
+ for (auto* session : sessions) {
+ if (restrictions(session->mediaType()) & BackgroundProcessPlaybackRestricted)
+ session->beginInterruption(PlatformMediaSession::SuspendedUnderLock);
+ }
+}
+
+
} // namespace WebCore
@implementation WebMediaSessionHelper
Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp 2015-10-16 06:28:51 UTC (rev 191168)
@@ -2614,8 +2614,21 @@
#endif
#if ENABLE(VIDEO)
-void Internals::beginMediaSessionInterruption()
+void Internals::beginMediaSessionInterruption(const String& interruptionString, ExceptionCode& ec)
{
+ PlatformMediaSession::InterruptionType interruption = PlatformMediaSession::SystemInterruption;
+
+ if (equalIgnoringCase(interruptionString, "System"))
+ interruption = PlatformMediaSession::SystemInterruption;
+ else if (equalIgnoringCase(interruptionString, "SystemSleep"))
+ interruption = PlatformMediaSession::SystemSleep;
+ else if (equalIgnoringCase(interruptionString, "EnteringBackground"))
+ interruption = PlatformMediaSession::EnteringBackground;
+ else {
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
+
PlatformMediaSessionManager::sharedManager().beginInterruption(PlatformMediaSession::SystemInterruption);
}
Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h 2015-10-16 06:28:51 UTC (rev 191168)
@@ -382,7 +382,7 @@
#endif
#if ENABLE(VIDEO)
- void beginMediaSessionInterruption();
+ void beginMediaSessionInterruption(const String&, ExceptionCode&);
void endMediaSessionInterruption(const String&);
void applicationWillEnterForeground() const;
void applicationWillEnterBackground() const;
Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl (191167 => 191168)
--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl 2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl 2015-10-16 06:28:51 UTC (rev 191168)
@@ -349,7 +349,7 @@
[Conditional=MEDIA_SOURCE] void initializeMockMediaSource();
[Conditional=MEDIA_SOURCE] DOMString[] bufferedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
- [Conditional=VIDEO] void beginMediaSessionInterruption();
+ [Conditional=VIDEO, RaisesException] void beginMediaSessionInterruption(DOMString interruptionType);
[Conditional=VIDEO] void endMediaSessionInterruption(DOMString flags);
[Conditional=VIDEO] void applicationWillEnterForeground();
[Conditional=VIDEO] void applicationWillEnterBackground();