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

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

Issue 2944643002: Support building WebRTC without audio and video for IOS (Closed)
Patch Set: Cleaner solution. 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
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..273d4ff8d167dc70e5ab2e6307e0d3b8cd6673d9 100644
--- a/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
+++ b/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
@@ -25,40 +25,18 @@
#include "VideoToolbox/videocodecfactory.h"
#include "webrtc/api/videosourceproxy.h"
-@implementation RTCPeerConnectionFactory {
- std::unique_ptr<rtc::Thread> _networkThread;
- std::unique_ptr<rtc::Thread> _workerThread;
- std::unique_ptr<rtc::Thread> _signalingThread;
- BOOL _hasStartedAecDump;
-}
+@implementation RTCPeerConnectionFactory
@synthesize nativeFactory = _nativeFactory;
-- (instancetype)init {
- if ((self = [super init])) {
- _networkThread = rtc::Thread::CreateWithSocketServer();
- BOOL result = _networkThread->Start();
- NSAssert(result, @"Failed to start network thread.");
-
- _workerThread = rtc::Thread::Create();
- result = _workerThread->Start();
- NSAssert(result, @"Failed to start worker thread.");
-
- _signalingThread = rtc::Thread::Create();
- result = _signalingThread->Start();
- NSAssert(result, @"Failed to start signaling thread.");
-
- const auto encoder_factory = new webrtc::VideoToolboxVideoEncoderFactory();
- const auto decoder_factory = new webrtc::VideoToolboxVideoDecoderFactory();
-
- // Ownership of encoder/decoder factories is passed on to the
- // peerconnectionfactory, that handles deleting them.
- _nativeFactory = webrtc::CreatePeerConnectionFactory(
- _networkThread.get(), _workerThread.get(), _signalingThread.get(),
- nullptr, encoder_factory, decoder_factory);
- NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
- }
- return self;
+- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration
+ constraints:(RTCMediaConstraints *)constraints
+ delegate:
+ (nullable id<RTCPeerConnectionDelegate>)delegate {
+ return [[RTCPeerConnection alloc] initWithFactory:self
+ configuration:configuration
+ constraints:constraints
+ delegate:delegate];
}
- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints {
@@ -76,50 +54,8 @@
return [self audioTrackWithSource:audioSource trackId:trackId];
}
-- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source
- trackId:(NSString *)trackId {
- return [[RTCAudioTrack alloc] initWithFactory:self
- source:source
- trackId:trackId];
-}
-
-- (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
- (nullable RTCMediaConstraints *)constraints {
- return [[RTCAVFoundationVideoSource alloc] initWithFactory:self
- constraints:constraints];
-}
-
-- (RTCVideoSource *)videoSource {
- rtc::scoped_refptr<webrtc::ObjcVideoTrackSource> objcVideoTrackSource(
- new rtc::RefCountedObject<webrtc::ObjcVideoTrackSource>());
- return [[RTCVideoSource alloc]
- initWithNativeVideoSource:webrtc::VideoTrackSourceProxy::Create(_signalingThread.get(),
- _workerThread.get(),
- objcVideoTrackSource)];
-}
-
-- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source
- trackId:(NSString *)trackId {
- return [[RTCVideoTrack alloc] initWithFactory:self
- source:source
- trackId:trackId];
-}
-
-- (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId {
- return [[RTCMediaStream alloc] initWithFactory:self
- streamId:streamId];
-}
-
-- (RTCPeerConnection *)peerConnectionWithConfiguration:
- (RTCConfiguration *)configuration
- constraints:
- (RTCMediaConstraints *)constraints
- delegate:
- (nullable id<RTCPeerConnectionDelegate>)delegate {
- return [[RTCPeerConnection alloc] initWithFactory:self
- configuration:configuration
- constraints:constraints
- delegate:delegate];
+- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source trackId:(NSString *)trackId {
+ return [[RTCAudioTrack alloc] initWithFactory:self source:source trackId:trackId];
}
- (BOOL)startAecDumpWithFilePath:(NSString *)filePath

Powered by Google App Engine
This is Rietveld 408576698