- Revision
- 229589
- Author
- [email protected]
- Date
- 2018-03-13 15:54:20 -0700 (Tue, 13 Mar 2018)
Log Message
[iOS] Muted media playback can interrupt out-of-process audio
https://bugs.webkit.org/show_bug.cgi?id=183606
<rdar://problem/37466253>
Reviewed by Eric Carlson.
Source/WebCore:
Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set.
A non-playing, non-muted media element will cause the AVAudioSession category to be set to
"playing" when a muted media element begins playback. Ignore these non-playing elements for
the purposes of determining the AVAudioSession category.
* platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
(PlatformMediaSessionManager::updateSessionState):
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-paused-audio-and-playing-muted.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (229588 => 229589)
--- trunk/Source/WebCore/ChangeLog 2018-03-13 21:42:08 UTC (rev 229588)
+++ trunk/Source/WebCore/ChangeLog 2018-03-13 22:54:20 UTC (rev 229589)
@@ -1,3 +1,20 @@
+2018-03-13 Jer Noble <[email protected]>
+
+ [iOS] Muted media playback can interrupt out-of-process audio
+ https://bugs.webkit.org/show_bug.cgi?id=183606
+ <rdar://problem/37466253>
+
+ Reviewed by Eric Carlson.
+
+ Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set.
+
+ A non-playing, non-muted media element will cause the AVAudioSession category to be set to
+ "playing" when a muted media element begins playback. Ignore these non-playing elements for
+ the purposes of determining the AVAudioSession category.
+
+ * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
+ (PlatformMediaSessionManager::updateSessionState):
+
2018-03-13 Youenn Fablet <[email protected]>
Calling removeTrack with RTCRtpSender does not set SenderTrack to null
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp (229588 => 229589)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp 2018-03-13 21:42:08 UTC (rev 229588)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp 2018-03-13 22:54:20 UTC (rev 229589)
@@ -70,7 +70,7 @@
auto type = session.mediaType();
if (type == PlatformMediaSession::WebAudio)
hasWebAudioType = true;
- if ((type == PlatformMediaSession::VideoAudio || type == PlatformMediaSession::Audio) && session.canProduceAudio())
+ if ((type == PlatformMediaSession::VideoAudio || type == PlatformMediaSession::Audio) && session.canProduceAudio() && session.state() == PlatformMediaSession::Playing)
hasAudibleAudioOrVideoMediaType = true;
return (type == PlatformMediaSession::MediaStreamCapturingAudio);
});
Modified: trunk/Tools/ChangeLog (229588 => 229589)
--- trunk/Tools/ChangeLog 2018-03-13 21:42:08 UTC (rev 229588)
+++ trunk/Tools/ChangeLog 2018-03-13 22:54:20 UTC (rev 229589)
@@ -1,3 +1,16 @@
+2018-03-13 Jer Noble <[email protected]>
+
+ [iOS] Muted media playback can interrupt out-of-process audio
+ https://bugs.webkit.org/show_bug.cgi?id=183606
+ <rdar://problem/37466253>
+
+ Reviewed by Eric Carlson.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-paused-audio-and-playing-muted.html: Added.
+
2018-03-13 Ross Kirsling <[email protected]>
[Win] Layout Test fast/html/menuitem-element.html is failing.
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (229588 => 229589)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-03-13 21:42:08 UTC (rev 229588)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-03-13 22:54:20 UTC (rev 229589)
@@ -682,6 +682,7 @@
CD321B041E3A85FA00EB21C8 /* video-with-muted-audio-and-webaudio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD321B031E3A84B700EB21C8 /* video-with-muted-audio-and-webaudio.html */; };
CD59F53419E9110D00CF1835 /* file-with-mse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD59F53219E910AA00CF1835 /* file-with-mse.html */; };
CD59F53519E9110D00CF1835 /* test-mse.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD59F53319E910BC00CF1835 /* test-mse.mp4 */; };
+ CD758A6F20572EA00071834A /* video-with-paused-audio-and-playing-muted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD758A6E20572D540071834A /* video-with-paused-audio-and-playing-muted.html */; };
CD78E11D1DB7EA660014A2DE /* FullscreenDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD78E11A1DB7EA360014A2DE /* FullscreenDelegate.mm */; };
CD78E11E1DB7EE2A0014A2DE /* FullscreenDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD78E11B1DB7EA360014A2DE /* FullscreenDelegate.html */; };
CD9E292E1C90C33F000BB800 /* audio-only.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD9E292D1C90C1BA000BB800 /* audio-only.html */; };
@@ -852,6 +853,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ CD758A6F20572EA00071834A /* video-with-paused-audio-and-playing-muted.html in Copy Resources */,
1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
1C2B81871C8925A000A5529F /* Ahem.ttf in Copy Resources */,
@@ -1798,6 +1800,7 @@
CD5497B315857F0C00B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
CD59F53219E910AA00CF1835 /* file-with-mse.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "file-with-mse.html"; sourceTree = "<group>"; };
CD59F53319E910BC00CF1835 /* test-mse.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "test-mse.mp4"; sourceTree = "<group>"; };
+ CD758A6E20572D540071834A /* video-with-paused-audio-and-playing-muted.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "video-with-paused-audio-and-playing-muted.html"; sourceTree = "<group>"; };
CD773F711C5057DB0002257C /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
CD78E11A1DB7EA360014A2DE /* FullscreenDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenDelegate.mm; sourceTree = "<group>"; };
CD78E11B1DB7EA360014A2DE /* FullscreenDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenDelegate.html; sourceTree = "<group>"; };
@@ -3104,6 +3107,7 @@
CDC8E4891BC5C96200594FEC /* video-with-audio.html */,
CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */,
CD321B031E3A84B700EB21C8 /* video-with-muted-audio-and-webaudio.html */,
+ CD758A6E20572D540071834A /* video-with-paused-audio-and-playing-muted.html */,
CDB411591E09DA8E00EAD352 /* video-with-muted-audio.html */,
CDC8E48B1BC5C96200594FEC /* video-without-audio.html */,
CDC8E48C1BC5C96200594FEC /* video-without-audio.mp4 */,
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm (229588 => 229589)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm 2018-03-13 21:42:08 UTC (rev 229588)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/AudioSessionCategoryIOS.mm 2018-03-13 22:54:20 UTC (rev 229589)
@@ -101,6 +101,14 @@
Util::run(&didBeginPlaying);
EXPECT_WK_STREQ(getAVAudioSessionCategoryAmbient(), [[getAVAudioSessionClass() sharedInstance] category]);
+
+ didBeginPlaying = false;
+
+ [uiWebView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"video-with-paused-audio-and-playing-muted" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+ Util::run(&didBeginPlaying);
+
+ EXPECT_WK_STREQ(getAVAudioSessionCategoryAmbient(), [[getAVAudioSessionClass() sharedInstance] category]);
}
}
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-paused-audio-and-playing-muted.html (0 => 229589)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-paused-audio-and-playing-muted.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-paused-audio-and-playing-muted.html 2018-03-13 22:54:20 UTC (rev 229589)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script>
+ function go() {
+ var video1 = document.createElement('video');
+ document.body.appendChild(video1);
+ video1.setAttribute('webkit-playsinline', '');
+ video1.src = '';
+ video1.play().then(() => {
+ video1.pause();
+ var video2 = document.createElement('video');
+ document.body.appendChild(video2);
+ video2.setAttribute('webkit-playsinline', '');
+ video2.muted = true;
+ video2.src = '';
+ video2.play().then(playing, notPlaying);
+ });
+ }
+
+ function playing() {
+ try {
+ window.webkit.messageHandlers.testHandler.postMessage('playing');
+ } catch(e) {
+ window.location = 'callback:playing';
+ }
+ }
+
+ function notPlaying() {
+ try {
+ window.webkit.messageHandlers.testHandler.postMessage('not playing');
+ } catch(e) { }
+ }
+ </script>
+ </head>
+ <body _onload_="go()">
+ </body>
+</html>