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

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

Issue 15741003: Moving WebRTC logging related files from content to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed some errors. Created 7 years, 6 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/renderer/media/media_stream_source_extra_data.h" 13 #include "content/renderer/media/media_stream_source_extra_data.h"
14 #include "content/renderer/media/rtc_media_constraints.h" 14 #include "content/renderer/media/rtc_media_constraints.h"
15 #include "content/renderer/media/rtc_peer_connection_handler.h" 15 #include "content/renderer/media/rtc_peer_connection_handler.h"
16 #include "content/renderer/media/rtc_video_capturer.h" 16 #include "content/renderer/media/rtc_video_capturer.h"
17 #include "content/renderer/media/video_capture_impl_manager.h" 17 #include "content/renderer/media/video_capture_impl_manager.h"
18 #include "content/renderer/media/webaudio_capturer_source.h" 18 #include "content/renderer/media/webaudio_capturer_source.h"
19 #include "content/renderer/media/webrtc_audio_device_impl.h" 19 #include "content/renderer/media/webrtc_audio_device_impl.h"
20 #include "content/renderer/media/webrtc_local_audio_track.h" 20 #include "content/renderer/media/webrtc_local_audio_track.h"
21 #include "content/renderer/media/webrtc_logging_handler_impl.h"
22 #include "content/renderer/media/webrtc_logging_message_filter.h"
23 #include "content/renderer/media/webrtc_uma_histograms.h" 21 #include "content/renderer/media/webrtc_uma_histograms.h"
24 #include "content/renderer/p2p/ipc_network_manager.h" 22 #include "content/renderer/p2p/ipc_network_manager.h"
25 #include "content/renderer/p2p/ipc_socket_factory.h" 23 #include "content/renderer/p2p/ipc_socket_factory.h"
26 #include "content/renderer/p2p/port_allocator.h" 24 #include "content/renderer/p2p/port_allocator.h"
27 #include "content/renderer/render_thread_impl.h" 25 #include "content/renderer/render_thread_impl.h"
28 #include "jingle/glue/thread_wrapper.h" 26 #include "jingle/glue/thread_wrapper.h"
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h"
30 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h"
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h"
32 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" 30 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
34 32
35 #if defined(USE_OPENSSL) 33 #if defined(USE_OPENSSL)
36 #include "third_party/libjingle/source/talk/base/ssladapter.h" 34 #include "third_party/libjingle/source/talk/base/ssladapter.h"
37 #else 35 #else
38 #include "net/socket/nss_ssl_util.h" 36 #include "net/socket/nss_ssl_util.h"
39 #endif 37 #endif
40 38
41 namespace content { 39 namespace content {
42 40
43 // The constraint key for the PeerConnection constructor for enabling diagnostic
44 // WebRTC logging. It's a Google specific key, hence the "goog" prefix.
45 const char kWebRtcLoggingConstraint[] = "googLog";
46
47 // Constant constraint keys which disables all audio constraints. 41 // Constant constraint keys which disables all audio constraints.
48 // Only used in combination with WebAudio sources. 42 // Only used in combination with WebAudio sources.
49 struct { 43 struct {
50 const char* key; 44 const char* key;
51 const char* value; 45 const char* value;
52 } const kWebAudioConstraints[] = { 46 } const kWebAudioConstraints[] = {
53 {webrtc::MediaConstraintsInterface::kEchoCancellation, 47 {webrtc::MediaConstraintsInterface::kEchoCancellation,
54 webrtc::MediaConstraintsInterface::kValueFalse}, 48 webrtc::MediaConstraintsInterface::kValueFalse},
55 {webrtc::MediaConstraintsInterface::kAutoGainControl, 49 {webrtc::MediaConstraintsInterface::kAutoGainControl,
56 webrtc::MediaConstraintsInterface::kValueFalse}, 50 webrtc::MediaConstraintsInterface::kValueFalse},
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 }; 202 };
209 203
210 MediaStreamDependencyFactory::MediaStreamDependencyFactory( 204 MediaStreamDependencyFactory::MediaStreamDependencyFactory(
211 VideoCaptureImplManager* vc_manager, 205 VideoCaptureImplManager* vc_manager,
212 P2PSocketDispatcher* p2p_socket_dispatcher) 206 P2PSocketDispatcher* p2p_socket_dispatcher)
213 : network_manager_(NULL), 207 : network_manager_(NULL),
214 vc_manager_(vc_manager), 208 vc_manager_(vc_manager),
215 p2p_socket_dispatcher_(p2p_socket_dispatcher), 209 p2p_socket_dispatcher_(p2p_socket_dispatcher),
216 signaling_thread_(NULL), 210 signaling_thread_(NULL),
217 worker_thread_(NULL), 211 worker_thread_(NULL),
218 chrome_worker_thread_("Chrome_libJingle_WorkerThread"), 212 chrome_worker_thread_("Chrome_libJingle_WorkerThread") {
219 webrtc_log_open_(false) {
220 } 213 }
221 214
222 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { 215 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() {
223 CleanupPeerConnectionFactory(); 216 CleanupPeerConnectionFactory();
224 } 217 }
225 218
226 WebKit::WebRTCPeerConnectionHandler* 219 WebKit::WebRTCPeerConnectionHandler*
227 MediaStreamDependencyFactory::CreateRTCPeerConnectionHandler( 220 MediaStreamDependencyFactory::CreateRTCPeerConnectionHandler(
228 WebKit::WebRTCPeerConnectionHandlerClient* client) { 221 WebKit::WebRTCPeerConnectionHandlerClient* client) {
229 // Save histogram data so we can see how much PeerConnetion is used. 222 // Save histogram data so we can see how much PeerConnetion is used.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 487
495 scoped_refptr<webrtc::PeerConnectionInterface> 488 scoped_refptr<webrtc::PeerConnectionInterface>
496 MediaStreamDependencyFactory::CreatePeerConnection( 489 MediaStreamDependencyFactory::CreatePeerConnection(
497 const webrtc::PeerConnectionInterface::IceServers& ice_servers, 490 const webrtc::PeerConnectionInterface::IceServers& ice_servers,
498 const webrtc::MediaConstraintsInterface* constraints, 491 const webrtc::MediaConstraintsInterface* constraints,
499 WebKit::WebFrame* web_frame, 492 WebKit::WebFrame* web_frame,
500 webrtc::PeerConnectionObserver* observer) { 493 webrtc::PeerConnectionObserver* observer) {
501 CHECK(web_frame); 494 CHECK(web_frame);
502 CHECK(observer); 495 CHECK(observer);
503 496
504 webrtc::MediaConstraintsInterface::Constraints optional_constraints =
505 constraints->GetOptional();
506 std::string constraint_value;
507 if (!webrtc_log_open_ &&
508 optional_constraints.FindFirst(kWebRtcLoggingConstraint,
509 &constraint_value)) {
510 webrtc_log_open_ = true;
511
512 RenderThreadImpl::current()->GetIOMessageLoopProxy()->PostTask(
513 FROM_HERE, base::Bind(
514 &MediaStreamDependencyFactory::CreateWebRtcLoggingHandler,
515 base::Unretained(this),
516 RenderThreadImpl::current()->webrtc_logging_message_filter(),
517 constraint_value));
518 }
519
520 scoped_refptr<P2PPortAllocatorFactory> pa_factory = 497 scoped_refptr<P2PPortAllocatorFactory> pa_factory =
521 new talk_base::RefCountedObject<P2PPortAllocatorFactory>( 498 new talk_base::RefCountedObject<P2PPortAllocatorFactory>(
522 p2p_socket_dispatcher_.get(), 499 p2p_socket_dispatcher_.get(),
523 network_manager_, 500 network_manager_,
524 socket_factory_.get(), 501 socket_factory_.get(),
525 web_frame); 502 web_frame);
526 return pc_factory_->CreatePeerConnection( 503 return pc_factory_->CreatePeerConnection(
527 ice_servers, constraints, pa_factory, observer).get(); 504 ice_servers, constraints, pa_factory, observer).get();
528 } 505 }
529 506
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 // Stopping the thread will wait until all tasks have been 757 // Stopping the thread will wait until all tasks have been
781 // processed before returning. We wait for the above task to finish before 758 // processed before returning. We wait for the above task to finish before
782 // letting the the function continue to avoid any potential race issues. 759 // letting the the function continue to avoid any potential race issues.
783 chrome_worker_thread_.Stop(); 760 chrome_worker_thread_.Stop();
784 } else { 761 } else {
785 NOTREACHED() << "Worker thread not running."; 762 NOTREACHED() << "Worker thread not running.";
786 } 763 }
787 } 764 }
788 } 765 }
789 766
790 void MediaStreamDependencyFactory::CreateWebRtcLoggingHandler(
791 WebRtcLoggingMessageFilter* filter,
792 const std::string& app_session_id) {
793 WebRtcLoggingHandlerImpl* handler =
794 new WebRtcLoggingHandlerImpl(filter->io_message_loop());
795 filter->InitLogging(handler, app_session_id);
796 }
797
798 } // namespace content 767 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698