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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 13890012: Integrate VDA with WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address some review comments 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 28acc8b0812cc6cfb77aa4c705e3ef8520e7f744..0362a828555ed70f1bb3ce35cc8a74c6ea25ecbb 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -62,6 +62,7 @@
#include "content/renderer/media/media_stream_center.h"
#include "content/renderer/media/media_stream_dependency_factory.h"
#include "content/renderer/media/peer_connection_tracker.h"
+#include "content/renderer/media/renderer_gpu_video_decoder_factories.h"
#include "content/renderer/media/video_capture_impl_manager.h"
#include "content/renderer/media/video_capture_message_filter.h"
#include "content/renderer/memory_benchmarking_extension.h"
@@ -971,6 +972,26 @@ void RenderThreadImpl::PostponeIdleNotification() {
idle_notifications_to_skip_ = 2;
}
+RendererGpuVideoDecoderFactories* RenderThreadImpl::GetGpuFactories() {
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ RendererGpuVideoDecoderFactories* gpu_factories = NULL;
+ WebGraphicsContext3DCommandBufferImpl* context3d = NULL;
+ if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
+ context3d = RenderThreadImpl::current()->GetGpuVDAContext3D();
+ if (context3d) {
+ scoped_refptr<base::MessageLoopProxy> factories_loop =
+ RenderThreadImpl::current()->compositor_message_loop_proxy();
+ if (!factories_loop)
+ factories_loop = base::MessageLoopProxy::current();
+ GpuChannelHost* gpu_channel_host =
+ RenderThreadImpl::current()->EstablishGpuChannelSync(
+ CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE);
+ gpu_factories = new RendererGpuVideoDecoderFactories(
+ gpu_channel_host, factories_loop, context3d);
+ }
+ return gpu_factories;
+}
+
/* static */
void RenderThreadImpl::OnGpuVDAContextLoss() {
RenderThreadImpl* self = RenderThreadImpl::current();
@@ -1284,9 +1305,14 @@ WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter(
MediaStreamDependencyFactory*
RenderThreadImpl::GetMediaStreamDependencyFactory() {
#if defined(ENABLE_WEBRTC)
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories;
+ if (cmd_line->HasSwitch(switches::kEnableWebRTCHWDecoding)) {
+ gpu_factories = GetGpuFactories();
+ }
if (!media_stream_factory_) {
media_stream_factory_.reset(new MediaStreamDependencyFactory(
- vc_manager_, p2p_socket_dispatcher_));
+ vc_manager_, gpu_factories, p2p_socket_dispatcher_));
}
#endif
return media_stream_factory_.get();

Powered by Google App Engine
This is Rietveld 408576698