OLD | NEW |
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.h" | 11 #import "RTCPeerConnectionFactory+Private.h" |
12 | 12 |
| 13 #import "NSString+StdString.h" |
13 #if defined(WEBRTC_IOS) | 14 #if defined(WEBRTC_IOS) |
14 #import "webrtc/api/objc/RTCAVFoundationVideoSource+Private.h" | 15 #import "RTCAVFoundationVideoSource+Private.h" |
15 #endif | 16 #endif |
16 #import "webrtc/api/objc/RTCAudioTrack+Private.h" | 17 #import "RTCAudioTrack+Private.h" |
17 #import "webrtc/api/objc/RTCMediaStream+Private.h" | 18 #import "RTCMediaStream+Private.h" |
18 #import "webrtc/api/objc/RTCPeerConnection+Private.h" | 19 #import "RTCPeerConnection+Private.h" |
19 #import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h" | 20 #import "RTCVideoSource+Private.h" |
20 #import "webrtc/api/objc/RTCVideoSource+Private.h" | 21 #import "RTCVideoTrack+Private.h" |
21 #import "webrtc/api/objc/RTCVideoTrack+Private.h" | |
22 #import "webrtc/base/objc/NSString+StdString.h" | |
23 | 22 |
24 @implementation RTCPeerConnectionFactory { | 23 @implementation RTCPeerConnectionFactory { |
25 rtc::scoped_ptr<rtc::Thread> _signalingThread; | 24 rtc::scoped_ptr<rtc::Thread> _signalingThread; |
26 rtc::scoped_ptr<rtc::Thread> _workerThread; | 25 rtc::scoped_ptr<rtc::Thread> _workerThread; |
27 } | 26 } |
28 | 27 |
29 @synthesize nativeFactory = _nativeFactory; | 28 @synthesize nativeFactory = _nativeFactory; |
30 | 29 |
31 - (instancetype)init { | 30 - (instancetype)init { |
32 if ((self = [super init])) { | 31 if ((self = [super init])) { |
33 _signalingThread.reset(new rtc::Thread()); | 32 _signalingThread.reset(new rtc::Thread()); |
34 BOOL result = _signalingThread->Start(); | 33 BOOL result = _signalingThread->Start(); |
35 NSAssert(result, @"Failed to start signaling thread."); | 34 NSAssert(result, @"Failed to start signaling thread."); |
36 _workerThread.reset(new rtc::Thread()); | 35 _workerThread.reset(new rtc::Thread()); |
37 result = _workerThread->Start(); | 36 result = _workerThread->Start(); |
38 NSAssert(result, @"Failed to start worker thread."); | 37 NSAssert(result, @"Failed to start worker thread."); |
39 | 38 |
40 _nativeFactory = webrtc::CreatePeerConnectionFactory( | 39 _nativeFactory = webrtc::CreatePeerConnectionFactory( |
41 _workerThread.get(), _signalingThread.get(), nullptr, nullptr, nullptr); | 40 _workerThread.get(), _signalingThread.get(), nullptr, nullptr, nullptr); |
42 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); | 41 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); |
43 } | 42 } |
44 return self; | 43 return self; |
45 } | 44 } |
46 | 45 |
47 | |
48 - (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints: | 46 - (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints: |
49 (nullable RTCMediaConstraints *)constraints { | 47 (nullable RTCMediaConstraints *)constraints { |
50 #if defined(WEBRTC_IOS) | 48 #if defined(WEBRTC_IOS) |
51 return [[RTCAVFoundationVideoSource alloc] initWithFactory:self | 49 return [[RTCAVFoundationVideoSource alloc] initWithFactory:self |
52 constraints:constraints]; | 50 constraints:constraints]; |
53 #else | 51 #else |
54 return nil; | 52 return nil; |
55 #endif | 53 #endif |
56 } | 54 } |
57 | 55 |
(...skipping 20 matching lines...) Expand all Loading... |
78 (RTCMediaConstraints *)constraints | 76 (RTCMediaConstraints *)constraints |
79 delegate: | 77 delegate: |
80 (nullable id<RTCPeerConnectionDelegate>)delegate { | 78 (nullable id<RTCPeerConnectionDelegate>)delegate { |
81 return [[RTCPeerConnection alloc] initWithFactory:self | 79 return [[RTCPeerConnection alloc] initWithFactory:self |
82 configuration:configuration | 80 configuration:configuration |
83 constraints:constraints | 81 constraints:constraints |
84 delegate:delegate]; | 82 delegate:delegate]; |
85 } | 83 } |
86 | 84 |
87 @end | 85 @end |
OLD | NEW |