OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media_stream_dependency_factory.h" | 5 #include "content/renderer/media/media_stream_dependency_factory.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "content/renderer/media/media_stream_extra_data.h" | 11 #include "content/renderer/media/media_stream_extra_data.h" |
12 #include "content/renderer/media/media_stream_source_extra_data.h" | 12 #include "content/renderer/media/media_stream_source_extra_data.h" |
13 #include "content/renderer/media/peer_connection_handler_jsep.h" | 13 #include "content/renderer/media/peer_connection_handler_jsep.h" |
14 #include "content/renderer/media/rtc_peer_connection_handler.h" | 14 #include "content/renderer/media/rtc_peer_connection_handler.h" |
15 #include "content/renderer/media/rtc_video_capturer.h" | 15 #include "content/renderer/media/rtc_video_capturer.h" |
16 #include "content/renderer/media/video_capture_impl_manager.h" | 16 #include "content/renderer/media/video_capture_impl_manager.h" |
17 #include "content/renderer/media/webrtc_audio_device_impl.h" | 17 #include "content/renderer/media/webrtc_audio_device_impl.h" |
18 #include "content/renderer/media/webrtc_uma_histograms.h" | 18 #include "content/renderer/media/webrtc_uma_histograms.h" |
19 #include "content/renderer/p2p/ipc_network_manager.h" | 19 #include "content/renderer/p2p/ipc_network_manager.h" |
20 #include "content/renderer/p2p/ipc_socket_factory.h" | 20 #include "content/renderer/p2p/ipc_socket_factory.h" |
21 #include "content/renderer/p2p/port_allocator.h" | 21 #include "content/renderer/p2p/port_allocator.h" |
22 #include "jingle/glue/thread_wrapper.h" | 22 #include "jingle/glue/thread_wrapper.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amComponent.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amComponent.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amDescriptor.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amDescriptor.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amSource.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amSource.h" |
27 | 27 |
| 28 #if !defined(USE_OPENSSL) |
| 29 #include "net/socket/nss_ssl_util.h" |
| 30 #endif |
| 31 |
28 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface { | 32 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface { |
29 public: | 33 public: |
30 P2PPortAllocatorFactory( | 34 P2PPortAllocatorFactory( |
31 content::P2PSocketDispatcher* socket_dispatcher, | 35 content::P2PSocketDispatcher* socket_dispatcher, |
32 talk_base::NetworkManager* network_manager, | 36 talk_base::NetworkManager* network_manager, |
33 talk_base::PacketSocketFactory* socket_factory) | 37 talk_base::PacketSocketFactory* socket_factory) |
34 : socket_dispatcher_(socket_dispatcher), | 38 : socket_dispatcher_(socket_dispatcher), |
35 network_manager_(network_manager), | 39 network_manager_(network_manager), |
36 socket_factory_(socket_factory) { | 40 socket_factory_(socket_factory) { |
37 } | 41 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 base::Unretained(this), | 335 base::Unretained(this), |
332 &event)); | 336 &event)); |
333 event.Wait(); | 337 event.Wait(); |
334 } | 338 } |
335 | 339 |
336 if (!socket_factory_.get()) { | 340 if (!socket_factory_.get()) { |
337 socket_factory_.reset( | 341 socket_factory_.reset( |
338 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_)); | 342 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_)); |
339 } | 343 } |
340 | 344 |
| 345 #if !defined(USE_OPENSSL) |
| 346 // Init NSS, which will be needed by PeerConnection. |
| 347 net::EnsureNSSSSLInit(); |
| 348 #endif |
| 349 |
341 if (!CreatePeerConnectionFactory( | 350 if (!CreatePeerConnectionFactory( |
342 worker_thread_, | 351 worker_thread_, |
343 signaling_thread_, | 352 signaling_thread_, |
344 p2p_socket_dispatcher_, | 353 p2p_socket_dispatcher_, |
345 network_manager_, | 354 network_manager_, |
346 socket_factory_.get())) { | 355 socket_factory_.get())) { |
347 LOG(ERROR) << "Could not create PeerConnection factory"; | 356 LOG(ERROR) << "Could not create PeerConnection factory"; |
348 return false; | 357 return false; |
349 } | 358 } |
350 return true; | 359 return true; |
(...skipping 10 matching lines...) Expand all Loading... |
361 base::Unretained(this))); | 370 base::Unretained(this))); |
362 // Stopping the thread will wait until all tasks have been | 371 // Stopping the thread will wait until all tasks have been |
363 // processed before returning. We wait for the above task to finish before | 372 // processed before returning. We wait for the above task to finish before |
364 // letting the the function continue to avoid any potential race issues. | 373 // letting the the function continue to avoid any potential race issues. |
365 chrome_worker_thread_.Stop(); | 374 chrome_worker_thread_.Stop(); |
366 } else { | 375 } else { |
367 NOTREACHED() << "Worker thread not running."; | 376 NOTREACHED() << "Worker thread not running."; |
368 } | 377 } |
369 } | 378 } |
370 } | 379 } |
OLD | NEW |