Changeset 191168 in webkit
- Timestamp:
- Oct 15, 2015 11:28:51 PM (9 years ago)
- Location:
- branches/safari-601.1.46-branch
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-601.1.46-branch/LayoutTests/ChangeLog
r191099 r191168 1 2015-10-15 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r190434. rdar://problem/22865007 4 5 2015-10-01 Eric Carlson <eric.carlson@apple.com> 6 7 [iOS] AirPlay should not stop when the screen locks 8 https://bugs.webkit.org/show_bug.cgi?id=148315 9 <rdar://problem/22770703> 10 11 Reviewed by Jer Noble. 12 13 * media/video-interruption-with-resume-allowing-play.html: 14 * media/video-interruption-with-resume-not-allowing-play.html: 15 1 16 2015-10-15 Matthew Hanson <matthew_hanson@apple.com> 2 17 -
branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt
r190815 r191168 7 7 EVENT(playing) 8 8 EXPECTED (video.paused == 'false') OK 9 RUN(internals.beginMediaSessionInterruption( ))9 RUN(internals.beginMediaSessionInterruption('System')) 10 10 11 11 100ms timer fired... … … 17 17 18 18 EXPECTED (video.paused == 'false') OK 19 RUN(internals.beginMediaSessionInterruption( ))19 RUN(internals.beginMediaSessionInterruption('System')) 20 20 21 21 100ms timer fired... -
branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html
r190815 r191168 13 13 testExpected("video.paused", false); 14 14 state = "interrupted"; 15 run("internals.beginMediaSessionInterruption( )");;15 run("internals.beginMediaSessionInterruption('System')");; 16 16 setTimeout(checkState, 100); 17 17 consoleWrite(""); -
branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt
r190815 r191168 6 6 7 7 EVENT(playing) 8 RUN(internals.beginMediaSessionInterruption( ))8 RUN(internals.beginMediaSessionInterruption('System')) 9 9 10 10 100ms timer fired... -
branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html
r190815 r191168 8 8 function playing() 9 9 { 10 run("internals.beginMediaSessionInterruption( )");;10 run("internals.beginMediaSessionInterruption('System')");; 11 11 setTimeout(checkState, 100); 12 12 } -
branches/safari-601.1.46-branch/Source/WebCore/ChangeLog
r191154 r191168 1 2015-10-15 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r190434. rdar://problem/22865007 4 5 2015-10-01 Eric Carlson <eric.carlson@apple.com> 6 7 [iOS] AirPlay should not stop when the screen locks 8 https://bugs.webkit.org/show_bug.cgi?id=148315 9 <rdar://problem/22770703> 10 11 Reviewed by Jer Noble. 12 13 Tested by media/video-interruption-with-resume-allowing-play.html 14 media/video-interruption-with-resume-not-allowing-play.html 15 16 * Modules/webaudio/AudioContext.h: overrideBackgroundPlaybackRestriction -> 17 shouldOverrideBackgroundPlaybackRestriction. 18 19 * html/HTMLMediaElement.cpp: 20 (WebCore::HTMLMediaElement::suspendPlayback): Fix a typo in the logging. 21 (WebCore::HTMLMediaElement::mayResumePlayback): Ditto. 22 (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction): Renamed from 23 overrideBackgroundPlaybackRestriction. 24 (WebCore::HTMLMediaElement::overrideBackgroundPlaybackRestriction): Deleted. 25 * html/HTMLMediaElement.h: 26 27 * platform/audio/PlatformMediaSession.cpp: 28 (WebCore::stateName): 29 (WebCore::interruptionName): New, log the name of the interruption. 30 (WebCore::PlatformMediaSession::beginInterruption): Log the interruption type. Don't 31 increment the interruption counter if we are going to ignore it. Incorporate logic 32 from doInterruption. 33 (WebCore::PlatformMediaSession::doInterruption): Deleted. 34 (WebCore::PlatformMediaSession::shouldDoInterruption): Deleted. 35 (WebCore::PlatformMediaSession::forceInterruption): Deleted. 36 37 * platform/audio/PlatformMediaSession.h: Add SuspendedUnderLock interruption type. 38 * platform/audio/PlatformMediaSessionManager.cpp: 39 (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground): Deleted. 40 * platform/audio/PlatformMediaSessionManager.h: 41 42 * platform/audio/ios/MediaSessionManagerIOS.h: 43 * platform/audio/ios/MediaSessionManagerIOS.mm: 44 (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Call beginInterruption 45 when appropriate. 46 1 47 2015-10-15 Matthew Hanson <matthew_hanson@apple.com> 2 48 -
branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h
r190815 r191168 323 323 virtual bool canReceiveRemoteControlCommands() const override { return false; } 324 324 virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override { } 325 virtual bool overrideBackgroundPlaybackRestriction() const override { return false; }325 bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override { return false; } 326 326 327 327 // EventTarget -
branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp
r191088 r191168 6349 6349 void HTMLMediaElement::suspendPlayback() 6350 6350 { 6351 LOG(Media, "HTMLMediaElement:: pausePlayback(%p) - paused = %s", this, boolString(paused()));6351 LOG(Media, "HTMLMediaElement::suspendPlayback(%p) - paused = %s", this, boolString(paused())); 6352 6352 if (!paused()) 6353 6353 pause(); … … 6356 6356 void HTMLMediaElement::mayResumePlayback(bool shouldResume) 6357 6357 { 6358 LOG(Media, "HTMLMediaElement:: resumePlayback(%p) - paused = %s", this, boolString(paused()));6358 LOG(Media, "HTMLMediaElement::mayResumePlayback(%p) - paused = %s", this, boolString(paused())); 6359 6359 if (paused() && shouldResume) 6360 6360 play(); … … 6398 6398 } 6399 6399 6400 bool HTMLMediaElement::overrideBackgroundPlaybackRestriction() const 6401 { 6400 bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const 6401 { 6402 if (type != PlatformMediaSession::EnteringBackground) 6403 return false; 6404 6402 6405 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 6403 6406 if (m_player && m_player->isCurrentPlaybackTargetWireless()) -
branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h
r191087 r191168 726 726 virtual bool canReceiveRemoteControlCommands() const override { return true; } 727 727 virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override; 728 virtual bool overrideBackgroundPlaybackRestriction() const override;728 bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override; 729 729 730 730 virtual void pageMutedStateDidChange() override; -
branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp
r190815 r191168 40 40 static const char* stateName(PlatformMediaSession::State state) 41 41 { 42 #define CASE(state) case PlatformMediaSession::state: return #state42 #define STATE_CASE(state) case PlatformMediaSession::state: return #state 43 43 switch (state) { 44 CASE(Idle); 45 CASE(Playing); 46 CASE(Paused); 47 CASE(Interrupted); 48 } 49 44 STATE_CASE(Idle); 45 STATE_CASE(Playing); 46 STATE_CASE(Paused); 47 STATE_CASE(Interrupted); 48 } 49 50 ASSERT_NOT_REACHED(); 51 return ""; 52 } 53 54 static const char* interruptionName(PlatformMediaSession::InterruptionType type) 55 { 56 #define INTERRUPTION_CASE(type) case PlatformMediaSession::type: return #type 57 switch (type) { 58 INTERRUPTION_CASE(SystemSleep); 59 INTERRUPTION_CASE(EnteringBackground); 60 INTERRUPTION_CASE(SystemInterruption); 61 INTERRUPTION_CASE(SuspendedUnderLock); 62 } 63 50 64 ASSERT_NOT_REACHED(); 51 65 return ""; … … 80 94 } 81 95 82 void PlatformMediaSession::doInterruption() 83 { 96 void PlatformMediaSession::beginInterruption(InterruptionType type) 97 { 98 LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption type = %s, interruption count = %i", this, stateName(m_state), interruptionName(type), m_interruptionCount); 99 100 if (++m_interruptionCount > 1) 101 return; 102 103 if (client().shouldOverrideBackgroundPlaybackRestriction(type)) 104 return; 105 84 106 m_stateToRestore = state(); 85 107 m_notifyingClient = true; … … 87 109 client().suspendPlayback(); 88 110 m_notifyingClient = false; 89 }90 91 bool PlatformMediaSession::shouldDoInterruption(InterruptionType type)92 {93 return type != EnteringBackground || !client().overrideBackgroundPlaybackRestriction();94 }95 96 void PlatformMediaSession::beginInterruption(InterruptionType type)97 {98 LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);99 100 if (++m_interruptionCount > 1 || !shouldDoInterruption(type))101 return;102 103 doInterruption();104 }105 106 void PlatformMediaSession::forceInterruption(InterruptionType type)107 {108 LOG(Media, "PlatformMediaSession::forceInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);109 110 // beginInterruption() must have been called before calling this function.111 if (!m_interruptionCount) {112 ASSERT_NOT_REACHED();113 return;114 }115 116 // The purpose of this function is to override the decision which was made by117 // beginInterruption(). If it was decided to interrupt the media session there,118 // then nothing should be done here.119 if (shouldDoInterruption(type))120 return;121 122 doInterruption();123 111 } 124 112 -
branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h
r190815 r191168 75 75 EnteringBackground, 76 76 SystemInterruption, 77 SuspendedUnderLock, 77 78 }; 78 79 enum EndInterruptionFlags { … … 81 82 }; 82 83 83 void doInterruption();84 bool shouldDoInterruption(InterruptionType);85 84 void beginInterruption(InterruptionType); 86 void forceInterruption(InterruptionType);87 85 void endInterruption(EndInterruptionFlags); 88 86 … … 180 178 virtual bool elementIsHidden() const { return false; } 181 179 182 virtual bool overrideBackgroundPlaybackRestriction() const = 0;180 virtual bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const = 0; 183 181 184 182 virtual void wirelessRoutesAvailableDidChange() { } -
branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
r190815 r191168 290 290 } 291 291 292 void PlatformMediaSessionManager::applicationDidEnterBackground(bool isSuspendedUnderLock) const293 {294 LOG(Media, "PlatformMediaSessionManager::applicationDidEnterBackground");295 296 if (!isSuspendedUnderLock)297 return;298 299 Vector<PlatformMediaSession*> sessions = m_sessions;300 for (auto* session : sessions) {301 if (m_restrictions[session->mediaType()] & BackgroundProcessPlaybackRestricted)302 session->forceInterruption(PlatformMediaSession::EnteringBackground);303 }304 }305 306 292 void PlatformMediaSessionManager::applicationWillEnterForeground() const 307 293 { … … 325 311 return; 326 312 327 if (session.state() != PlatformMediaSession::Interrupted && session.shouldDoInterruption(PlatformMediaSession::EnteringBackground))328 session. doInterruption();313 if (session.state() != PlatformMediaSession::Interrupted) 314 session.beginInterruption(PlatformMediaSession::EnteringBackground); 329 315 } 330 316 -
branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h
r190815 r191168 57 57 WEBCORE_EXPORT void applicationWillEnterForeground() const; 58 58 WEBCORE_EXPORT void applicationWillEnterBackground() const; 59 WEBCORE_EXPORT void applicationDidEnterBackground(bool isSuspendedUnderLock) const;60 59 61 60 void stopAllMediaPlaybackForDocument(const Document*); -
branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
r190815 r191168 49 49 void externalOutputDeviceAvailableDidChange(); 50 50 virtual bool hasWirelessTargetsAvailable() override; 51 void applicationDidEnterBackground(bool isSuspendedUnderLock); 51 52 52 53 private: -
branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r190815 r191168 249 249 } 250 250 251 void MediaSessionManageriOS::applicationDidEnterBackground(bool isSuspendedUnderLock) 252 { 253 LOG(Media, "MediaSessionManageriOS::applicationDidEnterBackground"); 254 255 if (!isSuspendedUnderLock) 256 return; 257 258 Vector<PlatformMediaSession*> sessions = this->sessions(); 259 for (auto* session : sessions) { 260 if (restrictions(session->mediaType()) & BackgroundProcessPlaybackRestricted) 261 session->beginInterruption(PlatformMediaSession::SuspendedUnderLock); 262 } 263 } 264 265 251 266 } // namespace WebCore 252 267 -
branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp
r190815 r191168 2615 2615 2616 2616 #if ENABLE(VIDEO) 2617 void Internals::beginMediaSessionInterruption() 2618 { 2617 void Internals::beginMediaSessionInterruption(const String& interruptionString, ExceptionCode& ec) 2618 { 2619 PlatformMediaSession::InterruptionType interruption = PlatformMediaSession::SystemInterruption; 2620 2621 if (equalIgnoringCase(interruptionString, "System")) 2622 interruption = PlatformMediaSession::SystemInterruption; 2623 else if (equalIgnoringCase(interruptionString, "SystemSleep")) 2624 interruption = PlatformMediaSession::SystemSleep; 2625 else if (equalIgnoringCase(interruptionString, "EnteringBackground")) 2626 interruption = PlatformMediaSession::EnteringBackground; 2627 else { 2628 ec = INVALID_ACCESS_ERR; 2629 return; 2630 } 2631 2619 2632 PlatformMediaSessionManager::sharedManager().beginInterruption(PlatformMediaSession::SystemInterruption); 2620 2633 } -
branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h
r190815 r191168 383 383 384 384 #if ENABLE(VIDEO) 385 void beginMediaSessionInterruption( );385 void beginMediaSessionInterruption(const String&, ExceptionCode&); 386 386 void endMediaSessionInterruption(const String&); 387 387 void applicationWillEnterForeground() const; -
branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl
r190815 r191168 350 350 [Conditional=MEDIA_SOURCE] DOMString[] bufferedSamplesForTrackID(SourceBuffer buffer, DOMString trackID); 351 351 352 [Conditional=VIDEO ] void beginMediaSessionInterruption();352 [Conditional=VIDEO, RaisesException] void beginMediaSessionInterruption(DOMString interruptionType); 353 353 [Conditional=VIDEO] void endMediaSessionInterruption(DOMString flags); 354 354 [Conditional=VIDEO] void applicationWillEnterForeground();
Note: See TracChangeset
for help on using the changeset viewer.