Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm

Issue 2944643002: Support building WebRTC without audio and video for IOS (Closed)
Patch Set: Format Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/sdk/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
diff --git a/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm b/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
index a883587af26516979507fec961502d6229453560..7accdbbe38752ea85c0b9ae93e2c410f74d152a9 100644
--- a/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
+++ b/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
@@ -24,6 +24,12 @@
#include "Video/objcvideotracksource.h"
#include "VideoToolbox/videocodecfactory.h"
#include "webrtc/api/videosourceproxy.h"
+// 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 "webrtc/media/engine/webrtcmediaengine.h" // nogncheck
@implementation RTCPeerConnectionFactory {
std::unique_ptr<rtc::Thread> _networkThread;
@@ -47,7 +53,21 @@
_signalingThread = rtc::Thread::Create();
result = _signalingThread->Start();
NSAssert(result, @"Failed to start signaling thread.");
-
+#ifdef HAVE_NO_MEDIA
+ _nativeFactory = webrtc::CreateModularPeerConnectionFactory(
+ _networkThread.get(),
+ _workerThread.get(),
+ _signalingThread.get(),
+ nullptr, // default_adm
+ nullptr, // audio_encoder_factory
+ nullptr, // audio_decoder_factory
+ nullptr, // video_encoder_factory
+ nullptr, // video_decoder_factory
+ nullptr, // audio_mixer
+ std::unique_ptr<cricket::MediaEngineInterface>(),
+ std::unique_ptr<webrtc::CallFactoryInterface>(),
+ std::unique_ptr<webrtc::RtcEventLogFactoryInterface>());
+#else
const auto encoder_factory = new webrtc::VideoToolboxVideoEncoderFactory();
const auto decoder_factory = new webrtc::VideoToolboxVideoDecoderFactory();
@@ -56,6 +76,7 @@
_nativeFactory = webrtc::CreatePeerConnectionFactory(
_networkThread.get(), _workerThread.get(), _signalingThread.get(),
nullptr, encoder_factory, decoder_factory);
+#endif
NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
}
return self;
@@ -85,8 +106,11 @@
- (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
(nullable RTCMediaConstraints *)constraints {
- return [[RTCAVFoundationVideoSource alloc] initWithFactory:self
- constraints:constraints];
+#ifdef HAVE_NO_MEDIA
+ return nil;
+#else
+ return [[RTCAVFoundationVideoSource alloc] initWithFactory:self constraints:constraints];
+#endif
}
- (RTCVideoSource *)videoSource {
« no previous file with comments | « webrtc/sdk/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698