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

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

Issue 20632002: Add media::VideoEncodeAccelerator with WebRTC integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: 7dec70f6 Whoops, one last linker thing I missed Created 7 years, 4 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/peer_connection_identity_service.h" 14 #include "content/renderer/media/peer_connection_identity_service.h"
15 #include "content/renderer/media/rtc_media_constraints.h" 15 #include "content/renderer/media/rtc_media_constraints.h"
16 #include "content/renderer/media/rtc_peer_connection_handler.h" 16 #include "content/renderer/media/rtc_peer_connection_handler.h"
17 #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" 18 #include "content/renderer/media/rtc_video_decoder_factory.h"
19 #include "content/renderer/media/rtc_video_encoder_factory.h"
19 #include "content/renderer/media/video_capture_impl_manager.h" 20 #include "content/renderer/media/video_capture_impl_manager.h"
20 #include "content/renderer/media/webaudio_capturer_source.h" 21 #include "content/renderer/media/webaudio_capturer_source.h"
21 #include "content/renderer/media/webrtc_audio_device_impl.h" 22 #include "content/renderer/media/webrtc_audio_device_impl.h"
22 #include "content/renderer/media/webrtc_local_audio_track.h" 23 #include "content/renderer/media/webrtc_local_audio_track.h"
23 #include "content/renderer/media/webrtc_logging_initializer.h" 24 #include "content/renderer/media/webrtc_logging_initializer.h"
24 #include "content/renderer/media/webrtc_uma_histograms.h" 25 #include "content/renderer/media/webrtc_uma_histograms.h"
25 #include "content/renderer/p2p/ipc_network_manager.h" 26 #include "content/renderer/p2p/ipc_network_manager.h"
26 #include "content/renderer/p2p/ipc_socket_factory.h" 27 #include "content/renderer/p2p/ipc_socket_factory.h"
27 #include "content/renderer/p2p/port_allocator.h" 28 #include "content/renderer/p2p/port_allocator.h"
28 #include "content/renderer/render_thread_impl.h" 29 #include "content/renderer/render_thread_impl.h"
29 #include "jingle/glue/thread_wrapper.h" 30 #include "jingle/glue/thread_wrapper.h"
30 #include "media/filters/gpu_video_decoder_factories.h" 31 #include "media/filters/gpu_video_accelerator_factories.h"
31 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 32 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
32 #include "third_party/WebKit/public/platform/WebMediaStream.h" 33 #include "third_party/WebKit/public/platform/WebMediaStream.h"
33 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 34 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
34 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 35 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
35 #include "third_party/WebKit/public/platform/WebURL.h" 36 #include "third_party/WebKit/public/platform/WebURL.h"
36 #include "third_party/WebKit/public/web/WebDocument.h" 37 #include "third_party/WebKit/public/web/WebDocument.h"
37 #include "third_party/WebKit/public/web/WebFrame.h" 38 #include "third_party/WebKit/public/web/WebFrame.h"
38 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" 39 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h"
39 40
40 #if defined(USE_OPENSSL) 41 #if defined(USE_OPENSSL)
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); 481 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id));
481 } 482 }
482 483
483 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { 484 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
484 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; 485 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()";
485 if (!pc_factory_.get()) { 486 if (!pc_factory_.get()) {
486 DCHECK(!audio_device_.get()); 487 DCHECK(!audio_device_.get());
487 audio_device_ = new WebRtcAudioDeviceImpl(); 488 audio_device_ = new WebRtcAudioDeviceImpl();
488 489
489 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; 490 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
491 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
490 492
491 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 493 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
492 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWDecoding)) { 494 scoped_refptr<base::MessageLoopProxy> media_loop_proxy =
493 scoped_refptr<base::MessageLoopProxy> media_loop_proxy = 495 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy();
494 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(); 496 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories =
495 scoped_refptr<RendererGpuVideoDecoderFactories> gpu_factories = 497 RenderThreadImpl::current()->GetGpuFactories(media_loop_proxy);
496 RenderThreadImpl::current()->GetGpuFactories(media_loop_proxy); 498 #if !defined(GOOGLE_TV)
497 if (gpu_factories.get() != NULL) 499 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWDecoding))
500 if (gpu_factories)
498 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); 501 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
499 } 502 #else
500 #if defined(GOOGLE_TV)
501 // PeerConnectionFactory will hold the ownership of this 503 // PeerConnectionFactory will hold the ownership of this
502 // VideoDecoderFactory. 504 // VideoDecoderFactory.
503 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv); 505 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv());
504 #endif 506 #endif
505 507
508 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWEncoding))
509 if (gpu_factories)
510 encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories));
511
506 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( 512 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory(
507 webrtc::CreatePeerConnectionFactory(worker_thread_, 513 webrtc::CreatePeerConnectionFactory(worker_thread_,
508 signaling_thread_, 514 signaling_thread_,
509 audio_device_.get(), 515 audio_device_.get(),
510 NULL, 516 encoder_factory.release(),
511 decoder_factory.release())); 517 decoder_factory.release()));
512 if (factory.get()) 518 if (factory.get())
513 pc_factory_ = factory; 519 pc_factory_ = factory;
514 else 520 else
515 audio_device_ = NULL; 521 audio_device_ = NULL;
516 } 522 }
517 return pc_factory_.get() != NULL; 523 return pc_factory_.get() != NULL;
518 } 524 }
519 525
520 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { 526 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 822 }
817 823
818 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer. 824 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer.
819 if (is_new_capturer) 825 if (is_new_capturer)
820 GetWebRtcAudioDevice()->AddAudioCapturer(capturer); 826 GetWebRtcAudioDevice()->AddAudioCapturer(capturer);
821 827
822 return capturer; 828 return capturer;
823 } 829 }
824 830
825 } // namespace content 831 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698