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/225625@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Jun 5, 2020
1 parent c4c2a92 commit f804519046da41ad8cacf4d6fe9c27f6eac049a8
Showing with 1,671 additions and 299 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. +14 −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. +8 −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. +2 −0 Source/WebCore/SourcesCocoa.txt
  18. +12 −0 Source/WebCore/WebCore.xcodeproj/project.pbxproj
  19. +3 −2 Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp
  20. +2 −2 Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h
  21. +91 −0 Source/WebCore/platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h
  22. +502 −0 Source/WebCore/platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm
  23. +53 −23 Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h
  24. +345 −245 Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm
  25. +71 −0 Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h
  26. +167 −0 Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm
  27. +25 −0 Source/WebKit/ChangeLog
  28. +7 −3 Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
  29. +4 −0 Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h
  30. +2 −2 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp
  31. +2 −2 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.h
  32. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.messages.in
  33. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.cpp
  34. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.h
  35. +1 −1 Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in
  36. +1 −0 Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h
  37. +2 −2 Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp
  38. +2 −2 Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h
  39. +1 −1 Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp
@@ -1,3 +1,19 @@
2020-06-05 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-06-05 Antti Koivisto <antti@apple.com>

REGRESSION (r253875?): Element styles incorrect after media query evaluation changes
@@ -3298,7 +3298,10 @@ webgl/1.0.3/conformance/textures/texture-npot-video.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 ]

# WebGL 2 Conformance Suite rules for regular bots post ANGLE backend adoption.
# DEQP is skipped on the main fleet of bots because of the long run time.
@@ -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;

@@ -1708,6 +1708,10 @@ webkit.org/b/212172 [ Catalina ] fast/text/font-collection.html [ ImageOnlyFailu
[ 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-06-05 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-06-04 Jonathan Bedard <jbedard@apple.com>

WTF: Exclude MachExceptions.defs from all embedded builds
@@ -542,6 +542,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-06-05 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-06-05 Antti Koivisto <antti@apple.com>

REGRESSION (r253875?): Element styles incorrect after media query evaluation changes
@@ -34,7 +34,12 @@ namespace WebCore {

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

}
@@ -1,3 +1,21 @@
2020-06-05 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-06-04 Jacob Uphoff <jacob_uphoff@apple.com>

Unreviewed, reverting r262546.
@@ -119,6 +119,9 @@
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 */; };
41E1F344248A6A000022D5DE /* VideoToolboxSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E995523DAEFF700E871CB /* VideoToolboxSoftLink.cpp */; };
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 */; };
@@ -300,6 +303,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>"; };
@@ -541,8 +548,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>";
@@ -735,6 +746,7 @@
293EE4A924154F8F0047493D /* AccessibilitySupportSoftLink.h in Headers */,
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 */,
@@ -953,6 +965,7 @@
files = (
293EE4A824154F8F0047493D /* AccessibilitySupportSoftLink.cpp in Sources */,
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 */,
@@ -967,6 +980,7 @@
44E1A8B021FA54EB00C3048E /* LookupSoftLink.mm in Sources */,
5C7C787423AC3E770065F47E /* ManagedConfigurationSoftLink.mm in Sources */,
0CF99CA41F736375007EE793 /* MediaTimeAVFoundation.cpp in Sources */,
41E1F344248A6A000022D5DE /* VideoToolboxSoftLink.cpp in Sources */,
CDACB3602387425B0018D7CE /* MediaToolboxSoftLink.cpp in Sources */,
A1F63CA021A4DBF7006FB43B /* PassKitSoftLink.mm in Sources */,
A1175B4F1F6B337300C4B9F0 /* PopupMenu.mm in Sources */,
@@ -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 f804519

Please sign in to comment.