| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" | 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 base::MessageLoop::current()->AddDestructionObserver(this); | 177 base::MessageLoop::current()->AddDestructionObserver(this); |
| 178 // To allow sending to the signaling/worker threads. | 178 // To allow sending to the signaling/worker threads. |
| 179 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 179 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
| 180 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); | 180 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); |
| 181 | 181 |
| 182 EnsureWebRtcAudioDeviceImpl(); | 182 EnsureWebRtcAudioDeviceImpl(); |
| 183 | 183 |
| 184 CHECK(chrome_signaling_thread_.Start()); | 184 CHECK(chrome_signaling_thread_.Start()); |
| 185 CHECK(chrome_worker_thread_.Start()); | 185 CHECK(chrome_worker_thread_.Start()); |
| 186 | 186 |
| 187 base::WaitableEvent start_worker_event(true, false); | 187 base::WaitableEvent start_worker_event( |
| 188 base::WaitableEvent::ResetPolicy::MANUAL, |
| 189 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 188 chrome_worker_thread_.task_runner()->PostTask( | 190 chrome_worker_thread_.task_runner()->PostTask( |
| 189 FROM_HERE, | 191 FROM_HERE, |
| 190 base::Bind(&PeerConnectionDependencyFactory::InitializeWorkerThread, | 192 base::Bind(&PeerConnectionDependencyFactory::InitializeWorkerThread, |
| 191 base::Unretained(this), &worker_thread_, &start_worker_event)); | 193 base::Unretained(this), &worker_thread_, &start_worker_event)); |
| 192 | 194 |
| 193 base::WaitableEvent create_network_manager_event(true, false); | 195 base::WaitableEvent create_network_manager_event( |
| 196 base::WaitableEvent::ResetPolicy::MANUAL, |
| 197 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 194 chrome_worker_thread_.task_runner()->PostTask( | 198 chrome_worker_thread_.task_runner()->PostTask( |
| 195 FROM_HERE, | 199 FROM_HERE, |
| 196 base::Bind(&PeerConnectionDependencyFactory:: | 200 base::Bind(&PeerConnectionDependencyFactory:: |
| 197 CreateIpcNetworkManagerOnWorkerThread, | 201 CreateIpcNetworkManagerOnWorkerThread, |
| 198 base::Unretained(this), &create_network_manager_event)); | 202 base::Unretained(this), &create_network_manager_event)); |
| 199 | 203 |
| 200 start_worker_event.Wait(); | 204 start_worker_event.Wait(); |
| 201 create_network_manager_event.Wait(); | 205 create_network_manager_event.Wait(); |
| 202 | 206 |
| 203 CHECK(worker_thread_); | 207 CHECK(worker_thread_); |
| 204 | 208 |
| 205 // Init SSL, which will be needed by PeerConnection. | 209 // Init SSL, which will be needed by PeerConnection. |
| 206 if (!rtc::InitializeSSL()) { | 210 if (!rtc::InitializeSSL()) { |
| 207 LOG(ERROR) << "Failed on InitializeSSL."; | 211 LOG(ERROR) << "Failed on InitializeSSL."; |
| 208 NOTREACHED(); | 212 NOTREACHED(); |
| 209 return; | 213 return; |
| 210 } | 214 } |
| 211 | 215 |
| 212 base::WaitableEvent start_signaling_event(true, false); | 216 base::WaitableEvent start_signaling_event( |
| 217 base::WaitableEvent::ResetPolicy::MANUAL, |
| 218 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 213 chrome_signaling_thread_.task_runner()->PostTask( | 219 chrome_signaling_thread_.task_runner()->PostTask( |
| 214 FROM_HERE, | 220 FROM_HERE, |
| 215 base::Bind(&PeerConnectionDependencyFactory::InitializeSignalingThread, | 221 base::Bind(&PeerConnectionDependencyFactory::InitializeSignalingThread, |
| 216 base::Unretained(this), | 222 base::Unretained(this), |
| 217 RenderThreadImpl::current()->GetGpuFactories(), | 223 RenderThreadImpl::current()->GetGpuFactories(), |
| 218 &start_signaling_event)); | 224 &start_signaling_event)); |
| 219 | 225 |
| 220 start_signaling_event.Wait(); | 226 start_signaling_event.Wait(); |
| 221 CHECK(signaling_thread_); | 227 CHECK(signaling_thread_); |
| 222 } | 228 } |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 575 |
| 570 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 576 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
| 571 DCHECK(CalledOnValidThread()); | 577 DCHECK(CalledOnValidThread()); |
| 572 if (audio_device_.get()) | 578 if (audio_device_.get()) |
| 573 return; | 579 return; |
| 574 | 580 |
| 575 audio_device_ = new WebRtcAudioDeviceImpl(); | 581 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 576 } | 582 } |
| 577 | 583 |
| 578 } // namespace content | 584 } // namespace content |
| OLD | NEW |