Chromium Code Reviews| 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/public/renderer/content_renderer_client.h" | |
| 11 #include "content/renderer/media/media_stream_source_extra_data.h" | 12 #include "content/renderer/media/media_stream_source_extra_data.h" |
| 12 #include "content/renderer/media/rtc_media_constraints.h" | 13 #include "content/renderer/media/rtc_media_constraints.h" |
| 13 #include "content/renderer/media/rtc_peer_connection_handler.h" | 14 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 14 #include "content/renderer/media/rtc_video_capturer.h" | 15 #include "content/renderer/media/rtc_video_capturer.h" |
| 15 #include "content/renderer/media/video_capture_impl_manager.h" | 16 #include "content/renderer/media/video_capture_impl_manager.h" |
| 16 #include "content/renderer/media/webaudio_capturer_source.h" | 17 #include "content/renderer/media/webaudio_capturer_source.h" |
| 17 #include "content/renderer/media/webrtc_audio_device_impl.h" | 18 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 18 #include "content/renderer/media/webrtc_local_audio_track.h" | 19 #include "content/renderer/media/webrtc_local_audio_track.h" |
| 19 #include "content/renderer/media/webrtc_logging_handler_impl.h" | 20 //#include "content/renderer/media/webrtc_logging_handler_impl.h" |
| 20 #include "content/renderer/media/webrtc_logging_message_filter.h" | 21 //#include "content/renderer/media/webrtc_logging_message_filter.h" |
|
Avi (use Gerrit)
2013/05/22 14:39:57
don't comment out lines
Henrik Grunell
2013/05/23 12:50:11
Oops, missed that. Thanks. Done.
| |
| 21 #include "content/renderer/media/webrtc_uma_histograms.h" | 22 #include "content/renderer/media/webrtc_uma_histograms.h" |
| 22 #include "content/renderer/p2p/ipc_network_manager.h" | 23 #include "content/renderer/p2p/ipc_network_manager.h" |
| 23 #include "content/renderer/p2p/ipc_socket_factory.h" | 24 #include "content/renderer/p2p/ipc_socket_factory.h" |
| 24 #include "content/renderer/p2p/port_allocator.h" | 25 #include "content/renderer/p2p/port_allocator.h" |
| 25 #include "content/renderer/render_thread_impl.h" | 26 #include "content/renderer/render_thread_impl.h" |
| 26 #include "jingle/glue/thread_wrapper.h" | 27 #include "jingle/glue/thread_wrapper.h" |
| 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" | 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" |
| 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" | 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" |
| 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" | 30 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" |
| 30 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" | 31 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 CHECK(web_frame); | 492 CHECK(web_frame); |
| 492 CHECK(observer); | 493 CHECK(observer); |
| 493 | 494 |
| 494 webrtc::MediaConstraintsInterface::Constraints optional_constraints = | 495 webrtc::MediaConstraintsInterface::Constraints optional_constraints = |
| 495 constraints->GetOptional(); | 496 constraints->GetOptional(); |
| 496 std::string constraint_value; | 497 std::string constraint_value; |
| 497 if (!webrtc_log_open_ && | 498 if (!webrtc_log_open_ && |
| 498 optional_constraints.FindFirst(kWebRtcLoggingConstraint, | 499 optional_constraints.FindFirst(kWebRtcLoggingConstraint, |
| 499 &constraint_value)) { | 500 &constraint_value)) { |
| 500 webrtc_log_open_ = true; | 501 webrtc_log_open_ = true; |
| 501 | 502 GetContentClient()->renderer()->InitWebRtcLogging(constraint_value); |
| 502 RenderThreadImpl::current()->GetIOMessageLoopProxy()->PostTask( | |
| 503 FROM_HERE, base::Bind( | |
| 504 &MediaStreamDependencyFactory::CreateWebRtcLoggingHandler, | |
| 505 base::Unretained(this), | |
| 506 RenderThreadImpl::current()->webrtc_logging_message_filter(), | |
| 507 constraint_value)); | |
| 508 } | 503 } |
| 509 | 504 |
| 510 scoped_refptr<P2PPortAllocatorFactory> pa_factory = | 505 scoped_refptr<P2PPortAllocatorFactory> pa_factory = |
| 511 new talk_base::RefCountedObject<P2PPortAllocatorFactory>( | 506 new talk_base::RefCountedObject<P2PPortAllocatorFactory>( |
| 512 p2p_socket_dispatcher_.get(), | 507 p2p_socket_dispatcher_.get(), |
| 513 network_manager_, | 508 network_manager_, |
| 514 socket_factory_.get(), | 509 socket_factory_.get(), |
| 515 web_frame); | 510 web_frame); |
| 516 return pc_factory_->CreatePeerConnection( | 511 return pc_factory_->CreatePeerConnection( |
| 517 ice_servers, constraints, pa_factory, observer).get(); | 512 ice_servers, constraints, pa_factory, observer).get(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 // Stopping the thread will wait until all tasks have been | 765 // Stopping the thread will wait until all tasks have been |
| 771 // processed before returning. We wait for the above task to finish before | 766 // processed before returning. We wait for the above task to finish before |
| 772 // letting the the function continue to avoid any potential race issues. | 767 // letting the the function continue to avoid any potential race issues. |
| 773 chrome_worker_thread_.Stop(); | 768 chrome_worker_thread_.Stop(); |
| 774 } else { | 769 } else { |
| 775 NOTREACHED() << "Worker thread not running."; | 770 NOTREACHED() << "Worker thread not running."; |
| 776 } | 771 } |
| 777 } | 772 } |
| 778 } | 773 } |
| 779 | 774 |
| 780 void MediaStreamDependencyFactory::CreateWebRtcLoggingHandler( | |
| 781 WebRtcLoggingMessageFilter* filter, | |
| 782 const std::string& app_session_id) { | |
| 783 WebRtcLoggingHandlerImpl* handler = | |
| 784 new WebRtcLoggingHandlerImpl(filter->io_message_loop()); | |
| 785 | |
| 786 // TODO(grunell): Give app session id as parameter. | |
| 787 filter->InitLogging(handler); | |
| 788 } | |
| 789 | |
| 790 } // namespace content | 775 } // namespace content |
| OLD | NEW |