Skip to content

Commit 92f0592

Browse files
committed
[WebAudio] Add webm/vorbis container support
https://bugs.webkit.org/show_bug.cgi?id=228139 rdar://80883073 Reviewed by Jer Noble. Source/WebKit: Access to the com.apple.audio.AudioComponentRegistrar is denied by the sandbox which prevents registering the Vorbis Audio Component. So we instantiate the decoder right before setting up the sandbox. This is a workaround for rdar://81137953. Test: webaudio/decode-audio-data-webm-vorbis.html * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): LayoutTests: * platform/mac/TestExpectations: * webaudio/decode-audio-data-webm-vorbis-expected.txt: Added. * webaudio/decode-audio-data-webm-vorbis.html: Added. Canonical link: https://commits.webkit.org/240195@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 9c6fee7 commit 92f0592

6 files changed

Lines changed: 75 additions & 0 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2021-08-02 Jean-Yves Avenard <jya@apple.com>
2+
3+
[WebAudio] Add webm/vorbis container support
4+
https://bugs.webkit.org/show_bug.cgi?id=228139
5+
rdar://80883073
6+
7+
Reviewed by Jer Noble.
8+
9+
* platform/mac/TestExpectations:
10+
* webaudio/decode-audio-data-webm-vorbis-expected.txt: Added.
11+
* webaudio/decode-audio-data-webm-vorbis.html: Added.
12+
113
2021-08-02 Eric Hutchison <ehutchison@apple.com>
214

315
[ iOS iPad ] editing/inserting/insert-paragraph-separator-with-html-elements-crash.html is a flaky failure.

LayoutTests/platform/mac/TestExpectations

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,7 @@ webkit.org/b/214155 imported/w3c/web-platform-tests/html/cross-origin-embedder-p
17161716
[ Catalina Mojave BigSur ] media/media-source/media-webm-opus-partial.html [ Skip ]
17171717
[ Catalina Mojave BigSur ] media/media-source/media-webm-opus-partial-abort.html [ Skip ]
17181718
[ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-opus.html [ Skip ]
1719+
[ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-vorbis.html [ Skip ]
17191720

17201721
webkit.org/b/214422 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/suspend-after-construct.html [ Pass Failure ]
17211722

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Test that decoding an vorbis webm file succeeds
2+
3+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4+
5+
6+
PASS Successfully decoded content
7+
PASS successfullyParsed is true
8+
9+
TEST COMPLETE
10+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<script src="../resources/js-test.js"></script>
5+
<script type="text/javascript" src="resources/audio-testing.js"></script>
6+
</head>
7+
<body>
8+
<script>
9+
description("Test that decoding an vorbis webm file succeeds");
10+
11+
window.jsTestIsAsync = true;
12+
13+
var context = new window.AudioContext();
14+
var request = new XMLHttpRequest();
15+
request.open("GET", 'resources/media/vorbis.webm', true);
16+
request.responseType = "arraybuffer";
17+
18+
request.onload = function() {
19+
context.decodeAudioData(request.response, (buffer) => {
20+
testPassed("Successfully decoded content");
21+
finishJSTest();
22+
}, () => {
23+
testFailed("Failed to decode file");
24+
finishJSTest();
25+
});
26+
}
27+
request.send();
28+
29+
</script>
30+
</body>
31+
</html>

Source/WebKit/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2021-08-02 Jean-Yves Avenard <jya@apple.com>
2+
3+
[WebAudio] Add webm/vorbis container support
4+
https://bugs.webkit.org/show_bug.cgi?id=228139
5+
rdar://80883073
6+
7+
Reviewed by Jer Noble.
8+
9+
Access to the com.apple.audio.AudioComponentRegistrar is denied by the sandbox which
10+
prevents registering the Vorbis Audio Component. So we instantiate the decoder right before
11+
setting up the sandbox.
12+
This is a workaround for rdar://81137953.
13+
Test: webaudio/decode-audio-data-webm-vorbis.html
14+
15+
* WebProcess/cocoa/WebProcessCocoa.mm:
16+
(WebKit::WebProcess::initializeSandbox):
17+
118
2021-08-02 Jean-Yves Avenard <jya@apple.com>
219

320
Crash in -[WKFullScreenWindowController windowDidExitFullScreen:]

Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#import <WebCore/SystemSoundManager.h>
8282
#import <WebCore/UTIUtilities.h>
8383
#import <WebCore/VersionChecks.h>
84+
#import <WebCore/WebMAudioUtilitiesCocoa.h>
8485
#import <algorithm>
8586
#import <dispatch/dispatch.h>
8687
#import <mach/mach.h>
@@ -744,6 +745,9 @@ static inline void restrictImageAndVideoDecoders()
744745
// Need to override the default, because service has a different bundle ID.
745746
auto webKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"];
746747

748+
// We need to initialize the Vorbis decoder before the sandbox gets setup; this is a one off action.
749+
WebCore::registerVorbisDecoderIfNeeded();
750+
747751
sandboxParameters.setOverrideSandboxProfilePath(makeString(String([webKitBundle resourcePath]), "/com.apple.WebProcess.sb"));
748752

749753
bool enableMessageFilter = false;

0 commit comments

Comments
 (0)