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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm

Issue 1968393002: Propogate network-worker thread split to api (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase including nits Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/webrtcsession_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "RTCPeerConnectionFactory+Private.h" 11 #import "RTCPeerConnectionFactory+Private.h"
12 12
13 #import "NSString+StdString.h" 13 #import "NSString+StdString.h"
14 #if defined(WEBRTC_IOS) 14 #if defined(WEBRTC_IOS)
15 #import "RTCAVFoundationVideoSource+Private.h" 15 #import "RTCAVFoundationVideoSource+Private.h"
16 #endif 16 #endif
17 #import "RTCAudioTrack+Private.h" 17 #import "RTCAudioTrack+Private.h"
18 #import "RTCMediaStream+Private.h" 18 #import "RTCMediaStream+Private.h"
19 #import "RTCPeerConnection+Private.h" 19 #import "RTCPeerConnection+Private.h"
20 #import "RTCVideoSource+Private.h" 20 #import "RTCVideoSource+Private.h"
21 #import "RTCVideoTrack+Private.h" 21 #import "RTCVideoTrack+Private.h"
22 22
23 #include <memory> 23 #include <memory>
24 24
25 @implementation RTCPeerConnectionFactory { 25 @implementation RTCPeerConnectionFactory {
26 std::unique_ptr<rtc::Thread> _networkThread;
27 std::unique_ptr<rtc::Thread> _workerThread;
26 std::unique_ptr<rtc::Thread> _signalingThread; 28 std::unique_ptr<rtc::Thread> _signalingThread;
27 std::unique_ptr<rtc::Thread> _workerThread;
28 } 29 }
29 30
30 @synthesize nativeFactory = _nativeFactory; 31 @synthesize nativeFactory = _nativeFactory;
31 32
32 - (instancetype)init { 33 - (instancetype)init {
33 if ((self = [super init])) { 34 if ((self = [super init])) {
34 _signalingThread.reset(new rtc::Thread()); 35 _networkThread = rtc::Thread::CreateWithSocketServer();
35 BOOL result = _signalingThread->Start(); 36 BOOL result = _networkThread->Start();
36 NSAssert(result, @"Failed to start signaling thread."); 37 NSAssert(result, @"Failed to start network thread.");
37 _workerThread.reset(new rtc::Thread()); 38
39 _workerThread = rtc::Thread::Create();
38 result = _workerThread->Start(); 40 result = _workerThread->Start();
39 NSAssert(result, @"Failed to start worker thread."); 41 NSAssert(result, @"Failed to start worker thread.");
40 42
43 _signalingThread = rtc::Thread::Create();
44 result = _signalingThread->Start();
45 NSAssert(result, @"Failed to start signaling thread.");
46
41 _nativeFactory = webrtc::CreatePeerConnectionFactory( 47 _nativeFactory = webrtc::CreatePeerConnectionFactory(
42 _workerThread.get(), _signalingThread.get(), nullptr, nullptr, nullptr); 48 _networkThread.get(), _workerThread.get(), _signalingThread.get(),
49 nullptr, nullptr, nullptr);
43 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); 50 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
44 } 51 }
45 return self; 52 return self;
46 } 53 }
47 54
48 - (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints: 55 - (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
49 (nullable RTCMediaConstraints *)constraints { 56 (nullable RTCMediaConstraints *)constraints {
50 #if defined(WEBRTC_IOS) 57 #if defined(WEBRTC_IOS)
51 return [[RTCAVFoundationVideoSource alloc] initWithFactory:self 58 return [[RTCAVFoundationVideoSource alloc] initWithFactory:self
52 constraints:constraints]; 59 constraints:constraints];
(...skipping 25 matching lines...) Expand all
78 (RTCMediaConstraints *)constraints 85 (RTCMediaConstraints *)constraints
79 delegate: 86 delegate:
80 (nullable id<RTCPeerConnectionDelegate>)delegate { 87 (nullable id<RTCPeerConnectionDelegate>)delegate {
81 return [[RTCPeerConnection alloc] initWithFactory:self 88 return [[RTCPeerConnection alloc] initWithFactory:self
82 configuration:configuration 89 configuration:configuration
83 constraints:constraints 90 constraints:constraints
84 delegate:delegate]; 91 delegate:delegate];
85 } 92 }
86 93
87 @end 94 @end
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698