Skip to content
Permalink
Browse files
[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=206582
Source/WebCore:

<rdar://problem/58985368>

Reviewed by Eric Carlson.

AVAssetWriterDelegate allows to grab recorded data whenever wanted.
This delegate requires passing compressed samples to AVAssetWriter.
Implement video encoding and audio encoding in dedicated classes and use these classes before adding buffers to AVAssetWriter.
These classes are AudioSampleBufferCompressor and VideoSampleBufferCompressor.
They support AAC and H264 so far and should be further improved to support more encoding options.

Instantiate real writer only for platforms supporting AVAssetWriterDelegate, since it is not supported everywhere.
The writer, doing the pacakging, is receiving compressed buffer from the audio/video compressors.
It then sends data when being request to flush to its delegate, which will send data to the MediaRecorderPrivateWriter.
The MediaRecorderPrivateWriter stores the data in a SharedBuffer until MediaRecorder asks for data.

Note that, whenever we request data, we flush the writer and insert an end of video sample to make sure video data gets flushed.
Therefore data should not be requested too fast to get adequate video compression.

Covered by existing tests.

* Modules/mediarecorder/MediaRecorderProvider.cpp:
(WebCore::MediaRecorderProvider::createMediaRecorderPrivate):
* WebCore.xcodeproj/project.pbxproj:
* platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
(WebCore::MediaRecorderPrivateAVFImpl::create):
* platform/mediarecorder/MediaRecorderPrivateAVFImpl.h:
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: Added.
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: Added.
(WebCore::AudioSampleBufferCompressor::create):
(WebCore::AudioSampleBufferCompressor::AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::initialize):
(WebCore::AudioSampleBufferCompressor::finish):
(WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription):
(WebCore::AudioSampleBufferCompressor::computeBufferSizeForAudioFormat):
(WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded):
(WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
(WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
(WebCore::AudioSampleBufferCompressor::audioConverterComplexInputDataProc):
(WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets):
(WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
(WebCore::AudioSampleBufferCompressor::processSampleBuffer):
(WebCore::AudioSampleBufferCompressor::addSampleBuffer):
(WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(-[WebAVAssetWriterDelegate initWithWriter:]):
(-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedHeaderData:]):
(-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedMediaData:fragmentedMediaDataReport:]):
(-[WebAVAssetWriterDelegate close]):
(WebCore::MediaRecorderPrivateWriter::create):
(WebCore::MediaRecorderPrivateWriter::compressedVideoOutputBufferCallback):
(WebCore::MediaRecorderPrivateWriter::compressedAudioOutputBufferCallback):
(WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter):
(WebCore::MediaRecorderPrivateWriter::~MediaRecorderPrivateWriter):
(WebCore::MediaRecorderPrivateWriter::initialize):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::startAssetWriter):
(WebCore::MediaRecorderPrivateWriter::appendCompressedAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendCompressedSampleBuffers):
(WebCore::appendEndsPreviousSampleDurationMarker):
(WebCore::MediaRecorderPrivateWriter::appendEndOfVideoSampleDurationIfNeeded):
(WebCore::MediaRecorderPrivateWriter::flushCompressedSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::clear):
(WebCore::copySampleBufferWithCurrentTimeStamp):
(WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
(WebCore::createAudioFormatDescription):
(WebCore::createAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::stopRecording):
(WebCore::MediaRecorderPrivateWriter::appendData):
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h: Copied from Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h.
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: Added.
(WebCore::VideoSampleBufferCompressor::create):
(WebCore::VideoSampleBufferCompressor::VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::initialize):
(WebCore::VideoSampleBufferCompressor::finish):
(WebCore::VideoSampleBufferCompressor::videoCompressionCallback):
(WebCore::VideoSampleBufferCompressor::initCompressionSession):
(WebCore::VideoSampleBufferCompressor::processSampleBuffer):
(WebCore::VideoSampleBufferCompressor::addSampleBuffer):
(WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer):

Source/WebCore/PAL:

<rdar://problem/58985368>

Reviewed by Eric Carlson.

Add soft link macros for VideoToolbox and AudioToolbox.

* PAL.xcodeproj/project.pbxproj:
* pal/cf/AudioToolboxSoftLink.cpp: Added.
* pal/cf/AudioToolboxSoftLink.h: Added.
* pal/cf/CoreMediaSoftLink.cpp:
* pal/cf/CoreMediaSoftLink.h:
* pal/cf/VideoToolboxSoftLink.cpp: Added.
* pal/cf/VideoToolboxSoftLink.h: Added.

Source/WebKit:

<rdar://problem/58985368>

Reviewed by Eric Carlson.

Enable RemoteMediaRecorder only for systems supporting AVAssetWriterDelegate.

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::didReceiveMessage):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/webrtc/RemoteMediaRecorder.cpp:
* GPUProcess/webrtc/RemoteMediaRecorder.h:
* GPUProcess/webrtc/RemoteMediaRecorder.messages.in:
* GPUProcess/webrtc/RemoteMediaRecorderManager.cpp:
* GPUProcess/webrtc/RemoteMediaRecorderManager.h:
* GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in:
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
* WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
* WebProcess/GPU/webrtc/MediaRecorderPrivate.h:
* WebProcess/GPU/webrtc/MediaRecorderProvider.cpp:
(WebKit::MediaRecorderProvider::createMediaRecorderPrivate):

Source/WTF:

Reviewed by Eric Carlson.

* wtf/PlatformHave.h:

LayoutTests:

Reviewed by Eric Carlson.

Disable tests on all platforms except the ones supporting AVAssetWriterDelegate.

* TestExpectations:
* http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable-gpuprocess.html:
Remove web audio generation since there seems to be some unstability in web audio -> stream -> media recorder.
which should be fixed as follow-up specific patches.
* platform/mac/TestExpectations:
Enable running tests.


Canonical link: https://commits.webkit.org/220369@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256010 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Feb 7, 2020
1 parent 28baf7f commit 6501c2ef8445737dae4d06c3d4cf235ec0850a1a
Showing with 1,655 additions and 291 deletions.
  1. +16 −0 LayoutTests/ChangeLog
  2. +4 −1 LayoutTests/TestExpectations
  3. +0 −10 LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable-gpuprocess.html
  4. +4 −0 LayoutTests/platform/mac/TestExpectations
  5. +9 −0 Source/WTF/ChangeLog
  6. +4 −0 Source/WTF/wtf/PlatformHave.h
  7. +92 −0 Source/WebCore/ChangeLog
  8. +5 −0 Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.cpp
  9. +18 −0 Source/WebCore/PAL/ChangeLog
  10. +16 −0 Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
  11. +41 −0 Source/WebCore/PAL/pal/cf/AudioToolboxSoftLink.cpp
  12. +43 −0 Source/WebCore/PAL/pal/cf/AudioToolboxSoftLink.h
  13. +9 −0 Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp
  14. +17 −0 Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h
  15. +46 −0 Source/WebCore/PAL/pal/cf/VideoToolboxSoftLink.cpp
  16. +52 −0 Source/WebCore/PAL/pal/cf/VideoToolboxSoftLink.h
  17. +12 −0 Source/WebCore/WebCore.xcodeproj/project.pbxproj
  18. +11 −3 Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp
  19. +2 −2 Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h
  20. +91 −0 Source/WebCore/platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h
  21. +498 −0 Source/WebCore/platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm
  22. +53 −24 Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h
  23. +324 −235 Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm
  24. +71 −0 Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h
  25. +167 −0 Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm
  26. +25 −0 Source/WebKit/ChangeLog
  27. +7 −3 Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
  28. +4 −0 Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h
  29. +2 −2 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp
  30. +2 −2 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.h
  31. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.messages.in
  32. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.cpp
  33. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.h
  34. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in
  35. +1 −0 Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h
  36. +2 −2 Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp
  37. +2 −2 Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h
  38. +1 −1 Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp
@@ -1,3 +1,19 @@
2020-02-07 youenn fablet <youenn@apple.com>

[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=206582

Reviewed by Eric Carlson.

Disable tests on all platforms except the ones supporting AVAssetWriterDelegate.

* TestExpectations:
* http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable-gpuprocess.html:
Remove web audio generation since there seems to be some unstability in web audio -> stream -> media recorder.
which should be fixed as follow-up specific patches.
* platform/mac/TestExpectations:
Enable running tests.

2020-02-07 youenn fablet <youenn@apple.com>

Do not process newly gathered ICE candidates if document is suspended
@@ -3332,7 +3332,10 @@ webgl/1.0.3/conformance/textures/copy-tex-image-2d-formats.html [ Skip ]
webgl/1.0.3/conformance/canvas/rapid-resizing.html [ Skip ]
webgl/1.0.3/conformance/extensions/webgl-draw-buffers.html [ Skip ]

webkit.org/b/197673 http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html [ Pass Failure Timeout ]
# Not supported by default
http/wpt/mediarecorder [ Skip ]
imported/w3c/web-platform-tests/mediacapture-record [ Skip ]
fast/history/page-cache-media-recorder.html [ Skip ]

# To aid transition to ANGLE backend for WebGL, skip all of WebGL 2 tests for now.
# Re-enable as each chunk of tests are verified with ANGLE backend.
@@ -56,17 +56,7 @@
}

async_test(t => {
const ac = new AudioContext();
const osc = ac.createOscillator();
const dest = ac.createMediaStreamDestination();
const audio = dest.stream;
osc.connect(dest);

const video = createVideoStream();
assert_equals(video.getAudioTracks().length, 0, "video mediastream starts with no audio track");
assert_equals(audio.getAudioTracks().length, 1, "audio mediastream starts with one audio track");
video.addTrack(audio.getAudioTracks()[0]);
assert_equals(video.getAudioTracks().length, 1, "video mediastream starts with one audio track");
const recorder = new MediaRecorder(video);
let mode = 0;

@@ -1828,6 +1828,10 @@ webkit.org/b/195635 scrollingcoordinator/mac/multiple-fixed.html [ Pass Timeout
[ Catalina+ ] fast/text/design-system-ui-15.html [ Pass ]
[ Catalina+ ] fast/text/design-system-ui-16.html [ Pass ]

[ Catalina+ ] http/wpt/mediarecorder [ Pass Failure ]
[ Catalina+ ] imported/w3c/web-platform-tests/mediacapture-record [ Pass Failure ]
[ Catalina+ ] fast/history/page-cache-media-recorder.html [ Pass Failure ]

webkit.org/b/200128 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video_timeupdate_on_seek.html [ Timeout Pass ]

# rdar://55405851 ([ macOS ] Layout tests webgpu/*-triangle-strip.html are flaky failures. (201827))
@@ -1,3 +1,12 @@
2020-02-07 youenn fablet <youenn@apple.com>

[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=206582

Reviewed by Eric Carlson.

* wtf/PlatformHave.h:

2020-02-06 Mark Lam <mark.lam@apple.com>

Add a comment in StringView::setUnderlyingString(const StringView&) for clarification.
@@ -562,6 +562,10 @@
#define HAVE_OS_SIGNPOST 1
#endif

#if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || PLATFORM(IOS)) && (defined __has_include && __has_include(<AVFoundation/AVAssetWriter_Private.h>))
#define HAVE_AVASSETWRITERDELEGATE 1
#endif

#if PLATFORM(IOS_FAMILY) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
#define HAVE_SYSTEM_FONT_STYLE_TITLE_0 1
#define HAVE_SYSTEM_FONT_STYLE_TITLE_4 1
@@ -1,3 +1,95 @@
2020-02-07 youenn fablet <youenn@apple.com>

[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=206582
<rdar://problem/58985368>

Reviewed by Eric Carlson.

AVAssetWriterDelegate allows to grab recorded data whenever wanted.
This delegate requires passing compressed samples to AVAssetWriter.
Implement video encoding and audio encoding in dedicated classes and use these classes before adding buffers to AVAssetWriter.
These classes are AudioSampleBufferCompressor and VideoSampleBufferCompressor.
They support AAC and H264 so far and should be further improved to support more encoding options.

Instantiate real writer only for platforms supporting AVAssetWriterDelegate, since it is not supported everywhere.
The writer, doing the pacakging, is receiving compressed buffer from the audio/video compressors.
It then sends data when being request to flush to its delegate, which will send data to the MediaRecorderPrivateWriter.
The MediaRecorderPrivateWriter stores the data in a SharedBuffer until MediaRecorder asks for data.

Note that, whenever we request data, we flush the writer and insert an end of video sample to make sure video data gets flushed.
Therefore data should not be requested too fast to get adequate video compression.

Covered by existing tests.

* Modules/mediarecorder/MediaRecorderProvider.cpp:
(WebCore::MediaRecorderProvider::createMediaRecorderPrivate):
* WebCore.xcodeproj/project.pbxproj:
* platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
(WebCore::MediaRecorderPrivateAVFImpl::create):
* platform/mediarecorder/MediaRecorderPrivateAVFImpl.h:
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: Added.
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: Added.
(WebCore::AudioSampleBufferCompressor::create):
(WebCore::AudioSampleBufferCompressor::AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::initialize):
(WebCore::AudioSampleBufferCompressor::finish):
(WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription):
(WebCore::AudioSampleBufferCompressor::computeBufferSizeForAudioFormat):
(WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded):
(WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
(WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
(WebCore::AudioSampleBufferCompressor::audioConverterComplexInputDataProc):
(WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets):
(WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
(WebCore::AudioSampleBufferCompressor::processSampleBuffer):
(WebCore::AudioSampleBufferCompressor::addSampleBuffer):
(WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(-[WebAVAssetWriterDelegate initWithWriter:]):
(-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedHeaderData:]):
(-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedMediaData:fragmentedMediaDataReport:]):
(-[WebAVAssetWriterDelegate close]):
(WebCore::MediaRecorderPrivateWriter::create):
(WebCore::MediaRecorderPrivateWriter::compressedVideoOutputBufferCallback):
(WebCore::MediaRecorderPrivateWriter::compressedAudioOutputBufferCallback):
(WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter):
(WebCore::MediaRecorderPrivateWriter::~MediaRecorderPrivateWriter):
(WebCore::MediaRecorderPrivateWriter::initialize):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::startAssetWriter):
(WebCore::MediaRecorderPrivateWriter::appendCompressedAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendCompressedSampleBuffers):
(WebCore::appendEndsPreviousSampleDurationMarker):
(WebCore::MediaRecorderPrivateWriter::appendEndOfVideoSampleDurationIfNeeded):
(WebCore::MediaRecorderPrivateWriter::flushCompressedSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::clear):
(WebCore::copySampleBufferWithCurrentTimeStamp):
(WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
(WebCore::createAudioFormatDescription):
(WebCore::createAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::stopRecording):
(WebCore::MediaRecorderPrivateWriter::appendData):
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h: Copied from Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h.
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: Added.
(WebCore::VideoSampleBufferCompressor::create):
(WebCore::VideoSampleBufferCompressor::VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::initialize):
(WebCore::VideoSampleBufferCompressor::finish):
(WebCore::VideoSampleBufferCompressor::videoCompressionCallback):
(WebCore::VideoSampleBufferCompressor::initCompressionSession):
(WebCore::VideoSampleBufferCompressor::processSampleBuffer):
(WebCore::VideoSampleBufferCompressor::addSampleBuffer):
(WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer):

2020-02-07 youenn fablet <youenn@apple.com>

Do not process newly gathered ICE candidates if document is suspended
@@ -34,7 +34,12 @@ namespace WebCore {

std::unique_ptr<MediaRecorderPrivate> MediaRecorderProvider::createMediaRecorderPrivate(const MediaStreamPrivate& stream)
{
#if HAVE(AVASSETWRITERDELEGATE)
return MediaRecorderPrivateAVFImpl::create(stream);
#else
UNUSED_PARAM(stream);
return nullptr;
#endif
}

}
@@ -1,3 +1,21 @@
2020-02-07 youenn fablet <youenn@apple.com>

[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=206582
<rdar://problem/58985368>

Reviewed by Eric Carlson.

Add soft link macros for VideoToolbox and AudioToolbox.

* PAL.xcodeproj/project.pbxproj:
* pal/cf/AudioToolboxSoftLink.cpp: Added.
* pal/cf/AudioToolboxSoftLink.h: Added.
* pal/cf/CoreMediaSoftLink.cpp:
* pal/cf/CoreMediaSoftLink.h:
* pal/cf/VideoToolboxSoftLink.cpp: Added.
* pal/cf/VideoToolboxSoftLink.h: Added.

2020-02-06 Jiewen Tan <jiewen_tan@apple.com>

Adopt new SOAuthorizationOption constants
@@ -115,6 +115,10 @@
2E1342CC215AA10A007199D2 /* UIKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E1342CA215AA10A007199D2 /* UIKitSoftLink.h */; };
2E1342CD215AA10A007199D2 /* UIKitSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E1342CB215AA10A007199D2 /* UIKitSoftLink.mm */; };
31308B1420A21705003FB929 /* SystemPreviewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31308B1320A21705003FB929 /* SystemPreviewSPI.h */; };
416E995323DAE6BE00E871CB /* AudioToolboxSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E995123DAE6BD00E871CB /* AudioToolboxSoftLink.cpp */; };
416E995423DAE6BE00E871CB /* AudioToolboxSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E995223DAE6BE00E871CB /* AudioToolboxSoftLink.h */; };
416E995723DAEFF800E871CB /* VideoToolboxSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E995523DAEFF700E871CB /* VideoToolboxSoftLink.cpp */; };
416E995823DAEFF800E871CB /* VideoToolboxSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E995623DAEFF700E871CB /* VideoToolboxSoftLink.h */; };
442956CD218A72DF0080DB54 /* RevealSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 442956CC218A72DE0080DB54 /* RevealSPI.h */; };
4450FC9F21F5F602004DFA56 /* QuickLookSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4450FC9D21F5F602004DFA56 /* QuickLookSoftLink.mm */; };
4450FCA021F5F602004DFA56 /* QuickLookSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 4450FC9E21F5F602004DFA56 /* QuickLookSoftLink.h */; };
@@ -290,6 +294,10 @@
2E1342CB215AA10A007199D2 /* UIKitSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIKitSoftLink.mm; sourceTree = "<group>"; };
31308B1320A21705003FB929 /* SystemPreviewSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemPreviewSPI.h; sourceTree = "<group>"; };
37119A7820CCB5FF002C6DC9 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; };
416E995123DAE6BD00E871CB /* AudioToolboxSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioToolboxSoftLink.cpp; sourceTree = "<group>"; };
416E995223DAE6BE00E871CB /* AudioToolboxSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioToolboxSoftLink.h; sourceTree = "<group>"; };
416E995523DAEFF700E871CB /* VideoToolboxSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoToolboxSoftLink.cpp; sourceTree = "<group>"; };
416E995623DAEFF700E871CB /* VideoToolboxSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoToolboxSoftLink.h; sourceTree = "<group>"; };
442956CC218A72DE0080DB54 /* RevealSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RevealSPI.h; sourceTree = "<group>"; };
4450FC9D21F5F602004DFA56 /* QuickLookSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickLookSoftLink.mm; sourceTree = "<group>"; };
4450FC9E21F5F602004DFA56 /* QuickLookSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookSoftLink.h; sourceTree = "<group>"; };
@@ -521,8 +529,12 @@
0CF99CA51F73841C007EE793 /* cf */ = {
isa = PBXGroup;
children = (
416E995123DAE6BD00E871CB /* AudioToolboxSoftLink.cpp */,
416E995223DAE6BE00E871CB /* AudioToolboxSoftLink.h */,
0CF99CA61F738436007EE793 /* CoreMediaSoftLink.cpp */,
0CF99CA71F738437007EE793 /* CoreMediaSoftLink.h */,
416E995523DAEFF700E871CB /* VideoToolboxSoftLink.cpp */,
416E995623DAEFF700E871CB /* VideoToolboxSoftLink.h */,
);
path = cf;
sourceTree = "<group>";
@@ -712,6 +724,7 @@
files = (
57FD318B22B35989008D0E8B /* AppSSOSoftLink.h in Headers */,
576CA9D622B854AB0030143C /* AppSSOSPI.h in Headers */,
416E995423DAE6BE00E871CB /* AudioToolboxSoftLink.h in Headers */,
2D02E93C2056FAA700A13797 /* AudioToolboxSPI.h in Headers */,
572A107822B456F500F410C8 /* AuthKitSPI.h in Headers */,
077E87B2226A460300A2AFF0 /* AVFoundationSoftLink.h in Headers */,
@@ -834,6 +847,7 @@
2E1342CC215AA10A007199D2 /* UIKitSoftLink.h in Headers */,
0C5AF9221F43A4C7002EAC02 /* UIKitSPI.h in Headers */,
0C2DA1471F3BEB4900DBC317 /* URLFormattingSPI.h in Headers */,
416E995823DAEFF800E871CB /* VideoToolboxSoftLink.h in Headers */,
0C2DA1591F3BEB4900DBC317 /* WebFilterEvaluatorSPI.h in Headers */,
A10826F91F576292004772AC /* WebPanel.h in Headers */,
);
@@ -926,6 +940,7 @@
buildActionMask = 2147483647;
files = (
57FD318A22B3593E008D0E8B /* AppSSOSoftLink.mm in Sources */,
416E995323DAE6BE00E871CB /* AudioToolboxSoftLink.cpp in Sources */,
077E87B1226A460200A2AFF0 /* AVFoundationSoftLink.mm in Sources */,
0C5FFF0F1F78D9DA009EFF1A /* ClockCM.mm in Sources */,
0CF99CA81F738437007EE793 /* CoreMediaSoftLink.cpp in Sources */,
@@ -952,6 +967,7 @@
A3AB6E571F3D1DDB009C14B1 /* SystemSleepListener.cpp in Sources */,
A3AB6E651F3D217F009C14B1 /* SystemSleepListenerMac.mm in Sources */,
2E1342CD215AA10A007199D2 /* UIKitSoftLink.mm in Sources */,
416E995723DAEFF800E871CB /* VideoToolboxSoftLink.cpp in Sources */,
A10826FA1F576292004772AC /* WebPanel.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"

#if USE(AVFOUNDATION)

#include <AudioToolbox/AudioConverter.h>
#include <AudioToolbox/AudioFormat.h>

#include <wtf/SoftLinking.h>

SOFT_LINK_FRAMEWORK_FOR_SOURCE(PAL, AudioToolbox)

SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, AudioToolbox, AudioFormatGetProperty, OSStatus, (AudioFormatPropertyID inPropertyID, UInt32 inSpecifierSize, const void* inSpecifier, UInt32* ioPropertyDataSize, void* outPropertyData), (inPropertyID, inSpecifierSize, inSpecifier, ioPropertyDataSize, outPropertyData))
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, AudioToolbox, AudioConverterNew, OSStatus, (const AudioStreamBasicDescription* inSourceFormat, const AudioStreamBasicDescription* inDestinationFormat, AudioConverterRef* outAudioConverter), (inSourceFormat, inDestinationFormat, outAudioConverter))
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, AudioToolbox, AudioConverterSetProperty, OSStatus, (AudioConverterRef inAudioConverter, AudioConverterPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData), (inAudioConverter, inPropertyID, inPropertyDataSize, inPropertyData))
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, AudioToolbox, AudioConverterGetProperty, OSStatus, (AudioConverterRef inAudioConverter, AudioConverterPropertyID inPropertyID, UInt32* ioPropertyDataSize, void* outPropertyData), (inAudioConverter, inPropertyID, ioPropertyDataSize, outPropertyData))

#endif // USE(AVFOUNDATION)

0 comments on commit 6501c2e

Please sign in to comment.