Refine AudioSession route sharing policy
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2019 20:32:55 +0000 (20:32 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2019 20:32:55 +0000 (20:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197742
<rdar://problem/50590818>

Reviewed by Darin Adler.

Source/WebCore:

No new tests, updated AVAudioSessionRouteSharingPolicy API test.

* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(MediaSessionManagerCocoa::updateSessionState):

Tools:

* TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm:
(TestWebKitAPI::TEST):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm

index 3d6de64..92d9cea 100644 (file)
@@ -1,3 +1,16 @@
+2019-05-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Refine AudioSession route sharing policy
+        https://bugs.webkit.org/show_bug.cgi?id=197742
+        <rdar://problem/50590818>
+
+        Reviewed by Darin Adler.
+
+        No new tests, updated AVAudioSessionRouteSharingPolicy API test.
+
+        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+        (MediaSessionManagerCocoa::updateSessionState):
+
 2019-05-09  Simon Fraser  <simon.fraser@apple.com>
 
         fast/hidpi/video-controls-in-hidpi.html sometimes asserts in WK1
index 04d42c1..374d4cb 100644 (file)
@@ -111,10 +111,7 @@ void MediaSessionManagerCocoa::updateSessionState()
         category = AudioSession::PlayAndRecord;
     else if (hasAudibleAudioOrVideoMediaType) {
         category = AudioSession::MediaPlayback;
-        if (videoCount || videoAudioCount)
-            policy = RouteSharingPolicy::LongFormVideo;
-        else
-            policy = RouteSharingPolicy::LongFormAudio;
+        policy = RouteSharingPolicy::LongFormAudio;
     } else if (webAudioCount)
         category = AudioSession::AmbientSound;
 
index 8bfc800..0e842f1 100644 (file)
@@ -1,3 +1,14 @@
+2019-05-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Refine AudioSession route sharing policy
+        https://bugs.webkit.org/show_bug.cgi?id=197742
+        <rdar://problem/50590818>
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm:
+        (TestWebKitAPI::TEST):
+
 2019-05-09  Alex Christensen  <achristensen@webkit.org>
 
         Remove unnecessary test SPI after r244883
index 7ce46ea..d8cb83a 100644 (file)
@@ -71,15 +71,6 @@ static void waitUntilAudioSessionCategoryIsEqualTo(NSString *expectedValue)
     } while (++tries <= 100);
 }
 
-static AVAudioSessionRouteSharingPolicy routeSharingPolicyLongFormVideo()
-{
-#if HAVE(ROUTE_SHARING_POLICY_LONG_FORM_VIDEO)
-    return AVAudioSessionRouteSharingPolicyLongFormVideo;
-#else
-    return AVAudioSessionRouteSharingPolicyLongForm;
-#endif
-}
-
 static AVAudioSessionRouteSharingPolicy routeSharingPolicyLongFormAudio()
 {
 #if HAVE(ROUTE_SHARING_POLICY_LONG_FORM_VIDEO)
@@ -110,7 +101,10 @@ TEST(WebKitLegacy, AudioSessionCategoryIOS)
 
     waitUntilAudioSessionCategoryIsEqualTo(getAVAudioSessionCategoryPlayback());
     EXPECT_WK_STREQ(getAVAudioSessionCategoryPlayback(), [[getAVAudioSessionClass() sharedInstance] category]);
-    EXPECT_EQ([[getAVAudioSessionClass() sharedInstance] routeSharingPolicy], routeSharingPolicyLongFormVideo());
+    EXPECT_EQ([[getAVAudioSessionClass() sharedInstance] routeSharingPolicy], routeSharingPolicyLongFormAudio());
+#if HAVE(ROUTE_SHARING_POLICY_LONG_FORM_VIDEO)
+    EXPECT_NE([[getAVAudioSessionClass() sharedInstance] routeSharingPolicy], AVAudioSessionRouteSharingPolicyLongFormVideo);
+#endif
 
     didBeginPlaying = false;
 
@@ -150,7 +144,10 @@ TEST(WebKitLegacy, AudioSessionCategoryIOS)
 
     waitUntilAudioSessionCategoryIsEqualTo(getAVAudioSessionCategoryPlayback());
     EXPECT_WK_STREQ(getAVAudioSessionCategoryPlayback(), [[getAVAudioSessionClass() sharedInstance] category]);
-    EXPECT_EQ([[getAVAudioSessionClass() sharedInstance] routeSharingPolicy], routeSharingPolicyLongFormVideo());
+    EXPECT_EQ([[getAVAudioSessionClass() sharedInstance] routeSharingPolicy], routeSharingPolicyLongFormAudio());
+#if HAVE(ROUTE_SHARING_POLICY_LONG_FORM_VIDEO)
+    EXPECT_NE([[getAVAudioSessionClass() sharedInstance] routeSharingPolicy], AVAudioSessionRouteSharingPolicyLongFormVideo);
+#endif
 
     didBeginPlaying = false;