Title: [268791] trunk
Revision
268791
Author
[email protected]
Date
2020-10-21 04:32:10 -0700 (Wed, 21 Oct 2020)

Log Message

[iOS] Disable audio capture in the background for non Safari applications
https://bugs.webkit.org/show_bug.cgi?id=217948
<rdar://problem/70241557>

Reviewed by Eric Carlson.

Source/WebCore:

We do not have good OS support when capturing audio in a WebProcess for a backgrounded application.
Until we have proper support, it seems best to mute audio capture when being backgrounded.
Manually tested.

* platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm:
(WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):

LayoutTests:

* platform/ios/mediastream/video-muted-in-background-tab.html:
By default, audio capture will be muted in WTR if page goes to background.
Update the test to explicitly request for audio capture to continue while in background.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268790 => 268791)


--- trunk/LayoutTests/ChangeLog	2020-10-21 10:50:48 UTC (rev 268790)
+++ trunk/LayoutTests/ChangeLog	2020-10-21 11:32:10 UTC (rev 268791)
@@ -1,3 +1,15 @@
+2020-10-21  Youenn Fablet  <[email protected]>
+
+        [iOS] Disable audio capture in the background for non Safari applications
+        https://bugs.webkit.org/show_bug.cgi?id=217948
+        <rdar://problem/70241557>
+
+        Reviewed by Eric Carlson.
+
+        * platform/ios/mediastream/video-muted-in-background-tab.html:
+        By default, audio capture will be muted in WTR if page goes to background.
+        Update the test to explicitly request for audio capture to continue while in background.
+
 2020-10-21  Diego Pino Garcia  <[email protected]>
 
         [GLIB][GTK] Unreviewed test gardening. Update test expectations.

Modified: trunk/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html (268790 => 268791)


--- trunk/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html	2020-10-21 10:50:48 UTC (rev 268790)
+++ trunk/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html	2020-10-21 11:32:10 UTC (rev 268791)
@@ -42,8 +42,10 @@
             }, "Setup stream");
 
             promise_test(async (t) => {
-                if (window.internals)
+                if (window.internals) {
+                    window.internals.setShouldInterruptAudioOnPageVisibilityChange(false);
                     window.internals.setPageVisibility(false);
+                }
                 assert_false(audioTrack.muted, "audio track is active");
                 assert_true(videoTrack.muted, "video track is muted");
             }, "Hide page, only video should be muted");

Modified: trunk/Source/WebCore/ChangeLog (268790 => 268791)


--- trunk/Source/WebCore/ChangeLog	2020-10-21 10:50:48 UTC (rev 268790)
+++ trunk/Source/WebCore/ChangeLog	2020-10-21 11:32:10 UTC (rev 268791)
@@ -1,3 +1,18 @@
+2020-10-21  Youenn Fablet  <[email protected]>
+
+        [iOS] Disable audio capture in the background for non Safari applications
+        https://bugs.webkit.org/show_bug.cgi?id=217948
+        <rdar://problem/70241557>
+
+        Reviewed by Eric Carlson.
+
+        We do not have good OS support when capturing audio in a WebProcess for a backgrounded application.
+        Until we have proper support, it seems best to mute audio capture when being backgrounded.
+        Manually tested.
+
+        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm:
+        (WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):
+
 2020-10-21  Philippe Normand  <[email protected]>
 
         [GStreamer] Create video sink only for video player

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm (268790 => 268791)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm	2020-10-21 10:50:48 UTC (rev 268790)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm	2020-10-21 11:32:10 UTC (rev 268791)
@@ -28,11 +28,16 @@
 
 #if ENABLE(MEDIA_STREAM)
 
+#include "RuntimeApplicationChecks.h"
+
 namespace WebCore {
 
 bool RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange()
 {
 #if PLATFORM(IOS)
+    if (!WebCore::IOSApplication::isMobileSafari() && !WebCore::IOSApplication::isSafariViewService())
+        return true;
+
     NSArray *modes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
     if (!modes)
         return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to