haikuwebkit/LayoutTests/webaudio/decode-audio-data-webm-opus...

37 lines
1.0 KiB
HTML
Raw Permalink Normal View History

[WebAudio] Add webm/opus container support https://bugs.webkit.org/show_bug.cgi?id=227110 <rdar://problem/79437067> Reviewed by Jer Noble. Source/WebCore: Add support for webm in Web Audio. As decoding needs to be performed in the web content process we need to ensure that the decoders are available there. For security reasons, com.apple.audio.AudioComponentRegistrar mach calls are blocked which prevents registering a new audio component. We instead register it in the UI process so that AudioComponentFetchServerRegistrations SPI can forward the registration in the web process. Unfortunately, for unknown reasons, this fails for Vorbis audio codec (bug 228139). To demux the webm content, we use the existing SourceBufferParserWebM to extract all audio packets. We then iterate over all CM Samples and decode them into PCM, performing resampling as needed on the fly. There are things left to fix. - Opus and Vorbis encoder delay isn't handled (bug 228140) which leaves audible silence at the beginning of the destination buffer. - We can only decode mono and stereo content. Opus and Vorbis let you define a custom channel ordering, this is particularly used with ambisonic audio (with opus 255 mode). CoreMedia doesn't easily deal with such re-ordering as it appears to be essentially designed for audible content. With more than 2 channels, decoding will either fail or produce channels in the wrong order. Test: webaudio/decode-audio-data-webm-opus.html * Headers.cmake: Export header so that we can register the decoder in the UI process. * WebCore.xcodeproj/project.pbxproj: same as above. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): Make canPlayType(webm/audio; codecs=opus) work if features is set. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebMWebAudioEnabled): (WebCore::RuntimeEnabledFeatures::webMWebAudioEnabled const): * platform/MediaSample.h: Fly-by fix: remove unnecessary WEBCORE_EXPORT * platform/audio/AudioBus.cpp: (WebCore::AudioBus::setLength): * platform/audio/AudioBus.h: Add setLength method. Will change the reported length without touching the underlying storage. * platform/audio/AudioChannel.h: Add setLength method. Will change the reported length without touching the underlying storage. * platform/audio/cocoa/AudioFileReaderCocoa.cpp: (WebCore::tryCreateAudioBufferList): Fix checkedInt use to catch potential overflow (WebCore::AudioBufferListHolder::AudioBufferListHolder): Add convenience class that free wrapped AudioBufferList object on exit. (WebCore::AudioBufferListHolder::~AudioBufferListHolder): (WebCore::AudioBufferListHolder::operator bool const): (WebCore::AudioBufferListHolder::operator-> const): (WebCore::AudioBufferListHolder::operator* const): (WebCore::AudioBufferListHolder::isValid const): (WebCore::AudioFileReader::AudioFileReader): (WebCore::AudioFileReader::isMaybeWebM const): Method to check if the buffer contains WebM data. (WebCore::passthroughInputDataCallback): Required for AudioConverterFillComplexBuffer. Will feed the decoder the data to decode, splitting the multiple packets found in the CMSampleBuffer. (WebCore::AudioFileReader::numberOfFrames const): Return the total number of decoded frames in the packets. (WebCore::AudioFileReader::fileDataFormat const): Create AudioStreamBasicDescription related to the demuxed audio track. nullopt if unsupported content. (WebCore::AudioFileReader::clientDataFormat const): (WebCore::AudioFileReader::createBus): (WebCore::AudioFileReader::logChannel const): * platform/audio/cocoa/AudioFileReaderCocoa.h: * platform/audio/cocoa/AudioSampleDataSource.h: Remove unused typedef. * platform/audio/cocoa/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::~AudioSampleDataSource): Fly-by fix, make it use PAL softlinks (WebCore::AudioSampleDataSource::setupConverter): Fly-by fix, make it use PAL softlinks * platform/gamepad/mac/HIDGamepadProvider.mm: Fly-by fix, add missing header. * platform/graphics/TrackPrivateBase.cpp: Fly-by fix, add missing header. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: Fly-by fix required by webkit-prepare : don't tag the whole class as WEBCORE_EXPORT. Move constructor and destructor function definitions out-of-line to prevent linkage errors. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Move code * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Fly-by fix, add missing header. * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.h: Export some symbols, add new method definitions. * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm: (WebCore::registerDecoderFactory): Instead of attempting to register the decoder by dl-opening the required library, first attempting to see if the decoder is already available. Calling AudioComponentRegister in the web content process when the GPU process is enabled will fail due to sandbox settings. Which would incorrectly report the codec to not be available when it was. (WebCore::createAudioFormatDescriptionForFormat): (WebCore::isOpusDecoderAvailable): Fly-by fix, should the method be called on non-mac platform it would have return the unitialized value of the available static variable. (WebCore::registerOpusDecoderIfNeeded): Added (WebCore::isVorbisDecoderAvailable): Same as isOpusDecoderAvailable (WebCore::registerVorbisDecoderIfNeeded): Added Source/WebCore/PAL: Add various AVFoundation (AVAudioConverter) related methods and CoreMedia to access required CMSampleBuffer related methods. * pal/cf/CoreMediaSoftLink.cpp: * pal/cf/CoreMediaSoftLink.h: * pal/cocoa/AVFoundationSoftLink.h: * pal/cocoa/AVFoundationSoftLink.mm: Source/WebKit: Add default value for webm_webaudio feature flag for the different platforms. Disabled by default on all platforms. Fly-by fix: don't make webm parser dependent on VP9 support. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebMWebAudioEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): Source/WTF: Add WebMWebAudioEnabled preference to make canPlayType return probably for mimetype: "audio/webm; codecs=opus" Disabled by default. * Scripts/Preferences/WebPreferencesExperimental.yaml: LayoutTests: * platform/mac/TestExpectations: Only enable test on macOS Monterey * webaudio/decode-audio-data-basic.html: fix whitespace * webaudio/decode-audio-data-webm-opus-expected.txt: Added. * webaudio/decode-audio-data-webm-opus.html: Added. * webaudio/resources/media/opus.webm: Added. * webaudio/resources/media/vorbis.webm: Added. Canonical link: https://commits.webkit.org/240056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-29 04:18:16 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script type="text/javascript" src="resources/audio-testing.js"></script>
</head>
<body>
<script>
description("Test that decoding an opus webm file succeeds");
window.jsTestIsAsync = true;
Source/WebCore: [WebAudio] webm; properly trim frames according to the codec delay information https://bugs.webkit.org/show_bug.cgi?id=228140 rdar://problem/80883882 Reviewed by Eric Carlson. Add frame-perfect decoding for Opus and Vorbis in WebM container. Unfortunately, due to a vorbis decoder bug, it is not possible to test that vorbis decoding returns the right number of frames. Amend Opus test to ensure the right amount of frames are returned. * platform/audio/cocoa/AudioFileReaderCocoa.cpp: (WebCore::AudioFileReader::demuxWebMData const): (WebCore::passthroughInputDataCallback): AudioToolbox internal logging could overflow if we used packet descriptions with offsets, so we take the most commonly used scenario where we have a single packet to decode at a time. (WebCore::AudioFileReader::decodeWebMData const): * platform/graphics/cocoa/AudioTrackPrivateWebM.cpp: (WebCore::AudioTrackPrivateWebM::codecDelay const): (WebCore::AudioTrackPrivateWebM::setDiscardPadding): (WebCore::AudioTrackPrivateWebM::discardPadding const): * platform/graphics/cocoa/AudioTrackPrivateWebM.h: * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::OnElementEnd): Fly-by, ensure m_didParseInitializationDataCallback only ever accessed on client thread. (WebCore::SourceBufferParserWebM::OnBlockGroupEnd): * platform/graphics/cocoa/SourceBufferParserWebM.h: Add trimming data callback. Only mark WEBCORE_EXPORT the methods that need it. (WebCore::SourceBufferParserWebM::appendData): (WebCore::SourceBufferParserWebM::setDidParseTrimmingDataCallback): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): Make canPlayType(webm/audio; codecs=vorbis) returns maybe if feature flag set. LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=228140 rdar://problem/80883882 Reviewed by Eric Carlson. https://bugs.webkit.org/show_bug.cgi?id=228140 * webaudio/decode-audio-data-webm-opus-expected.txt: * webaudio/decode-audio-data-webm-opus.html: Canonical link: https://commits.webkit.org/240206@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-03 04:21:47 +00:00
var context = new window.AudioContext({ sampleRate: 48000 });
[WebAudio] Add webm/opus container support https://bugs.webkit.org/show_bug.cgi?id=227110 <rdar://problem/79437067> Reviewed by Jer Noble. Source/WebCore: Add support for webm in Web Audio. As decoding needs to be performed in the web content process we need to ensure that the decoders are available there. For security reasons, com.apple.audio.AudioComponentRegistrar mach calls are blocked which prevents registering a new audio component. We instead register it in the UI process so that AudioComponentFetchServerRegistrations SPI can forward the registration in the web process. Unfortunately, for unknown reasons, this fails for Vorbis audio codec (bug 228139). To demux the webm content, we use the existing SourceBufferParserWebM to extract all audio packets. We then iterate over all CM Samples and decode them into PCM, performing resampling as needed on the fly. There are things left to fix. - Opus and Vorbis encoder delay isn't handled (bug 228140) which leaves audible silence at the beginning of the destination buffer. - We can only decode mono and stereo content. Opus and Vorbis let you define a custom channel ordering, this is particularly used with ambisonic audio (with opus 255 mode). CoreMedia doesn't easily deal with such re-ordering as it appears to be essentially designed for audible content. With more than 2 channels, decoding will either fail or produce channels in the wrong order. Test: webaudio/decode-audio-data-webm-opus.html * Headers.cmake: Export header so that we can register the decoder in the UI process. * WebCore.xcodeproj/project.pbxproj: same as above. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): Make canPlayType(webm/audio; codecs=opus) work if features is set. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebMWebAudioEnabled): (WebCore::RuntimeEnabledFeatures::webMWebAudioEnabled const): * platform/MediaSample.h: Fly-by fix: remove unnecessary WEBCORE_EXPORT * platform/audio/AudioBus.cpp: (WebCore::AudioBus::setLength): * platform/audio/AudioBus.h: Add setLength method. Will change the reported length without touching the underlying storage. * platform/audio/AudioChannel.h: Add setLength method. Will change the reported length without touching the underlying storage. * platform/audio/cocoa/AudioFileReaderCocoa.cpp: (WebCore::tryCreateAudioBufferList): Fix checkedInt use to catch potential overflow (WebCore::AudioBufferListHolder::AudioBufferListHolder): Add convenience class that free wrapped AudioBufferList object on exit. (WebCore::AudioBufferListHolder::~AudioBufferListHolder): (WebCore::AudioBufferListHolder::operator bool const): (WebCore::AudioBufferListHolder::operator-> const): (WebCore::AudioBufferListHolder::operator* const): (WebCore::AudioBufferListHolder::isValid const): (WebCore::AudioFileReader::AudioFileReader): (WebCore::AudioFileReader::isMaybeWebM const): Method to check if the buffer contains WebM data. (WebCore::passthroughInputDataCallback): Required for AudioConverterFillComplexBuffer. Will feed the decoder the data to decode, splitting the multiple packets found in the CMSampleBuffer. (WebCore::AudioFileReader::numberOfFrames const): Return the total number of decoded frames in the packets. (WebCore::AudioFileReader::fileDataFormat const): Create AudioStreamBasicDescription related to the demuxed audio track. nullopt if unsupported content. (WebCore::AudioFileReader::clientDataFormat const): (WebCore::AudioFileReader::createBus): (WebCore::AudioFileReader::logChannel const): * platform/audio/cocoa/AudioFileReaderCocoa.h: * platform/audio/cocoa/AudioSampleDataSource.h: Remove unused typedef. * platform/audio/cocoa/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::~AudioSampleDataSource): Fly-by fix, make it use PAL softlinks (WebCore::AudioSampleDataSource::setupConverter): Fly-by fix, make it use PAL softlinks * platform/gamepad/mac/HIDGamepadProvider.mm: Fly-by fix, add missing header. * platform/graphics/TrackPrivateBase.cpp: Fly-by fix, add missing header. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: Fly-by fix required by webkit-prepare : don't tag the whole class as WEBCORE_EXPORT. Move constructor and destructor function definitions out-of-line to prevent linkage errors. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Move code * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Fly-by fix, add missing header. * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.h: Export some symbols, add new method definitions. * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm: (WebCore::registerDecoderFactory): Instead of attempting to register the decoder by dl-opening the required library, first attempting to see if the decoder is already available. Calling AudioComponentRegister in the web content process when the GPU process is enabled will fail due to sandbox settings. Which would incorrectly report the codec to not be available when it was. (WebCore::createAudioFormatDescriptionForFormat): (WebCore::isOpusDecoderAvailable): Fly-by fix, should the method be called on non-mac platform it would have return the unitialized value of the available static variable. (WebCore::registerOpusDecoderIfNeeded): Added (WebCore::isVorbisDecoderAvailable): Same as isOpusDecoderAvailable (WebCore::registerVorbisDecoderIfNeeded): Added Source/WebCore/PAL: Add various AVFoundation (AVAudioConverter) related methods and CoreMedia to access required CMSampleBuffer related methods. * pal/cf/CoreMediaSoftLink.cpp: * pal/cf/CoreMediaSoftLink.h: * pal/cocoa/AVFoundationSoftLink.h: * pal/cocoa/AVFoundationSoftLink.mm: Source/WebKit: Add default value for webm_webaudio feature flag for the different platforms. Disabled by default on all platforms. Fly-by fix: don't make webm parser dependent on VP9 support. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebMWebAudioEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): Source/WTF: Add WebMWebAudioEnabled preference to make canPlayType return probably for mimetype: "audio/webm; codecs=opus" Disabled by default. * Scripts/Preferences/WebPreferencesExperimental.yaml: LayoutTests: * platform/mac/TestExpectations: Only enable test on macOS Monterey * webaudio/decode-audio-data-basic.html: fix whitespace * webaudio/decode-audio-data-webm-opus-expected.txt: Added. * webaudio/decode-audio-data-webm-opus.html: Added. * webaudio/resources/media/opus.webm: Added. * webaudio/resources/media/vorbis.webm: Added. Canonical link: https://commits.webkit.org/240056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-29 04:18:16 +00:00
var request = new XMLHttpRequest();
request.open("GET", 'resources/media/opus.webm', true);
request.responseType = "arraybuffer";
request.onload = function() {
context.decodeAudioData(request.response, (buffer) => {
testPassed("Successfully decoded content");
Source/WebCore: [WebAudio] webm; properly trim frames according to the codec delay information https://bugs.webkit.org/show_bug.cgi?id=228140 rdar://problem/80883882 Reviewed by Eric Carlson. Add frame-perfect decoding for Opus and Vorbis in WebM container. Unfortunately, due to a vorbis decoder bug, it is not possible to test that vorbis decoding returns the right number of frames. Amend Opus test to ensure the right amount of frames are returned. * platform/audio/cocoa/AudioFileReaderCocoa.cpp: (WebCore::AudioFileReader::demuxWebMData const): (WebCore::passthroughInputDataCallback): AudioToolbox internal logging could overflow if we used packet descriptions with offsets, so we take the most commonly used scenario where we have a single packet to decode at a time. (WebCore::AudioFileReader::decodeWebMData const): * platform/graphics/cocoa/AudioTrackPrivateWebM.cpp: (WebCore::AudioTrackPrivateWebM::codecDelay const): (WebCore::AudioTrackPrivateWebM::setDiscardPadding): (WebCore::AudioTrackPrivateWebM::discardPadding const): * platform/graphics/cocoa/AudioTrackPrivateWebM.h: * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::OnElementEnd): Fly-by, ensure m_didParseInitializationDataCallback only ever accessed on client thread. (WebCore::SourceBufferParserWebM::OnBlockGroupEnd): * platform/graphics/cocoa/SourceBufferParserWebM.h: Add trimming data callback. Only mark WEBCORE_EXPORT the methods that need it. (WebCore::SourceBufferParserWebM::appendData): (WebCore::SourceBufferParserWebM::setDidParseTrimmingDataCallback): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): Make canPlayType(webm/audio; codecs=vorbis) returns maybe if feature flag set. LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=228140 rdar://problem/80883882 Reviewed by Eric Carlson. https://bugs.webkit.org/show_bug.cgi?id=228140 * webaudio/decode-audio-data-webm-opus-expected.txt: * webaudio/decode-audio-data-webm-opus.html: Canonical link: https://commits.webkit.org/240206@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-03 04:21:47 +00:00
// File is exactly 1-0.0065s long @ 48000Hz, so 47688 frames.
if (buffer.length === 47688)
testPassed("Decoding returned the right number of frames.");
else
testFailed("Decoding returned the wrong number of frames: " + buffer.length);
[WebAudio] Add webm/opus container support https://bugs.webkit.org/show_bug.cgi?id=227110 <rdar://problem/79437067> Reviewed by Jer Noble. Source/WebCore: Add support for webm in Web Audio. As decoding needs to be performed in the web content process we need to ensure that the decoders are available there. For security reasons, com.apple.audio.AudioComponentRegistrar mach calls are blocked which prevents registering a new audio component. We instead register it in the UI process so that AudioComponentFetchServerRegistrations SPI can forward the registration in the web process. Unfortunately, for unknown reasons, this fails for Vorbis audio codec (bug 228139). To demux the webm content, we use the existing SourceBufferParserWebM to extract all audio packets. We then iterate over all CM Samples and decode them into PCM, performing resampling as needed on the fly. There are things left to fix. - Opus and Vorbis encoder delay isn't handled (bug 228140) which leaves audible silence at the beginning of the destination buffer. - We can only decode mono and stereo content. Opus and Vorbis let you define a custom channel ordering, this is particularly used with ambisonic audio (with opus 255 mode). CoreMedia doesn't easily deal with such re-ordering as it appears to be essentially designed for audible content. With more than 2 channels, decoding will either fail or produce channels in the wrong order. Test: webaudio/decode-audio-data-webm-opus.html * Headers.cmake: Export header so that we can register the decoder in the UI process. * WebCore.xcodeproj/project.pbxproj: same as above. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): Make canPlayType(webm/audio; codecs=opus) work if features is set. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebMWebAudioEnabled): (WebCore::RuntimeEnabledFeatures::webMWebAudioEnabled const): * platform/MediaSample.h: Fly-by fix: remove unnecessary WEBCORE_EXPORT * platform/audio/AudioBus.cpp: (WebCore::AudioBus::setLength): * platform/audio/AudioBus.h: Add setLength method. Will change the reported length without touching the underlying storage. * platform/audio/AudioChannel.h: Add setLength method. Will change the reported length without touching the underlying storage. * platform/audio/cocoa/AudioFileReaderCocoa.cpp: (WebCore::tryCreateAudioBufferList): Fix checkedInt use to catch potential overflow (WebCore::AudioBufferListHolder::AudioBufferListHolder): Add convenience class that free wrapped AudioBufferList object on exit. (WebCore::AudioBufferListHolder::~AudioBufferListHolder): (WebCore::AudioBufferListHolder::operator bool const): (WebCore::AudioBufferListHolder::operator-> const): (WebCore::AudioBufferListHolder::operator* const): (WebCore::AudioBufferListHolder::isValid const): (WebCore::AudioFileReader::AudioFileReader): (WebCore::AudioFileReader::isMaybeWebM const): Method to check if the buffer contains WebM data. (WebCore::passthroughInputDataCallback): Required for AudioConverterFillComplexBuffer. Will feed the decoder the data to decode, splitting the multiple packets found in the CMSampleBuffer. (WebCore::AudioFileReader::numberOfFrames const): Return the total number of decoded frames in the packets. (WebCore::AudioFileReader::fileDataFormat const): Create AudioStreamBasicDescription related to the demuxed audio track. nullopt if unsupported content. (WebCore::AudioFileReader::clientDataFormat const): (WebCore::AudioFileReader::createBus): (WebCore::AudioFileReader::logChannel const): * platform/audio/cocoa/AudioFileReaderCocoa.h: * platform/audio/cocoa/AudioSampleDataSource.h: Remove unused typedef. * platform/audio/cocoa/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::~AudioSampleDataSource): Fly-by fix, make it use PAL softlinks (WebCore::AudioSampleDataSource::setupConverter): Fly-by fix, make it use PAL softlinks * platform/gamepad/mac/HIDGamepadProvider.mm: Fly-by fix, add missing header. * platform/graphics/TrackPrivateBase.cpp: Fly-by fix, add missing header. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: Fly-by fix required by webkit-prepare : don't tag the whole class as WEBCORE_EXPORT. Move constructor and destructor function definitions out-of-line to prevent linkage errors. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Move code * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Fly-by fix, add missing header. * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.h: Export some symbols, add new method definitions. * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm: (WebCore::registerDecoderFactory): Instead of attempting to register the decoder by dl-opening the required library, first attempting to see if the decoder is already available. Calling AudioComponentRegister in the web content process when the GPU process is enabled will fail due to sandbox settings. Which would incorrectly report the codec to not be available when it was. (WebCore::createAudioFormatDescriptionForFormat): (WebCore::isOpusDecoderAvailable): Fly-by fix, should the method be called on non-mac platform it would have return the unitialized value of the available static variable. (WebCore::registerOpusDecoderIfNeeded): Added (WebCore::isVorbisDecoderAvailable): Same as isOpusDecoderAvailable (WebCore::registerVorbisDecoderIfNeeded): Added Source/WebCore/PAL: Add various AVFoundation (AVAudioConverter) related methods and CoreMedia to access required CMSampleBuffer related methods. * pal/cf/CoreMediaSoftLink.cpp: * pal/cf/CoreMediaSoftLink.h: * pal/cocoa/AVFoundationSoftLink.h: * pal/cocoa/AVFoundationSoftLink.mm: Source/WebKit: Add default value for webm_webaudio feature flag for the different platforms. Disabled by default on all platforms. Fly-by fix: don't make webm parser dependent on VP9 support. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebMWebAudioEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): Source/WTF: Add WebMWebAudioEnabled preference to make canPlayType return probably for mimetype: "audio/webm; codecs=opus" Disabled by default. * Scripts/Preferences/WebPreferencesExperimental.yaml: LayoutTests: * platform/mac/TestExpectations: Only enable test on macOS Monterey * webaudio/decode-audio-data-basic.html: fix whitespace * webaudio/decode-audio-data-webm-opus-expected.txt: Added. * webaudio/decode-audio-data-webm-opus.html: Added. * webaudio/resources/media/opus.webm: Added. * webaudio/resources/media/vorbis.webm: Added. Canonical link: https://commits.webkit.org/240056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-29 04:18:16 +00:00
finishJSTest();
}, () => {
testFailed("Failed to decode file");
finishJSTest();
});
}
request.send();
</script>
</body>
</html>