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+Private.h" | 11 #import "RTCPeerConnectionFactory+Private.h" |
12 | 12 |
13 #import "NSString+StdString.h" | 13 #import "NSString+StdString.h" |
14 #import "RTCAVFoundationVideoSource+Private.h" | 14 #import "RTCAVFoundationVideoSource+Private.h" |
15 #import "RTCAudioSource+Private.h" | 15 #import "RTCAudioSource+Private.h" |
16 #import "RTCAudioTrack+Private.h" | 16 #import "RTCAudioTrack+Private.h" |
17 #import "RTCMediaConstraints+Private.h" | 17 #import "RTCMediaConstraints+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 #import "WebRTC/RTCLogging.h" | 22 #import "WebRTC/RTCLogging.h" |
23 | 23 |
24 #include "videotoolboxvideocodecfactory.h" | |
25 | |
24 @implementation RTCPeerConnectionFactory { | 26 @implementation RTCPeerConnectionFactory { |
25 std::unique_ptr<rtc::Thread> _networkThread; | 27 std::unique_ptr<rtc::Thread> _networkThread; |
26 std::unique_ptr<rtc::Thread> _workerThread; | 28 std::unique_ptr<rtc::Thread> _workerThread; |
27 std::unique_ptr<rtc::Thread> _signalingThread; | 29 std::unique_ptr<rtc::Thread> _signalingThread; |
28 BOOL _hasStartedAecDump; | 30 BOOL _hasStartedAecDump; |
29 } | 31 } |
30 | 32 |
31 @synthesize nativeFactory = _nativeFactory; | 33 @synthesize nativeFactory = _nativeFactory; |
32 | 34 |
33 - (instancetype)init { | 35 - (instancetype)init { |
34 if ((self = [super init])) { | 36 if ((self = [super init])) { |
35 _networkThread = rtc::Thread::CreateWithSocketServer(); | 37 _networkThread = rtc::Thread::CreateWithSocketServer(); |
36 BOOL result = _networkThread->Start(); | 38 BOOL result = _networkThread->Start(); |
37 NSAssert(result, @"Failed to start network thread."); | 39 NSAssert(result, @"Failed to start network thread."); |
38 | 40 |
39 _workerThread = rtc::Thread::Create(); | 41 _workerThread = rtc::Thread::Create(); |
40 result = _workerThread->Start(); | 42 result = _workerThread->Start(); |
41 NSAssert(result, @"Failed to start worker thread."); | 43 NSAssert(result, @"Failed to start worker thread."); |
42 | 44 |
43 _signalingThread = rtc::Thread::Create(); | 45 _signalingThread = rtc::Thread::Create(); |
44 result = _signalingThread->Start(); | 46 result = _signalingThread->Start(); |
45 NSAssert(result, @"Failed to start signaling thread."); | 47 NSAssert(result, @"Failed to start signaling thread."); |
46 | 48 |
49 const auto encoder_factory = new webrtc::VideoToolboxVideoEncoderFactory(); | |
magjed_webrtc
2016/11/01 14:00:20
nit: Maybe this would be slightly more clear:
std
kthelgason
2016/11/01 15:14:30
I think that's a lot of typing to no specific purp
| |
50 const auto decoder_factory = new webrtc::VideoToolboxVideoDecoderFactory(); | |
51 | |
47 _nativeFactory = webrtc::CreatePeerConnectionFactory( | 52 _nativeFactory = webrtc::CreatePeerConnectionFactory( |
48 _networkThread.get(), _workerThread.get(), _signalingThread.get(), | 53 _networkThread.get(), _workerThread.get(), _signalingThread.get(), |
49 nullptr, nullptr, nullptr); | 54 nullptr, encoder_factory, decoder_factory); |
50 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); | 55 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); |
51 } | 56 } |
52 return self; | 57 return self; |
53 } | 58 } |
54 | 59 |
55 - (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)c onstraints { | 60 - (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)c onstraints { |
56 std::unique_ptr<webrtc::MediaConstraints> nativeConstraints; | 61 std::unique_ptr<webrtc::MediaConstraints> nativeConstraints; |
57 if (constraints) { | 62 if (constraints) { |
58 nativeConstraints = constraints.nativeConstraints; | 63 nativeConstraints = constraints.nativeConstraints; |
59 } | 64 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 _hasStartedAecDump = _nativeFactory->StartAecDump(fd, maxSizeInBytes); | 126 _hasStartedAecDump = _nativeFactory->StartAecDump(fd, maxSizeInBytes); |
122 return _hasStartedAecDump; | 127 return _hasStartedAecDump; |
123 } | 128 } |
124 | 129 |
125 - (void)stopAecDump { | 130 - (void)stopAecDump { |
126 _nativeFactory->StopAecDump(); | 131 _nativeFactory->StopAecDump(); |
127 _hasStartedAecDump = NO; | 132 _hasStartedAecDump = NO; |
128 } | 133 } |
129 | 134 |
130 @end | 135 @end |
OLD | NEW |