Remove HAVE_NO_MEDIA from Obj-C API.

This build configuration is not really supported/tested.

Bug: b/36882554
Change-Id: I8b5b2c93b1cf5e4d6627183c5449437e4589a5ea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266741
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37322}
This commit is contained in:
Mirko Bonadei
2022-06-24 10:00:49 +02:00
committed by WebRTC LUCI CQ
parent a5ec3c00b9
commit 2fdf222da3
3 changed files with 8 additions and 63 deletions

View File

@ -758,34 +758,6 @@ if (is_ios || is_mac) {
}
}
# Build the PeerConnectionFactory without audio/video support.
# This target depends on the objc_peeerconnectionfactory_base which still
# includes some audio/video related objects such as RTCAudioSource because
# these objects are just thin wrappers of native C++ interfaces required
# when implementing webrtc::PeerConnectionFactoryInterface and
# webrtc::PeerConnectionInterface.
# The applications which only use WebRTC DataChannel can depend on this.
rtc_library("peerconnectionfactory_no_media_objc") {
visibility = [ "*" ]
allow_poison = [
"audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
"default_task_queue",
]
defines = [ "HAVE_NO_MEDIA" ]
sources = [ "objc/helpers/noop.mm" ]
public_configs = [ ":common_config_objc" ]
deps = [
":native_api",
":native_video",
":peerconnectionfactory_base_objc",
"../api:libjingle_peerconnection_api",
"../rtc_base",
]
}
rtc_library("mediaconstraints_objc") {
configs += [ "..:no_global_constructors" ]
sources = [
@ -1030,6 +1002,7 @@ if (is_ios || is_mac) {
"../api/video:video_rtp_headers",
"../api/video_codecs:video_codecs_api",
"../common_video",
"../media:rtc_audio_video",
"../media:rtc_media_base",
"../modules/audio_device:audio_device_api",
"../modules/audio_processing",

View File

@ -30,36 +30,26 @@
#include "sdk/objc/native/api/ssl_certificate_verifier.h"
#include "system_wrappers/include/field_trial.h"
#ifndef HAVE_NO_MEDIA
#import "components/video_codec/RTCVideoDecoderFactoryH264.h"
#import "components/video_codec/RTCVideoEncoderFactoryH264.h"
// The no-media version PeerConnectionFactory doesn't depend on these files, but the gn check tool
// is not smart enough to take the #ifdef into account.
#include "api/audio_codecs/builtin_audio_decoder_factory.h" // nogncheck
#include "api/audio_codecs/builtin_audio_encoder_factory.h" // nogncheck
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/transport/field_trial_based_config.h"
#include "modules/audio_device/include/audio_device.h" // nogncheck
#include "modules/audio_processing/include/audio_processing.h" // nogncheck
#import "components/video_codec/RTCVideoDecoderFactoryH264.h"
#import "components/video_codec/RTCVideoEncoderFactoryH264.h"
#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "sdk/objc/native/api/video_decoder_factory.h"
#include "sdk/objc/native/api/video_encoder_factory.h"
#include "sdk/objc/native/src/objc_video_decoder_factory.h"
#include "sdk/objc/native/src/objc_video_encoder_factory.h"
#endif
#if defined(WEBRTC_IOS)
#import "sdk/objc/native/api/audio_device_module.h"
#endif
// Adding the nogncheck to disable the including header check.
// The no-media version PeerConnectionFactory doesn't depend on media related
// C++ target.
// TODO(zhihuang): Remove nogncheck once MediaEngineInterface is moved to C++
// API layer.
#include "media/engine/webrtc_media_engine.h" // nogncheck
@implementation RTC_OBJC_TYPE (RTCPeerConnectionFactory) {
std::unique_ptr<rtc::Thread> _networkThread;
std::unique_ptr<rtc::Thread> _workerThread;
@ -78,9 +68,6 @@
}
- (instancetype)init {
#ifdef HAVE_NO_MEDIA
return [self initWithNoMedia];
#else
return [self
initWithNativeAudioEncoderFactory:webrtc::CreateBuiltinAudioEncoderFactory()
nativeAudioDecoderFactory:webrtc::CreateBuiltinAudioDecoderFactory()
@ -90,15 +77,11 @@
RTCVideoDecoderFactoryH264) alloc] init])
audioDeviceModule:[self audioDeviceModule].get()
audioProcessingModule:nullptr];
#endif
}
- (instancetype)
initWithEncoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory
decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory {
#ifdef HAVE_NO_MEDIA
return [self initWithNoMedia];
#else
std::unique_ptr<webrtc::VideoEncoderFactory> native_encoder_factory;
std::unique_ptr<webrtc::VideoDecoderFactory> native_decoder_factory;
if (encoderFactory) {
@ -113,7 +96,6 @@
nativeVideoDecoderFactory:std::move(native_decoder_factory)
audioDeviceModule:[self audioDeviceModule].get()
audioProcessingModule:nullptr];
#endif
}
- (instancetype)initNative {
if (self = [super init]) {
@ -191,7 +173,6 @@
if (webrtc::field_trial::IsEnabled("WebRTC-Network-UseNWPathMonitor")) {
dependencies.network_monitor_factory = webrtc::CreateNetworkMonitorFactory();
}
#ifndef HAVE_NO_MEDIA
dependencies.task_queue_factory = webrtc::CreateDefaultTaskQueueFactory();
dependencies.trials = std::make_unique<webrtc::FieldTrialBasedConfig>();
cricket::MediaEngineDependencies media_deps;
@ -212,7 +193,6 @@
dependencies.event_log_factory =
std::make_unique<webrtc::RtcEventLogFactory>(dependencies.task_queue_factory.get());
dependencies.network_controller_factory = std::move(networkControllerFactory);
#endif
_nativeFactory = webrtc::CreateModularPeerConnectionFactory(std::move(dependencies));
NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
}

View File

@ -39,9 +39,6 @@ extern "C" {
- (void)testBuilder {
id factoryMock = OCMStrictClassMock([RTC_OBJC_TYPE(RTCPeerConnectionFactory) class]);
OCMExpect([factoryMock alloc]).andReturn(factoryMock);
#ifdef HAVE_NO_MEDIA
RTC_UNUSED([[[factoryMock expect] andReturn:factoryMock] initWithNoMedia]);
#else
RTC_UNUSED([[[[factoryMock expect] andReturn:factoryMock] ignoringNonObjectArgs]
initWithNativeAudioEncoderFactory:nullptr
nativeAudioDecoderFactory:nullptr
@ -49,7 +46,6 @@ extern "C" {
nativeVideoDecoderFactory:nullptr
audioDeviceModule:nullptr
audioProcessingModule:nullptr]);
#endif
RTCPeerConnectionFactoryBuilder* builder = [[RTCPeerConnectionFactoryBuilder alloc] init];
RTC_OBJC_TYPE(RTCPeerConnectionFactory)* peerConnectionFactory =
[builder createPeerConnectionFactory];
@ -60,9 +56,6 @@ extern "C" {
- (void)testDefaultComponentsBuilder {
id factoryMock = OCMStrictClassMock([RTC_OBJC_TYPE(RTCPeerConnectionFactory) class]);
OCMExpect([factoryMock alloc]).andReturn(factoryMock);
#ifdef HAVE_NO_MEDIA
RTC_UNUSED([[[factoryMock expect] andReturn:factoryMock] initWithNoMedia]);
#else
RTC_UNUSED([[[[factoryMock expect] andReturn:factoryMock] ignoringNonObjectArgs]
initWithNativeAudioEncoderFactory:nullptr
nativeAudioDecoderFactory:nullptr
@ -70,7 +63,6 @@ extern "C" {
nativeVideoDecoderFactory:nullptr
audioDeviceModule:nullptr
audioProcessingModule:nullptr]);
#endif
RTCPeerConnectionFactoryBuilder* builder = [RTCPeerConnectionFactoryBuilder defaultBuilder];
RTC_OBJC_TYPE(RTCPeerConnectionFactory)* peerConnectionFactory =
[builder createPeerConnectionFactory];