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

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

Issue 13890012: Integrate VDA with WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments 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
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/renderer_gpu_video_decoder_factories.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"
18 #include "content/renderer/media/rtc_video_decoder_factory.h"
17 #include "content/renderer/media/video_capture_impl_manager.h" 19 #include "content/renderer/media/video_capture_impl_manager.h"
18 #include "content/renderer/media/webaudio_capturer_source.h" 20 #include "content/renderer/media/webaudio_capturer_source.h"
19 #include "content/renderer/media/webrtc_audio_device_impl.h" 21 #include "content/renderer/media/webrtc_audio_device_impl.h"
20 #include "content/renderer/media/webrtc_local_audio_track.h" 22 #include "content/renderer/media/webrtc_local_audio_track.h"
21 #include "content/renderer/media/webrtc_logging_handler_impl.h" 23 #include "content/renderer/media/webrtc_logging_handler_impl.h"
22 #include "content/renderer/media/webrtc_logging_message_filter.h" 24 #include "content/renderer/media/webrtc_logging_message_filter.h"
23 #include "content/renderer/media/webrtc_uma_histograms.h" 25 #include "content/renderer/media/webrtc_uma_histograms.h"
24 #include "content/renderer/p2p/ipc_network_manager.h" 26 #include "content/renderer/p2p/ipc_network_manager.h"
25 #include "content/renderer/p2p/ipc_socket_factory.h" 27 #include "content/renderer/p2p/ipc_socket_factory.h"
26 #include "content/renderer/p2p/port_allocator.h" 28 #include "content/renderer/p2p/port_allocator.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 return type == WebKit::WebMediaStreamSource::TypeAudio ? 474 return type == WebKit::WebMediaStreamSource::TypeAudio ?
473 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : 475 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) :
474 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); 476 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id));
475 } 477 }
476 478
477 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { 479 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
478 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; 480 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()";
479 if (!pc_factory_) { 481 if (!pc_factory_) {
480 DCHECK(!audio_device_); 482 DCHECK(!audio_device_);
481 audio_device_ = new WebRtcAudioDeviceImpl(); 483 audio_device_ = new WebRtcAudioDeviceImpl();
484
485 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
486 scoped_ptr<RTCVideoDecoderFactory> decoder_factory;
487 scoped_refptr<content::RendererGpuVideoDecoderFactories> gpu_factories;
488 if (cmd_line->HasSwitch(switches::kEnableWebRTCHWDecoding)) {
489 scoped_ptr<base::Thread> vda_thread(new base::Thread("VDA_thread"));
490 if (vda_thread->Start()) {
491 gpu_factories = RenderThreadImpl::current()->GetGpuFactories(
492 vda_thread->message_loop_proxy());
493 } else {
494 LOG(ERROR) << "Could not start VDA thread";
495 }
496 if (gpu_factories != NULL) {
497 decoder_factory.reset(
498 new RTCVideoDecoderFactory(gpu_factories, vda_thread.Pass()));
499 }
500 }
501
482 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( 502 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory(
483 webrtc::CreatePeerConnectionFactory( 503 webrtc::CreatePeerConnectionFactory(
484 worker_thread_, signaling_thread_, audio_device_, NULL, NULL)); 504 worker_thread_, signaling_thread_, audio_device_, NULL,
505 decoder_factory.release()));
485 if (factory) 506 if (factory)
486 pc_factory_ = factory; 507 pc_factory_ = factory;
487 else 508 else
488 audio_device_ = NULL; 509 audio_device_ = NULL;
489 } 510 }
490 return pc_factory_.get() != NULL; 511 return pc_factory_.get() != NULL;
491 } 512 }
492 513
493 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { 514 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
494 return pc_factory_.get() != NULL; 515 return pc_factory_.get() != NULL;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 void MediaStreamDependencyFactory::CreateWebRtcLoggingHandler( 815 void MediaStreamDependencyFactory::CreateWebRtcLoggingHandler(
795 WebRtcLoggingMessageFilter* filter, 816 WebRtcLoggingMessageFilter* filter,
796 const std::string& app_session_id, 817 const std::string& app_session_id,
797 const std::string& app_url) { 818 const std::string& app_url) {
798 WebRtcLoggingHandlerImpl* handler = 819 WebRtcLoggingHandlerImpl* handler =
799 new WebRtcLoggingHandlerImpl(filter->io_message_loop()); 820 new WebRtcLoggingHandlerImpl(filter->io_message_loop());
800 filter->InitLogging(handler, app_session_id, app_url); 821 filter->InitLogging(handler, app_session_id, app_url);
801 } 822 }
802 823
803 } // namespace content 824 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698