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

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: rebase Created 7 years, 5 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/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.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/rtc_video_decoder_factory.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_initializer.h" 22 #include "content/renderer/media/webrtc_logging_initializer.h"
22 #include "content/renderer/media/webrtc_uma_histograms.h" 23 #include "content/renderer/media/webrtc_uma_histograms.h"
23 #include "content/renderer/p2p/ipc_network_manager.h" 24 #include "content/renderer/p2p/ipc_network_manager.h"
24 #include "content/renderer/p2p/ipc_socket_factory.h" 25 #include "content/renderer/p2p/ipc_socket_factory.h"
25 #include "content/renderer/p2p/port_allocator.h" 26 #include "content/renderer/p2p/port_allocator.h"
26 #include "content/renderer/render_thread_impl.h" 27 #include "content/renderer/render_thread_impl.h"
27 #include "jingle/glue/thread_wrapper.h" 28 #include "jingle/glue/thread_wrapper.h"
29 #include "media/filters/gpu_video_decoder.h"
28 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 30 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
29 #include "third_party/WebKit/public/platform/WebMediaStream.h" 31 #include "third_party/WebKit/public/platform/WebMediaStream.h"
30 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 32 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
31 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 33 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
32 #include "third_party/WebKit/public/platform/WebURL.h" 34 #include "third_party/WebKit/public/platform/WebURL.h"
33 #include "third_party/WebKit/public/web/WebDocument.h" 35 #include "third_party/WebKit/public/web/WebDocument.h"
34 #include "third_party/WebKit/public/web/WebFrame.h" 36 #include "third_party/WebKit/public/web/WebFrame.h"
35 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" 37 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h"
36 38
37 #if defined(USE_OPENSSL) 39 #if defined(USE_OPENSSL)
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : 481 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) :
480 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); 482 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id));
481 } 483 }
482 484
483 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { 485 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
484 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; 486 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()";
485 if (!pc_factory_.get()) { 487 if (!pc_factory_.get()) {
486 DCHECK(!audio_device_.get()); 488 DCHECK(!audio_device_.get());
487 audio_device_ = new WebRtcAudioDeviceImpl(); 489 audio_device_ = new WebRtcAudioDeviceImpl();
488 490
489 cricket::WebRtcVideoDecoderFactory* decoder_factory = NULL; 491 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
490 #if defined(GOOGLE_TV) 492 #if defined(GOOGLE_TV)
491 // PeerConnectionFactory will hold the ownership of this 493 // PeerConnectionFactory will hold the ownership of this
492 // VideoDecoderFactory. 494 // VideoDecoderFactory.
493 decoder_factory = decoder_factory_tv_ = new RTCVideoDecoderFactoryTv; 495 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv);
494 #endif 496 #endif
497 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
498 if (cmd_line->HasSwitch(switches::kEnableWebRTCHWDecoding)) {
499 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories =
500 RenderThreadImpl::current()->GetGpuFactories();
501 if (gpu_factories.get() != NULL)
502 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
503 }
495 504
496 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( 505 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory(
497 webrtc::CreatePeerConnectionFactory(worker_thread_, 506 webrtc::CreatePeerConnectionFactory(worker_thread_,
498 signaling_thread_, 507 signaling_thread_,
499 audio_device_.get(), 508 audio_device_.get(),
500 NULL, 509 NULL,
501 decoder_factory)); 510 decoder_factory.release()));
502 if (factory.get()) 511 if (factory.get())
503 pc_factory_ = factory; 512 pc_factory_ = factory;
504 else 513 else
505 audio_device_ = NULL; 514 audio_device_ = NULL;
506 } 515 }
507 return pc_factory_.get() != NULL; 516 return pc_factory_.get() != NULL;
508 } 517 }
509 518
510 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { 519 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
511 return pc_factory_.get() != NULL; 520 return pc_factory_.get() != NULL;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // processed before returning. We wait for the above task to finish before 806 // processed before returning. We wait for the above task to finish before
798 // letting the the function continue to avoid any potential race issues. 807 // letting the the function continue to avoid any potential race issues.
799 chrome_worker_thread_.Stop(); 808 chrome_worker_thread_.Stop();
800 } else { 809 } else {
801 NOTREACHED() << "Worker thread not running."; 810 NOTREACHED() << "Worker thread not running.";
802 } 811 }
803 } 812 }
804 } 813 }
805 814
806 } // namespace content 815 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698