@@ -42,17 +42,22 @@ std::unique_ptr<webrtc::VideoDecoderFactory> CreateIntelVideoDecoderFactory() {
42
42
}
43
43
#endif
44
44
45
- RTCPeerConnectionFactoryImpl::RTCPeerConnectionFactoryImpl (
46
- rtc::Thread* worker_thread,
47
- rtc::Thread* signaling_thread,
48
- rtc::Thread* network_thread)
49
- : worker_thread_(worker_thread),
50
- signaling_thread_ (signaling_thread),
51
- network_thread_(network_thread) {}
45
+ RTCPeerConnectionFactoryImpl::RTCPeerConnectionFactoryImpl () {}
52
46
53
47
RTCPeerConnectionFactoryImpl::~RTCPeerConnectionFactoryImpl () {}
54
48
55
49
bool RTCPeerConnectionFactoryImpl::Initialize () {
50
+ worker_thread_ = rtc::Thread::Create ();
51
+ worker_thread_->SetName (" worker_thread" , nullptr );
52
+ RTC_CHECK (worker_thread_->Start ()) << " Failed to start thread" ;
53
+
54
+ signaling_thread_ = rtc::Thread::Create ();
55
+ signaling_thread_->SetName (" signaling_thread" , nullptr );
56
+ RTC_CHECK (signaling_thread_->Start ()) << " Failed to start thread" ;
57
+
58
+ network_thread_ = rtc::Thread::CreateWithSocketServer ();
59
+ network_thread_->SetName (" network_thread" , nullptr );
60
+ RTC_CHECK (network_thread_->Start ()) << " Failed to start thread" ;
56
61
if (!audio_device_module_) {
57
62
task_queue_factory_ = webrtc::CreateDefaultTaskQueueFactory ();
58
63
worker_thread_->Invoke <void >(RTC_FROM_HERE,
@@ -61,7 +66,7 @@ bool RTCPeerConnectionFactoryImpl::Initialize() {
61
66
62
67
if (!rtc_peerconnection_factory_) {
63
68
rtc_peerconnection_factory_ = webrtc::CreatePeerConnectionFactory (
64
- network_thread_, worker_thread_, signaling_thread_,
69
+ network_thread_. get () , worker_thread_. get () , signaling_thread_. get () ,
65
70
audio_device_module_, webrtc::CreateBuiltinAudioEncoderFactory (),
66
71
webrtc::CreateBuiltinAudioDecoderFactory (),
67
72
#if defined(USE_INTEL_MEDIA_SDK)
@@ -138,16 +143,16 @@ scoped_refptr<RTCAudioDevice> RTCPeerConnectionFactoryImpl::GetAudioDevice() {
138
143
if (!audio_device_impl_)
139
144
audio_device_impl_ =
140
145
scoped_refptr<AudioDeviceImpl>(new RefCountedObject<AudioDeviceImpl>(
141
- audio_device_module_, worker_thread_));
146
+ audio_device_module_, worker_thread_. get () ));
142
147
143
148
return audio_device_impl_;
144
149
}
145
150
146
151
scoped_refptr<RTCVideoDevice> RTCPeerConnectionFactoryImpl::GetVideoDevice () {
147
152
if (!video_device_impl_)
148
153
video_device_impl_ = scoped_refptr<RTCVideoDeviceImpl>(
149
- new RefCountedObject<RTCVideoDeviceImpl>(signaling_thread_,
150
- worker_thread_));
154
+ new RefCountedObject<RTCVideoDeviceImpl>(signaling_thread_. get () ,
155
+ worker_thread_. get () ));
151
156
152
157
return video_device_impl_;
153
158
}
@@ -167,7 +172,7 @@ scoped_refptr<RTCDesktopDevice>
167
172
RTCPeerConnectionFactoryImpl::GetDesktopDevice () {
168
173
if (!desktop_device_impl_) {
169
174
desktop_device_impl_ = scoped_refptr<RTCDesktopDeviceImpl>(
170
- new RefCountedObject<RTCDesktopDeviceImpl>(signaling_thread_));
175
+ new RefCountedObject<RTCDesktopDeviceImpl>(signaling_thread_. get () ));
171
176
}
172
177
return desktop_device_impl_;
173
178
}
@@ -177,7 +182,7 @@ scoped_refptr<RTCVideoSource> RTCPeerConnectionFactoryImpl::CreateVideoSource(
177
182
scoped_refptr<RTCVideoCapturer> capturer,
178
183
const string video_source_label,
179
184
scoped_refptr<RTCMediaConstraints> constraints) {
180
- if (rtc::Thread::Current () != signaling_thread_) {
185
+ if (rtc::Thread::Current () != signaling_thread_. get () ) {
181
186
scoped_refptr<RTCVideoSource> source =
182
187
signaling_thread_->Invoke <scoped_refptr<RTCVideoSource>>(
183
188
RTC_FROM_HERE, [this , capturer, video_source_label, constraints] {
@@ -214,7 +219,7 @@ scoped_refptr<RTCVideoSource> RTCPeerConnectionFactoryImpl::CreateDesktopSource(
214
219
scoped_refptr<RTCDesktopCapturer> capturer,
215
220
const string video_source_label,
216
221
scoped_refptr<RTCMediaConstraints> constraints) {
217
- if (rtc::Thread::Current () != signaling_thread_) {
222
+ if (rtc::Thread::Current () != signaling_thread_. get () ) {
218
223
scoped_refptr<RTCVideoSource> source =
219
224
signaling_thread_->Invoke <scoped_refptr<RTCVideoSource>>(
220
225
RTC_FROM_HERE, [this , capturer, video_source_label, constraints] {
@@ -300,7 +305,7 @@ scoped_refptr<RTCAudioTrack> RTCPeerConnectionFactoryImpl::CreateAudioTrack(
300
305
scoped_refptr<RTCRtpCapabilities>
301
306
RTCPeerConnectionFactoryImpl::GetRtpSenderCapabilities (
302
307
RTCMediaType media_type) {
303
- if (rtc::Thread::Current () != signaling_thread_) {
308
+ if (rtc::Thread::Current () != signaling_thread_. get () ) {
304
309
scoped_refptr<RTCRtpCapabilities> capabilities =
305
310
signaling_thread_->Invoke <scoped_refptr<RTCRtpCapabilities>>(
306
311
RTC_FROM_HERE, [this , media_type] {
@@ -329,7 +334,7 @@ RTCPeerConnectionFactoryImpl::GetRtpSenderCapabilities(
329
334
scoped_refptr<RTCRtpCapabilities>
330
335
RTCPeerConnectionFactoryImpl::GetRtpReceiverCapabilities (
331
336
RTCMediaType media_type) {
332
- if (rtc::Thread::Current () != signaling_thread_) {
337
+ if (rtc::Thread::Current () != signaling_thread_. get () ) {
333
338
scoped_refptr<RTCRtpCapabilities> capabilities =
334
339
signaling_thread_->Invoke <scoped_refptr<RTCRtpCapabilities>>(
335
340
RTC_FROM_HERE, [this , media_type] {
0 commit comments