Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: content/renderer/media/media_stream_dependency_factory.cc

Issue 11093061: Enable peerconnection to use the NSS RNG. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_source_extra_data.h" 11 #include "content/renderer/media/media_stream_source_extra_data.h"
12 #include "content/renderer/media/peer_connection_handler_jsep.h" 12 #include "content/renderer/media/peer_connection_handler_jsep.h"
13 #include "content/renderer/media/rtc_peer_connection_handler.h" 13 #include "content/renderer/media/rtc_peer_connection_handler.h"
14 #include "content/renderer/media/rtc_video_capturer.h" 14 #include "content/renderer/media/rtc_video_capturer.h"
15 #include "content/renderer/media/video_capture_impl_manager.h" 15 #include "content/renderer/media/video_capture_impl_manager.h"
16 #include "content/renderer/media/webrtc_audio_device_impl.h" 16 #include "content/renderer/media/webrtc_audio_device_impl.h"
17 #include "content/renderer/media/webrtc_uma_histograms.h" 17 #include "content/renderer/media/webrtc_uma_histograms.h"
18 #include "content/renderer/p2p/ipc_network_manager.h" 18 #include "content/renderer/p2p/ipc_network_manager.h"
19 #include "content/renderer/p2p/ipc_socket_factory.h" 19 #include "content/renderer/p2p/ipc_socket_factory.h"
20 #include "content/renderer/p2p/port_allocator.h" 20 #include "content/renderer/p2p/port_allocator.h"
21 #include "jingle/glue/thread_wrapper.h" 21 #include "jingle/glue/thread_wrapper.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amComponent.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amComponent.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h"
26 #if !defined(USE_OPENSSL)
Ryan Sleevi 2012/10/11 00:26:06 nit: linebreak between lines 25 and 26 ( http://de
Ronghua Wu (Left Chromium) 2012/10/11 00:34:30 Done.
27 #include "net/socket/nss_ssl_util.h"
28 #endif
26 29
27 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface { 30 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface {
28 public: 31 public:
29 P2PPortAllocatorFactory( 32 P2PPortAllocatorFactory(
30 content::P2PSocketDispatcher* socket_dispatcher, 33 content::P2PSocketDispatcher* socket_dispatcher,
31 talk_base::NetworkManager* network_manager, 34 talk_base::NetworkManager* network_manager,
32 talk_base::PacketSocketFactory* socket_factory, 35 talk_base::PacketSocketFactory* socket_factory,
33 WebKit::WebFrame* web_frame) 36 WebKit::WebFrame* web_frame)
34 : socket_dispatcher_(socket_dispatcher), 37 : socket_dispatcher_(socket_dispatcher),
35 network_manager_(network_manager), 38 network_manager_(network_manager),
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 base::Unretained(this), 348 base::Unretained(this),
346 &event)); 349 &event));
347 event.Wait(); 350 event.Wait();
348 } 351 }
349 352
350 if (!socket_factory_.get()) { 353 if (!socket_factory_.get()) {
351 socket_factory_.reset( 354 socket_factory_.reset(
352 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_)); 355 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_));
353 } 356 }
354 357
358 #if !defined(USE_OPENSSL)
359 // Init NSS which will be needed by PeerConnection
Ryan Sleevi 2012/10/11 00:26:06 nit: add comma // Init NSS, which is used by Peer
Ronghua Wu (Left Chromium) 2012/10/11 00:34:30 Done.
360 net::EnsureNSSSSLInit();
361 #endif
362
355 if (!CreatePeerConnectionFactory()) { 363 if (!CreatePeerConnectionFactory()) {
356 LOG(ERROR) << "Could not create PeerConnection factory"; 364 LOG(ERROR) << "Could not create PeerConnection factory";
357 return false; 365 return false;
358 } 366 }
359 return true; 367 return true;
360 } 368 }
361 369
362 void MediaStreamDependencyFactory::CleanupPeerConnectionFactory() { 370 void MediaStreamDependencyFactory::CleanupPeerConnectionFactory() {
363 pc_factory_ = NULL; 371 pc_factory_ = NULL;
364 if (network_manager_) { 372 if (network_manager_) {
365 // The network manager needs to free its resources on the thread they were 373 // The network manager needs to free its resources on the thread they were
366 // created, which is the worked thread. 374 // created, which is the worked thread.
367 if (chrome_worker_thread_.IsRunning()) { 375 if (chrome_worker_thread_.IsRunning()) {
368 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( 376 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
369 &MediaStreamDependencyFactory::DeleteIpcNetworkManager, 377 &MediaStreamDependencyFactory::DeleteIpcNetworkManager,
370 base::Unretained(this))); 378 base::Unretained(this)));
371 // Stopping the thread will wait until all tasks have been 379 // Stopping the thread will wait until all tasks have been
372 // processed before returning. We wait for the above task to finish before 380 // processed before returning. We wait for the above task to finish before
373 // letting the the function continue to avoid any potential race issues. 381 // letting the the function continue to avoid any potential race issues.
374 chrome_worker_thread_.Stop(); 382 chrome_worker_thread_.Stop();
375 } else { 383 } else {
376 NOTREACHED() << "Worker thread not running."; 384 NOTREACHED() << "Worker thread not running.";
377 } 385 }
378 } 386 }
379 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698