Title: [189369] trunk/Source/WebCore
Revision
189369
Author
[email protected]
Date
2015-09-04 12:14:36 -0700 (Fri, 04 Sep 2015)

Log Message

[iOS] Enable media layout tests to run simultaneously by ignoring system-level interruptions
https://bugs.webkit.org/show_bug.cgi?id=148807

Reviewed by Eric Carlson.

Add an internal property that, when set, will cause system-level interruption notifications
(e.g., due to simultaneous media playback in separate processes) to be ignored by the
PlatformMediaSessionManager, and cause the media playback sessions to continue normally, if
inaudibly.

* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::willIgnoreSystemInterruptions):
(WebCore::PlatformMediaSessionManager::setWillIgnoreSystemInterruptions):
* platform/audio/ios/MediaSessionManagerIOS.mm:
(-[WebMediaSessionHelper interruption:]):
(-[WebMediaSessionHelper applicationWillEnterForeground:]):
(-[WebMediaSessionHelper applicationDidBecomeActive:]):
(-[WebMediaSessionHelper applicationWillResignActive:]):
(-[WebMediaSessionHelper applicationDidEnterBackground:]):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (189368 => 189369)


--- trunk/Source/WebCore/ChangeLog	2015-09-04 19:12:31 UTC (rev 189368)
+++ trunk/Source/WebCore/ChangeLog	2015-09-04 19:14:36 UTC (rev 189369)
@@ -1,3 +1,27 @@
+2015-09-04  Jer Noble  <[email protected]>
+
+        [iOS] Enable media layout tests to run simultaneously by ignoring system-level interruptions
+        https://bugs.webkit.org/show_bug.cgi?id=148807
+
+        Reviewed by Eric Carlson.
+
+        Add an internal property that, when set, will cause system-level interruption notifications
+        (e.g., due to simultaneous media playback in separate processes) to be ignored by the
+        PlatformMediaSessionManager, and cause the media playback sessions to continue normally, if
+        inaudibly.
+
+        * platform/audio/PlatformMediaSessionManager.h:
+        (WebCore::PlatformMediaSessionManager::willIgnoreSystemInterruptions):
+        (WebCore::PlatformMediaSessionManager::setWillIgnoreSystemInterruptions):
+        * platform/audio/ios/MediaSessionManagerIOS.mm:
+        (-[WebMediaSessionHelper interruption:]):
+        (-[WebMediaSessionHelper applicationWillEnterForeground:]):
+        (-[WebMediaSessionHelper applicationDidBecomeActive:]):
+        (-[WebMediaSessionHelper applicationWillResignActive:]):
+        (-[WebMediaSessionHelper applicationDidEnterBackground:]):
+        * testing/Internals.cpp:
+        (WebCore::Internals::resetToConsistentState):
+
 2015-09-04  Beth Dakin  <[email protected]>
 
         Need to be able to test default behaviors on force click

Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (189368 => 189369)


--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h	2015-09-04 19:12:31 UTC (rev 189368)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h	2015-09-04 19:14:36 UTC (rev 189369)
@@ -52,6 +52,9 @@
     int count(PlatformMediaSession::MediaType) const;
     bool activeAudioSessionRequired() const;
 
+    bool willIgnoreSystemInterruptions() const { return m_willIgnoreSystemInterruptions; }
+    void setWillIgnoreSystemInterruptions(bool ignore) { m_willIgnoreSystemInterruptions = ignore; }
+
     WEBCORE_EXPORT void beginInterruption(PlatformMediaSession::InterruptionType);
     WEBCORE_EXPORT void endInterruption(PlatformMediaSession::EndInterruptionFlags);
 
@@ -129,6 +132,7 @@
 
     bool m_interrupted { false };
     mutable bool m_isApplicationInBackground { false };
+    bool m_willIgnoreSystemInterruptions { false };
 };
 
 }

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


--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2015-09-04 19:12:31 UTC (rev 189368)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2015-09-04 19:14:36 UTC (rev 189369)
@@ -385,7 +385,7 @@
 
 - (void)interruption:(NSNotification *)notification
 {
-    if (!_callback)
+    if (!_callback || _callback->willIgnoreSystemInterruptions())
         return;
 
     NSUInteger type = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue];
@@ -412,7 +412,7 @@
 {
     UNUSED_PARAM(notification);
 
-    if (!_callback)
+    if (!_callback || _callback->willIgnoreSystemInterruptions())
         return;
 
     LOG(Media, "-[WebMediaSessionHelper applicationWillEnterForeground]");
@@ -429,7 +429,7 @@
 {
     UNUSED_PARAM(notification);
 
-    if (!_callback)
+    if (!_callback || _callback->willIgnoreSystemInterruptions())
         return;
 
     LOG(Media, "-[WebMediaSessionHelper applicationDidBecomeActive]");
@@ -446,7 +446,7 @@
 {
     UNUSED_PARAM(notification);
 
-    if (!_callback)
+    if (!_callback || _callback->willIgnoreSystemInterruptions())
         return;
 
     LOG(Media, "-[WebMediaSessionHelper applicationWillResignActive]");
@@ -478,7 +478,7 @@
 
 - (void)applicationDidEnterBackground:(NSNotification *)notification
 {
-    if (!_callback)
+    if (!_callback || _callback->willIgnoreSystemInterruptions())
         return;
 
     LOG(Media, "-[WebMediaSessionHelper applicationDidEnterBackground]");

Modified: trunk/Source/WebCore/testing/Internals.cpp (189368 => 189369)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-09-04 19:12:31 UTC (rev 189368)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-09-04 19:14:36 UTC (rev 189369)
@@ -333,6 +333,7 @@
     ApplicationCacheStorage::singleton().setDefaultOriginQuota(ApplicationCacheStorage::noQuota());
 #if ENABLE(VIDEO)
     PlatformMediaSessionManager::sharedManager().resetRestrictions();
+    PlatformMediaSessionManager::sharedManager().setWillIgnoreSystemInterruptions(true);
 #endif
 #if HAVE(ACCESSIBILITY)
     AXObjectCache::setEnhancedUserInterfaceAccessibility(false);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to