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

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
« no previous file with comments | « content/content_renderer.gypi ('k') | net/socket/nss_ssl_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26
27 #if !defined(USE_OPENSSL)
28 #include "net/socket/nss_ssl_util.h"
29 #endif
30
27 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface { 31 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface {
28 public: 32 public:
29 P2PPortAllocatorFactory( 33 P2PPortAllocatorFactory(
30 content::P2PSocketDispatcher* socket_dispatcher, 34 content::P2PSocketDispatcher* socket_dispatcher,
31 talk_base::NetworkManager* network_manager, 35 talk_base::NetworkManager* network_manager,
32 talk_base::PacketSocketFactory* socket_factory, 36 talk_base::PacketSocketFactory* socket_factory,
33 WebKit::WebFrame* web_frame) 37 WebKit::WebFrame* web_frame)
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),
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 base::Unretained(this), 349 base::Unretained(this),
346 &event)); 350 &event));
347 event.Wait(); 351 event.Wait();
348 } 352 }
349 353
350 if (!socket_factory_.get()) { 354 if (!socket_factory_.get()) {
351 socket_factory_.reset( 355 socket_factory_.reset(
352 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_)); 356 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_));
353 } 357 }
354 358
359 #if !defined(USE_OPENSSL)
360 // Init NSS, which will be needed by PeerConnection.
361 net::EnsureNSSSSLInit();
362 #endif
363
355 if (!CreatePeerConnectionFactory()) { 364 if (!CreatePeerConnectionFactory()) {
356 LOG(ERROR) << "Could not create PeerConnection factory"; 365 LOG(ERROR) << "Could not create PeerConnection factory";
357 return false; 366 return false;
358 } 367 }
359 return true; 368 return true;
360 } 369 }
361 370
362 void MediaStreamDependencyFactory::CleanupPeerConnectionFactory() { 371 void MediaStreamDependencyFactory::CleanupPeerConnectionFactory() {
363 pc_factory_ = NULL; 372 pc_factory_ = NULL;
364 if (network_manager_) { 373 if (network_manager_) {
365 // The network manager needs to free its resources on the thread they were 374 // The network manager needs to free its resources on the thread they were
366 // created, which is the worked thread. 375 // created, which is the worked thread.
367 if (chrome_worker_thread_.IsRunning()) { 376 if (chrome_worker_thread_.IsRunning()) {
368 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( 377 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
369 &MediaStreamDependencyFactory::DeleteIpcNetworkManager, 378 &MediaStreamDependencyFactory::DeleteIpcNetworkManager,
370 base::Unretained(this))); 379 base::Unretained(this)));
371 // Stopping the thread will wait until all tasks have been 380 // Stopping the thread will wait until all tasks have been
372 // processed before returning. We wait for the above task to finish before 381 // processed before returning. We wait for the above task to finish before
373 // letting the the function continue to avoid any potential race issues. 382 // letting the the function continue to avoid any potential race issues.
374 chrome_worker_thread_.Stop(); 383 chrome_worker_thread_.Stop();
375 } else { 384 } else {
376 NOTREACHED() << "Worker thread not running."; 385 NOTREACHED() << "Worker thread not running.";
377 } 386 }
378 } 387 }
379 } 388 }
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | net/socket/nss_ssl_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698