iOS: Get WebRTC building for Mac Catalyst
- Add an option for disabling the OpenGL renderer - Change the build script to use correct header location - Use Metal compatibility for h264 CoreVideo buffers Bug: webrtc:11516 Change-Id: Ia34a9305648e75904ac36e69593ffefedd833bfb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224200 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34426}
This commit is contained in:
parent
fd954fcec7
commit
53d3fc9b1c
@ -345,10 +345,12 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"../sdk:metal_objc",
|
"../sdk:metal_objc",
|
||||||
"../sdk:peerconnectionfactory_base_objc",
|
"../sdk:peerconnectionfactory_base_objc",
|
||||||
"../sdk:peerconnectionfactory_base_objc",
|
"../sdk:peerconnectionfactory_base_objc",
|
||||||
"../sdk:ui_objc",
|
|
||||||
"../sdk:videocapture_objc",
|
"../sdk:videocapture_objc",
|
||||||
"../sdk:videocodec_objc",
|
"../sdk:videocodec_objc",
|
||||||
]
|
]
|
||||||
|
if (rtc_ios_macos_use_opengl_rendering) {
|
||||||
|
deps += [ "../sdk:opengl_ui_objc" ]
|
||||||
|
}
|
||||||
|
|
||||||
frameworks = [ "AVFoundation.framework" ]
|
frameworks = [ "AVFoundation.framework" ]
|
||||||
}
|
}
|
||||||
@ -499,13 +501,12 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"../sdk:helpers_objc",
|
"../sdk:helpers_objc",
|
||||||
"../sdk:metal_objc",
|
"../sdk:metal_objc",
|
||||||
"../sdk:native_api",
|
"../sdk:native_api",
|
||||||
"../sdk:ui_objc",
|
|
||||||
"../sdk:videocapture_objc",
|
"../sdk:videocapture_objc",
|
||||||
"../sdk:videotoolbox_objc",
|
"../sdk:videotoolbox_objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (current_cpu == "arm64") {
|
if (rtc_ios_macos_use_opengl_rendering) {
|
||||||
deps += [ "../sdk:metal_objc" ]
|
deps += [ "../sdk:opengl_ui_objc" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,9 +544,9 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"../sdk:helpers_objc",
|
"../sdk:helpers_objc",
|
||||||
"../sdk:mediaconstraints_objc",
|
"../sdk:mediaconstraints_objc",
|
||||||
"../sdk:metal_objc",
|
"../sdk:metal_objc",
|
||||||
|
"../sdk:opengl_ui_objc",
|
||||||
"../sdk:peerconnectionfactory_base_objc",
|
"../sdk:peerconnectionfactory_base_objc",
|
||||||
"../sdk:peerconnectionfactory_base_objc",
|
"../sdk:peerconnectionfactory_base_objc",
|
||||||
"../sdk:ui_objc",
|
|
||||||
"../sdk:videocapture_objc",
|
"../sdk:videocapture_objc",
|
||||||
"../sdk:videocodec_objc",
|
"../sdk:videocodec_objc",
|
||||||
]
|
]
|
||||||
|
|||||||
37
sdk/BUILD.gn
37
sdk/BUILD.gn
@ -434,7 +434,7 @@ if (is_ios || is_mac) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_library("video_objc") {
|
rtc_library("opengl_objc") {
|
||||||
sources = [
|
sources = [
|
||||||
"objc/components/renderer/opengl/RTCDefaultShader.h",
|
"objc/components/renderer/opengl/RTCDefaultShader.h",
|
||||||
"objc/components/renderer/opengl/RTCDefaultShader.mm",
|
"objc/components/renderer/opengl/RTCDefaultShader.mm",
|
||||||
@ -490,7 +490,7 @@ if (is_ios || is_mac) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_library("ui_objc") {
|
rtc_library("opengl_ui_objc") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
allow_poison = [
|
allow_poison = [
|
||||||
"audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
|
"audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
|
||||||
@ -519,12 +519,27 @@ if (is_ios || is_mac) {
|
|||||||
":base_objc",
|
":base_objc",
|
||||||
":helpers_objc",
|
":helpers_objc",
|
||||||
":metal_objc",
|
":metal_objc",
|
||||||
":video_objc",
|
":opengl_objc",
|
||||||
":videocapture_objc",
|
":videocapture_objc",
|
||||||
":videoframebuffer_objc",
|
":videoframebuffer_objc",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# For backward compatibility.
|
||||||
|
rtc_source_set("video_objc") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
public_deps = [ ":opengl_objc" ] # no-presubmit-check TODO(webrtc:8603)
|
||||||
|
}
|
||||||
|
rtc_source_set("ui_objc") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
allow_poison = [
|
||||||
|
"audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
|
||||||
|
"default_task_queue",
|
||||||
|
]
|
||||||
|
public_deps = # no-presubmit-check TODO(webrtc:8603)
|
||||||
|
[ ":opengl_ui_objc" ]
|
||||||
|
}
|
||||||
|
|
||||||
rtc_library("metal_objc") {
|
rtc_library("metal_objc") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
allow_poison = [
|
allow_poison = [
|
||||||
@ -563,7 +578,6 @@ if (is_ios || is_mac) {
|
|||||||
deps = [
|
deps = [
|
||||||
":base_objc",
|
":base_objc",
|
||||||
":peerconnectionfactory_base_objc",
|
":peerconnectionfactory_base_objc",
|
||||||
":video_objc",
|
|
||||||
":videoframebuffer_objc",
|
":videoframebuffer_objc",
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
"../api/video:video_rtp_headers",
|
"../api/video:video_rtp_headers",
|
||||||
@ -611,7 +625,6 @@ if (is_ios || is_mac) {
|
|||||||
deps = [
|
deps = [
|
||||||
":base_objc",
|
":base_objc",
|
||||||
":helpers_objc",
|
":helpers_objc",
|
||||||
":video_objc",
|
|
||||||
":videoframebuffer_objc",
|
":videoframebuffer_objc",
|
||||||
"../rtc_base/system:gcd_helpers",
|
"../rtc_base/system:gcd_helpers",
|
||||||
]
|
]
|
||||||
@ -983,7 +996,6 @@ if (is_ios || is_mac) {
|
|||||||
":mediasource_objc",
|
":mediasource_objc",
|
||||||
":native_api",
|
":native_api",
|
||||||
":native_video",
|
":native_video",
|
||||||
":video_objc",
|
|
||||||
":videoframebuffer_objc",
|
":videoframebuffer_objc",
|
||||||
":videorendereradapter_objc",
|
":videorendereradapter_objc",
|
||||||
":videosource_objc",
|
":videosource_objc",
|
||||||
@ -1071,7 +1083,6 @@ if (is_ios || is_mac) {
|
|||||||
":native_api_audio_device_module",
|
":native_api_audio_device_module",
|
||||||
":native_video",
|
":native_video",
|
||||||
":peerconnectionfactory_base_objc",
|
":peerconnectionfactory_base_objc",
|
||||||
":video_objc",
|
|
||||||
":video_toolbox_cc",
|
":video_toolbox_cc",
|
||||||
":videocapture_objc",
|
":videocapture_objc",
|
||||||
":videocodec_objc",
|
":videocodec_objc",
|
||||||
@ -1090,6 +1101,10 @@ if (is_ios || is_mac) {
|
|||||||
"//third_party/libyuv",
|
"//third_party/libyuv",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (rtc_ios_macos_use_opengl_rendering) {
|
||||||
|
deps += [ ":opengl_objc" ]
|
||||||
|
}
|
||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
"//build/config/ios:xctest",
|
"//build/config/ios:xctest",
|
||||||
"//third_party/ocmock",
|
"//third_party/ocmock",
|
||||||
@ -1181,7 +1196,6 @@ if (is_ios || is_mac) {
|
|||||||
":native_api",
|
":native_api",
|
||||||
":native_video",
|
":native_video",
|
||||||
":peerconnectionfactory_base_objc",
|
":peerconnectionfactory_base_objc",
|
||||||
":video_objc",
|
|
||||||
":videocapture_objc",
|
":videocapture_objc",
|
||||||
":videocodec_objc",
|
":videocodec_objc",
|
||||||
":videoframebuffer_objc",
|
":videoframebuffer_objc",
|
||||||
@ -1324,12 +1338,14 @@ if (is_ios || is_mac) {
|
|||||||
":native_api",
|
":native_api",
|
||||||
":native_video",
|
":native_video",
|
||||||
":peerconnectionfactory_base_objc",
|
":peerconnectionfactory_base_objc",
|
||||||
":ui_objc",
|
|
||||||
":videocapture_objc",
|
":videocapture_objc",
|
||||||
":videocodec_objc",
|
":videocodec_objc",
|
||||||
":videotoolbox_objc",
|
":videotoolbox_objc",
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
]
|
]
|
||||||
|
if (rtc_ios_macos_use_opengl_rendering) {
|
||||||
|
deps += [ ":opengl_ui_objc" ]
|
||||||
|
}
|
||||||
if (!build_with_chromium) {
|
if (!build_with_chromium) {
|
||||||
deps += [
|
deps += [
|
||||||
":callback_logger_objc",
|
":callback_logger_objc",
|
||||||
@ -1341,7 +1357,6 @@ if (is_ios || is_mac) {
|
|||||||
"AVFoundation.framework",
|
"AVFoundation.framework",
|
||||||
"CoreGraphics.framework",
|
"CoreGraphics.framework",
|
||||||
"CoreMedia.framework",
|
"CoreMedia.framework",
|
||||||
"GLKit.framework",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [
|
configs += [
|
||||||
@ -1454,8 +1469,8 @@ if (is_ios || is_mac) {
|
|||||||
":default_codec_factory_objc",
|
":default_codec_factory_objc",
|
||||||
":native_api",
|
":native_api",
|
||||||
":native_video",
|
":native_video",
|
||||||
|
":opengl_ui_objc",
|
||||||
":peerconnectionfactory_base_objc",
|
":peerconnectionfactory_base_objc",
|
||||||
":ui_objc",
|
|
||||||
":videocapture_objc",
|
":videocapture_objc",
|
||||||
":videocodec_objc",
|
":videocodec_objc",
|
||||||
":videotoolbox_objc",
|
":videotoolbox_objc",
|
||||||
|
|||||||
@ -209,7 +209,9 @@ void decompressionOutputCallback(void *decoderRef,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CFTypeRef keys[attributesSize] = {
|
CFTypeRef keys[attributesSize] = {
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS) && TARGET_OS_MACCATALYST
|
||||||
|
kCVPixelBufferMetalCompatibilityKey,
|
||||||
|
#elif defined(WEBRTC_IOS)
|
||||||
kCVPixelBufferOpenGLESCompatibilityKey,
|
kCVPixelBufferOpenGLESCompatibilityKey,
|
||||||
#elif defined(WEBRTC_MAC)
|
#elif defined(WEBRTC_MAC)
|
||||||
kCVPixelBufferOpenGLCompatibilityKey,
|
kCVPixelBufferOpenGLCompatibilityKey,
|
||||||
|
|||||||
@ -602,14 +602,15 @@ NSUInteger GetMaxSampleRate(const webrtc::H264ProfileLevelId &profile_level_id)
|
|||||||
// buffers retrieved from the encoder's pixel buffer pool.
|
// buffers retrieved from the encoder's pixel buffer pool.
|
||||||
const size_t attributesSize = 3;
|
const size_t attributesSize = 3;
|
||||||
CFTypeRef keys[attributesSize] = {
|
CFTypeRef keys[attributesSize] = {
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS) && TARGET_OS_MACCATALYST
|
||||||
kCVPixelBufferOpenGLESCompatibilityKey,
|
kCVPixelBufferMetalCompatibilityKey,
|
||||||
|
#elif defined(WEBRTC_IOS)
|
||||||
|
kCVPixelBufferOpenGLESCompatibilityKey,
|
||||||
#elif defined(WEBRTC_MAC)
|
#elif defined(WEBRTC_MAC)
|
||||||
kCVPixelBufferOpenGLCompatibilityKey,
|
kCVPixelBufferOpenGLCompatibilityKey,
|
||||||
#endif
|
#endif
|
||||||
kCVPixelBufferIOSurfacePropertiesKey,
|
kCVPixelBufferIOSurfacePropertiesKey,
|
||||||
kCVPixelBufferPixelFormatTypeKey
|
kCVPixelBufferPixelFormatTypeKey};
|
||||||
};
|
|
||||||
CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
|
CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
|
||||||
int64_t pixelFormatType = framePixelFormat;
|
int64_t pixelFormatType = framePixelFormat;
|
||||||
CFNumberRef pixelFormat = CFNumberCreate(nullptr, kCFNumberLongType, &pixelFormatType);
|
CFNumberRef pixelFormat = CFNumberCreate(nullptr, kCFNumberLongType, &pixelFormatType);
|
||||||
|
|||||||
12
webrtc.gni
12
webrtc.gni
@ -183,6 +183,10 @@ declare_args() {
|
|||||||
rtc_apprtcmobile_broadcast_extension = false
|
rtc_apprtcmobile_broadcast_extension = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Determines whether OpenGL is available on iOS/macOS.
|
||||||
|
rtc_ios_macos_use_opengl_rendering =
|
||||||
|
!(is_ios && target_environment == "catalyst")
|
||||||
|
|
||||||
# When set to false, builtin audio encoder/decoder factories and all the
|
# When set to false, builtin audio encoder/decoder factories and all the
|
||||||
# audio codecs they depend on will not be included in libwebrtc.{a|lib}
|
# audio codecs they depend on will not be included in libwebrtc.{a|lib}
|
||||||
# (they will still be included in libjingle_peerconnection_so.so and
|
# (they will still be included in libjingle_peerconnection_so.so and
|
||||||
@ -992,10 +996,16 @@ if (is_ios) {
|
|||||||
deps = [ ":create_bracket_include_headers_$this_target_name" ]
|
deps = [ ":create_bracket_include_headers_$this_target_name" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (target_environment == "catalyst") {
|
||||||
|
# Catalyst frameworks use the same layout as regular Mac frameworks.
|
||||||
|
headers_dir = "Versions/A/Headers"
|
||||||
|
} else {
|
||||||
|
headers_dir = "Headers"
|
||||||
|
}
|
||||||
copy("copy_umbrella_header_$target_name") {
|
copy("copy_umbrella_header_$target_name") {
|
||||||
sources = [ umbrella_header_path ]
|
sources = [ umbrella_header_path ]
|
||||||
outputs =
|
outputs =
|
||||||
[ "$root_out_dir/$output_name.framework/Headers/$output_name.h" ]
|
[ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ]
|
||||||
|
|
||||||
deps = [ ":umbrella_header_$target_name" ]
|
deps = [ ":umbrella_header_$target_name" ]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user