WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-231105-20211020100751.patch (text/plain), 6.44 KB, created by
youenn fablet
on 2021-10-20 01:07:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2021-10-20 01:07:53 PDT
Size:
6.44 KB
patch
obsolete
>Subversion Revision: 284520 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 20e7a645d888989399716eed596fc1eb0edfbbbd..70567c4cbb12365252561709c099d89384678c3d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2021-10-20 Youenn Fablet <youenn@apple.com> >+ >+ AudioContext stops playing when minimizing or moving the macOS Safari window to the background. >+ https://bugs.webkit.org/show_bug.cgi?id=231105 >+ <rdar://problem/83889697> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ In case page is capturing audio, it is useful to not suspend an audio context, which can be used for various things such as: >+ - preprocessing before rendering/transmitting audio data. >+ - various audio feedback in case of VC (new participant...). >+ Test: webaudio/audiocontext-state-interruption-with-gum.html >+ >+ * Modules/webaudio/AudioContext.cpp: >+ * Modules/webaudio/AudioContext.h: >+ > 2021-10-19 Antoine Quint <graouts@webkit.org> > > Support more CSS properties for ::marker >diff --git a/Source/WebCore/Modules/webaudio/AudioContext.cpp b/Source/WebCore/Modules/webaudio/AudioContext.cpp >index ad728c36952b30d0574e718f89d34cda8632df13..e242827af5964014aca4f2e24be7fb9dad3b39b2 100644 >--- a/Source/WebCore/Modules/webaudio/AudioContext.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioContext.cpp >@@ -480,6 +480,21 @@ MediaSessionGroupIdentifier AudioContext::mediaSessionGroupIdentifier() const > return document && document->page() ? document->page()->mediaSessionGroupIdentifier() : MediaSessionGroupIdentifier { }; > } > >+bool AudioContext::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const >+{ >+ if (type != PlatformMediaSession::EnteringBackground) >+ return false; >+ >+#if ENABLE(MEDIA_STREAM) >+ if (document() && document()->mediaState().containsAny(MediaProducerMediaState::HasActiveAudioCaptureDevice)) { >+ INFO_LOG(LOGIDENTIFIER, "returning true because document is capturing audio"); >+ return true; >+ } >+#endif >+ >+ return false; >+} >+ > bool AudioContext::isSuspended() const > { > return !document() || document()->activeDOMObjectsAreSuspended() || document()->activeDOMObjectsAreStopped(); >diff --git a/Source/WebCore/Modules/webaudio/AudioContext.h b/Source/WebCore/Modules/webaudio/AudioContext.h >index 12b654125e1f399b1b0e26cf84e5899fb886d7b8..939d028d260792a7dbd679033991dc0075a729d9 100644 >--- a/Source/WebCore/Modules/webaudio/AudioContext.h >+++ b/Source/WebCore/Modules/webaudio/AudioContext.h >@@ -127,7 +127,7 @@ private: > bool canReceiveRemoteControlCommands() const final { return false; } > void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument&) final { } > bool supportsSeeking() const final { return false; } >- bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const final { return false; } >+ bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const final; > bool canProduceAudio() const final { return true; } > bool isSuspended() const final; > bool isPlaying() const final; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1bf320ab0365f43de309cc72394a7b36a944ca55..54a217dca4a146bd6cf10496d03a420973459278 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-10-20 Youenn Fablet <youenn@apple.com> >+ >+ AudioContext stops playing when minimizing or moving the macOS Safari window to the background. >+ https://bugs.webkit.org/show_bug.cgi?id=231105 >+ <rdar://problem/83889697> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/mediastream/audiocontext-state-interruption-with-gum-expected.txt: Added. >+ * fast/mediastream/audiocontext-state-interruption-with-gum.html: Added. >+ > 2021-10-19 Ben Nham <nham@apple.com> > > Add NetworkProcess stubs for push subscriptions >diff --git a/LayoutTests/fast/mediastream/audiocontext-state-interruption-with-gum-expected.txt b/LayoutTests/fast/mediastream/audiocontext-state-interruption-with-gum-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1adb98360e05ec1a042c1a666115584d4ffbb85a >--- /dev/null >+++ b/LayoutTests/fast/mediastream/audiocontext-state-interruption-with-gum-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Do not interrupt if audio capture is ongoing >+ >diff --git a/LayoutTests/fast/mediastream/audiocontext-state-interruption-with-gum.html b/LayoutTests/fast/mediastream/audiocontext-state-interruption-with-gum.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d5c07822f3c826be576fa49c96232725f654fecf >--- /dev/null >+++ b/LayoutTests/fast/mediastream/audiocontext-state-interruption-with-gum.html >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../resources/testharness.js"></script> >+<script src="../../resources/testharnessreport.js"></script> >+<script type="text/javascript" src="resources/audio-testing.js"></script> >+</head> >+<body> >+<script> >+promise_test(async (t) => { >+ if (!window.internals) >+ return; >+ >+ const context = new AudioContext(); >+ >+ let promise = new Promise(resolve => context.onstatechange = resolve); >+ >+ const node = context.createBufferSource(); >+ node.connect(context.destination); >+ >+ await promise; >+ >+ promise = new Promise(resolve => context.onstatechange = resolve); >+ internals.beginMediaSessionInterruption("enteringbackground"); >+ await promise; >+ assert_equals(context.state, "interrupted"); >+ >+ promise = new Promise(resolve => context.onstatechange = resolve); >+ internals.endMediaSessionInterruption("mayresumeplaying"); >+ await promise; >+ assert_equals(context.state, "running"); >+ >+ if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) >+ return; >+ >+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); >+ >+ internals.beginMediaSessionInterruption("enteringbackground"); >+ await new Promise(resolve => setTimeout(resolve, 50)); >+ assert_equals(context.state, "running"); >+ >+ internals.endMediaSessionInterruption("mayresumeplaying"); >+ >+ promise = new Promise(resolve => context.onstatechange = resolve); >+ internals.beginMediaSessionInterruption("system"); >+ await promise; >+ assert_equals(context.state, "interrupted"); >+}, "Do not interrupt if audio capture is ongoing"); >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 231105
:
441596
|
441856
|
446715
|
447455
|
454484