Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Some changes for building with OWT.
Browse files Browse the repository at this point in the history
  • Loading branch information
jianjunz committed Jul 24, 2019
1 parent 9863f3d commit 7550929
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 16 deletions.
23 changes: 21 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@ config("common_inherited_config") {
target_gen_dir,
]
}
if (build_with_owt) {
include_dirs = [
# The overrides must be included first as that is the mechanism for
# selecting the override headers in Chromium.
#"../webrtc_overrides",

# Allow includes to be prefixed with webrtc/ in case it is not an
# immediate subdirectory of the top-level.
".",

# Just like the root WebRTC directory is added to include path, the
# corresponding directory tree with generated files needs to be added too.
# Note: this path does not change depending on the current target, e.g.
# it is always "//gen/third_party/webrtc" when building with Chromium.
# See also: http://cs.chromium.org/?q=%5C"default_include_dirs
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir
target_gen_dir,
]
}
if (is_posix || is_fuchsia) {
defines += [ "WEBRTC_POSIX" ]
}
Expand Down Expand Up @@ -245,7 +264,7 @@ config("common_config") {
defines += [ "WEBRTC_USE_H264" ]
}

if (build_with_chromium) {
if (build_with_chromium || build_with_owt) {
defines += [
# NOTICE: Since common_inherited_config is used in public_configs for our
# targets, there's no point including the defines in that config here.
Expand Down Expand Up @@ -382,7 +401,7 @@ if (!build_with_chromium) {
# Target to build all the WebRTC production code.
rtc_static_library("webrtc") {
# Only the root target should depend on this.
visibility = [ "//:default" ]
visibility = [ ".:default" ]

sources = []
complete_static_lib = true
Expand Down
4 changes: 2 additions & 2 deletions examples/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if (rtc_include_tests) {
deps = [
":read_auth_file",
"../test:test_main",
"//test:test_support",
"../test:test_support",
"//testing/gtest",
]
}
Expand Down Expand Up @@ -618,7 +618,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
":AppRTCMobile_lib",
":apprtcmobile_test_sources",
"../sdk:framework_objc",
"//test:test_support",
"../test:test_support",
]
ldflags = [ "-all_load" ]
}
Expand Down
1 change: 1 addition & 0 deletions rtc_base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ rtc_static_library("rtc_numerics") {
}

rtc_source_set("rtc_json") {
visibility = [ "*", "//talk/owt:owt_deps" ]
defines = []
sources = [
"strings/json.cc",
Expand Down
14 changes: 7 additions & 7 deletions sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ if (is_ios || is_mac) {
]
deps = [
":base_objc",
"//api/video:video_frame",
"//api/video:video_frame_i420",
"//common_video",
"//rtc_base:checks",
"//rtc_base:rtc_base_approved",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../common_video",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"//third_party/libyuv",
]
configs += [
Expand Down Expand Up @@ -1119,7 +1119,7 @@ if (is_ios || is_mac) {
":peerconnectionfactory_base_objc",
":sdk_unittests_bundle_data",
":sdk_unittests_sources",
"//test:test_support",
"../test:test_support",
]
ldflags = [ "-all_load" ]
}
Expand All @@ -1137,7 +1137,7 @@ if (is_ios || is_mac) {
deps = [
":framework_objc+link",
":ios_framework_bundle",
"//test:test_support",
"../test:test_support",
]
}
}
Expand Down
4 changes: 4 additions & 0 deletions sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class NetworkControllerFactoryInterface;
class VideoEncoderFactory;
class VideoDecoderFactory;
class AudioProcessing;
class PeerConnectionFactoryInterface;

} // namespace webrtc

Expand Down Expand Up @@ -87,6 +88,9 @@ NS_ASSUME_NONNULL_BEGIN
decoderFactory:(nullable id<RTCVideoDecoderFactory>)decoderFactory
mediaTransportFactory:
(std::unique_ptr<webrtc::MediaTransportFactory>)mediaTransportFactory;

- (instancetype)initWithNativePeerConnectionFactory:(
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>)factory;
@end

NS_ASSUME_NONNULL_END
7 changes: 7 additions & 0 deletions sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ - (instancetype)initWithNativeAudioEncoderFactory:
}
return self;
}
- (instancetype)initWithNativePeerConnectionFactory:
(rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>)factory {
if (self = [self initNative]) {
_nativeFactory = factory;
}
return self;
}

- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints {
std::unique_ptr<webrtc::MediaConstraints> nativeConstraints;
Expand Down
5 changes: 4 additions & 1 deletion sdk/objc/native/src/objc_video_decoder_factory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ int32_t RegisterDecodeCompleteCallback(DecodedImageCallback *callback) override
if ([codecName isEqualToString:codecInfo.name]) {
id<RTCVideoDecoder> decoder = [decoder_factory_ createDecoder:codecInfo];

if ([decoder isKindOfClass:[RTCWrappedNativeVideoDecoder class]]) {
// Because of symbol conflict, isKindOfClass doesn't work as expected.
// See https://bugs.webkit.org/show_bug.cgi?id=198782.
// if ([decoder isKindOfClass:[RTCWrappedNativeVideoDecoder class]]) {
if ([codecName isEqual:@"VP8"] || [codecName isEqual:@"VP9"]) {
return [(RTCWrappedNativeVideoDecoder *)decoder releaseWrappedDecoder];
} else {
return std::unique_ptr<ObjCVideoDecoder>(new ObjCVideoDecoder(decoder));
Expand Down
5 changes: 4 additions & 1 deletion sdk/objc/native/src/objc_video_encoder_factory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ void SetRates(const RateControlParameters &parameters) override {
const SdpVideoFormat &format) {
RTCVideoCodecInfo *info = [[RTCVideoCodecInfo alloc] initWithNativeSdpVideoFormat:format];
id<RTCVideoEncoder> encoder = [encoder_factory_ createEncoder:info];
if ([encoder isKindOfClass:[RTCWrappedNativeVideoEncoder class]]) {
// Because of symbol conflict, isKindOfClass doesn't work as expected.
// See https://bugs.webkit.org/show_bug.cgi?id=198782.
// if ([encoder isKindOfClass:[RTCWrappedNativeVideoEncoder class]]) {
if ([info.name isEqual:@"VP8"] || [info.name isEqual:@"VP9"]) {
return [(RTCWrappedNativeVideoEncoder *)encoder releaseWrappedEncoder];
} else {
return std::unique_ptr<ObjCVideoEncoder>(new ObjCVideoEncoder(encoder));
Expand Down
6 changes: 3 additions & 3 deletions webrtc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ if (is_ios) {
action("umbrella_header_$target_name") {
forward_variables_from(invoker, [ "public_headers" ])

script = "//tools_webrtc/ios/generate_umbrella_header.py"
script = "../tools_webrtc/ios/generate_umbrella_header.py"

outputs = [
umbrella_header_path,
Expand Down Expand Up @@ -769,7 +769,7 @@ if (is_mac) {
}

action("modulemap_$this_target_name") {
script = "//tools_webrtc/ios/generate_modulemap.py"
script = "../tools_webrtc/ios/generate_modulemap.py"
args = [
"--out",
rebase_path(modulemap_path, root_build_dir),
Expand All @@ -796,7 +796,7 @@ if (is_mac) {
action("umbrella_header_$this_target_name") {
forward_variables_from(invoker, [ "sources" ])

script = "//tools_webrtc/ios/generate_umbrella_header.py"
script = "../tools_webrtc/ios/generate_umbrella_header.py"

outputs = [
umbrella_header_path,
Expand Down

0 comments on commit 7550929

Please sign in to comment.