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

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: Public content API for setting the log delegate. Created 7 years, 7 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/public/renderer/content_renderer_client.h"
13 #include "content/renderer/media/media_stream_source_extra_data.h" 14 #include "content/renderer/media/media_stream_source_extra_data.h"
14 #include "content/renderer/media/rtc_media_constraints.h" 15 #include "content/renderer/media/rtc_media_constraints.h"
15 #include "content/renderer/media/rtc_peer_connection_handler.h" 16 #include "content/renderer/media/rtc_peer_connection_handler.h"
16 #include "content/renderer/media/rtc_video_capturer.h" 17 #include "content/renderer/media/rtc_video_capturer.h"
17 #include "content/renderer/media/video_capture_impl_manager.h" 18 #include "content/renderer/media/video_capture_impl_manager.h"
18 #include "content/renderer/media/webaudio_capturer_source.h" 19 #include "content/renderer/media/webaudio_capturer_source.h"
19 #include "content/renderer/media/webrtc_audio_device_impl.h" 20 #include "content/renderer/media/webrtc_audio_device_impl.h"
20 #include "content/renderer/media/webrtc_local_audio_track.h" 21 #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" 22 #include "content/renderer/media/webrtc_uma_histograms.h"
24 #include "content/renderer/p2p/ipc_network_manager.h" 23 #include "content/renderer/p2p/ipc_network_manager.h"
25 #include "content/renderer/p2p/ipc_socket_factory.h" 24 #include "content/renderer/p2p/ipc_socket_factory.h"
26 #include "content/renderer/p2p/port_allocator.h" 25 #include "content/renderer/p2p/port_allocator.h"
27 #include "content/renderer/render_thread_impl.h" 26 #include "content/renderer/render_thread_impl.h"
28 #include "jingle/glue/thread_wrapper.h" 27 #include "jingle/glue/thread_wrapper.h"
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h"
30 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h"
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" 30 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h"
32 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" 31 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 CHECK(web_frame); 500 CHECK(web_frame);
502 CHECK(observer); 501 CHECK(observer);
503 502
504 webrtc::MediaConstraintsInterface::Constraints optional_constraints = 503 webrtc::MediaConstraintsInterface::Constraints optional_constraints =
505 constraints->GetOptional(); 504 constraints->GetOptional();
506 std::string constraint_value; 505 std::string constraint_value;
507 if (!webrtc_log_open_ && 506 if (!webrtc_log_open_ &&
508 optional_constraints.FindFirst(kWebRtcLoggingConstraint, 507 optional_constraints.FindFirst(kWebRtcLoggingConstraint,
509 &constraint_value)) { 508 &constraint_value)) {
510 webrtc_log_open_ = true; 509 webrtc_log_open_ = true;
511 510 GetContentClient()->renderer()->InitWebRtcLogging(constraint_value);
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 } 511 }
519 512
520 scoped_refptr<P2PPortAllocatorFactory> pa_factory = 513 scoped_refptr<P2PPortAllocatorFactory> pa_factory =
521 new talk_base::RefCountedObject<P2PPortAllocatorFactory>( 514 new talk_base::RefCountedObject<P2PPortAllocatorFactory>(
522 p2p_socket_dispatcher_.get(), 515 p2p_socket_dispatcher_.get(),
523 network_manager_, 516 network_manager_,
524 socket_factory_.get(), 517 socket_factory_.get(),
525 web_frame); 518 web_frame);
526 return pc_factory_->CreatePeerConnection( 519 return pc_factory_->CreatePeerConnection(
527 ice_servers, constraints, pa_factory, observer).get(); 520 ice_servers, constraints, pa_factory, observer).get();
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 // Stopping the thread will wait until all tasks have been 773 // Stopping the thread will wait until all tasks have been
781 // processed before returning. We wait for the above task to finish before 774 // processed before returning. We wait for the above task to finish before
782 // letting the the function continue to avoid any potential race issues. 775 // letting the the function continue to avoid any potential race issues.
783 chrome_worker_thread_.Stop(); 776 chrome_worker_thread_.Stop();
784 } else { 777 } else {
785 NOTREACHED() << "Worker thread not running."; 778 NOTREACHED() << "Worker thread not running.";
786 } 779 }
787 } 780 }
788 } 781 }
789 782
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
796 // TODO(grunell): Give app session id as parameter.
797 filter->InitLogging(handler);
798 }
799
800 } // namespace content 783 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698