[Mac] do not deactivate an audio session that has running I/O
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 May 2014 20:52:17 +0000 (20:52 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 May 2014 20:52:17 +0000 (20:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133127

Reviewed by Jer Noble.

Source/WebCore:
* page/Settings.h:
(WebCore::Settings::setShouldManageAudioSessionCategory): Renamed from setShouldManageAudioSession.
(WebCore::Settings::shouldManageAudioSessionCategory): Renamed from shouldManageAudioSession.
(WebCore::Settings::setShouldManageAudioSession): Deleted.
(WebCore::Settings::shouldManageAudioSession): Deleted.

* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): Don't deactivate the session if there are any
    Video or Audio sessions.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus): Drive-by change to log errors
    returned by -statusOfValueForKey:error: in debug builds.

Source/WebKit/mac:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]): Settings::setShouldManageAudioSession
    renamed to setShouldManageAudioSessionCategory, deal with it.

Source/WebKit2:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Settings::setShouldManageAudioSession renamed to
    setShouldManageAudioSessionCategory, deal with it.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169130 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/Settings.h
Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index fcaacc1..6076083 100644 (file)
@@ -1,3 +1,24 @@
+2014-05-20  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] do not deactivate an audio session that has running I/O
+        https://bugs.webkit.org/show_bug.cgi?id=133127
+
+        Reviewed by Jer Noble.
+
+        * page/Settings.h:
+        (WebCore::Settings::setShouldManageAudioSessionCategory): Renamed from setShouldManageAudioSession.
+        (WebCore::Settings::shouldManageAudioSessionCategory): Renamed from shouldManageAudioSession.
+        (WebCore::Settings::setShouldManageAudioSession): Deleted.
+        (WebCore::Settings::shouldManageAudioSession): Deleted.
+
+        * platform/audio/mac/MediaSessionManagerMac.cpp:
+        (MediaSessionManager::updateSessionState): Don't deactivate the session if there are any
+            Video or Audio sessions.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus): Drive-by change to log errors 
+            returned by -statusOfValueForKey:error: in debug builds.
+
 2014-05-20  Beth Dakin  <bdakin@apple.com>
 
         REGRESSION: All non-mainframe scrollbars don't paint after r169065
index 5d82d25..2e0d6ef 100644 (file)
@@ -263,8 +263,8 @@ public:
     static void setShouldOptOutOfNetworkStateObservation(bool flag) { gShouldOptOutOfNetworkStateObservation = flag; }
     static bool shouldOptOutOfNetworkStateObservation() { return gShouldOptOutOfNetworkStateObservation; }
 
-    static void setShouldManageAudioSession(bool flag) { gManageAudioSession = flag; }
-    static bool shouldManageAudioSession() { return gManageAudioSession; }
+    static void setShouldManageAudioSessionCategory(bool flag) { gManageAudioSession = flag; }
+    static bool shouldManageAudioSessionCategory() { return gManageAudioSession; }
 #endif
 
 private:
index 5d9ee8f..323847f 100644 (file)
@@ -55,12 +55,12 @@ void MediaSessionManager::updateSessionState()
 #endif
 
 #if PLATFORM(IOS)
-    if (has(MediaSession::WebAudio))
+    if (has(MediaSession::WebAudio) || has(MediaSession::Video) || has(MediaSession::Audio))
         AudioSession::sharedSession().setActive(true);
     else
         AudioSession::sharedSession().setActive(false);
 
-    if (!Settings::shouldManageAudioSession())
+    if (!Settings::shouldManageAudioSessionCategory())
         return;
 
     if (has(MediaSession::Video) || has(MediaSession::Audio))
index 96acc3c..2d34fdc 100644 (file)
@@ -1189,7 +1189,12 @@ MediaPlayerPrivateAVFoundation::AssetStatus MediaPlayerPrivateAVFoundationObjC::
         return MediaPlayerAVAssetStatusDoesNotExist;
 
     for (NSString *keyName in assetMetadataKeyNames()) {
-        AVKeyValueStatus keyStatus = [m_avAsset.get() statusOfValueForKey:keyName error:nil];
+        NSError *error = nil;
+        AVKeyValueStatus keyStatus = [m_avAsset.get() statusOfValueForKey:keyName error:&error];
+#if !LOG_DISABLED
+        if (error)
+            LOG(Media, "MediaPlayerPrivateAVFoundation::assetStatus - statusOfValueForKey failed for %s, error = %s", [keyName UTF8String], [[error localizedDescription] UTF8String]);
+#endif
 
         if (keyStatus < AVKeyValueStatusLoaded)
             return MediaPlayerAVAssetStatusLoading;// At least one key is not loaded yet.
index 1b8c7ca..e565176 100644 (file)
@@ -1,3 +1,14 @@
+2014-05-20  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] do not deactivate an audio session that has running I/O
+        https://bugs.webkit.org/show_bug.cgi?id=133127
+
+        Reviewed by Jer Noble.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]): Settings::setShouldManageAudioSession
+            renamed to setShouldManageAudioSessionCategory, deal with it.
+
 2014-05-19  Brady Eidson  <beidson@apple.com>
 
         Use different AppKit API for image control menus.
index 0bb29c4..9d8aab0 100644 (file)
@@ -903,7 +903,7 @@ static bool shouldUseLegacyBackgroundSizeShorthandBehavior()
 
 #if PLATFORM(IOS)
         if (applicationIsMobileSafari())
-            Settings::setShouldManageAudioSession(true);
+            Settings::setShouldManageAudioSessionCategory(true);
 #endif
 
         didOneTimeInitialization = true;
index 190c936..cfdec81 100644 (file)
@@ -1,3 +1,14 @@
+2014-05-20  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] do not deactivate an audio session that has running I/O
+        https://bugs.webkit.org/show_bug.cgi?id=133127
+
+        Reviewed by Jer Noble.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Settings::setShouldManageAudioSession renamed to 
+            setShouldManageAudioSessionCategory, deal with it.
+
 2014-05-19  Simon Fraser  <simon.fraser@apple.com>
 
         REGRESSION (r169063) Fixed and sticky nodes misplaced on scrolling sometimes
index f00006c..3e7450e 100644 (file)
@@ -320,7 +320,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     Settings::setDefaultMinDOMTimerInterval(0.004);
 
 #if PLATFORM(IOS)
-    Settings::setShouldManageAudioSession(true);
+    Settings::setShouldManageAudioSessionCategory(true);
 #endif
 
     Page::PageClients pageClients;