Chromium Code Reviews| Index: content/renderer/render_thread_impl.cc |
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
| index a2a2508668361fefe6776467a9c73c07cac39e13..0b7d800d7fb2f56112539b29c3ea6a09ab8ef141 100644 |
| --- a/content/renderer/render_thread_impl.cc |
| +++ b/content/renderer/render_thread_impl.cc |
| @@ -161,6 +161,7 @@ |
| #include <cpu-features.h> |
| #include "content/renderer/android/synchronous_compositor_factory.h" |
| #include "content/renderer/media/android/renderer_demuxer_android.h" |
| +#include "content/renderer/media/android/stream_texture_factory_impl.h" |
| #endif |
| #if defined(OS_MACOSX) |
| @@ -892,7 +893,9 @@ void RenderThreadImpl::Shutdown() { |
| // Context providers must be released prior to destroying the GPU channel. |
| shared_worker_context_provider_ = nullptr; |
| shared_main_thread_contexts_ = nullptr; |
| - |
| +#if defined(OS_ANDROID) |
| + stream_texture_factory_ = nullptr; |
| +#endif |
| if (gpu_channel_.get()) |
| gpu_channel_->DestroyChannel(); |
| @@ -1430,15 +1433,46 @@ RenderThreadImpl::SharedMainThreadContextProvider() { |
| if (!shared_main_thread_contexts_.get() || |
| shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() != |
| GL_NO_ERROR) { |
| - shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( |
| - CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); |
| - if (shared_main_thread_contexts_.get() && |
| - !shared_main_thread_contexts_->BindToCurrentThread()) |
| + scoped_refptr<ContextProviderCommandBuffer> context_provider = |
| + ContextProviderCommandBuffer::Create(CreateOffscreenContext3d(), |
| + RENDERER_MAINTHREAD_CONTEXT); |
| + if (!context_provider.get()) { |
| + LOG(ERROR) << "Failed to get context3d for media player"; |
| + return NULL; |
| + } |
| + if (context_provider.get() && context_provider->BindToCurrentThread()) { |
| +#if defined(OS_ANDROID) |
| + // Create shared StreamTextureFactoryImpl per RenderThreadImpl when we |
|
no sievers
2015/11/06 22:08:41
can you move this android block to GetStreamTextur
sivag
2015/11/09 14:06:32
Done.
|
| + // create ContextProviderCommandBuffer. |
| + scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| + CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); |
| + if (!gpu_channel_host.get()) { |
| + LOG(ERROR) << "Failed to establish GPU channel for media player"; |
| + stream_texture_factory_ = NULL; |
| + } else { |
| + stream_texture_factory_ = StreamTextureFactoryImpl::Create( |
| + context_provider, gpu_channel_host.get()); |
| + } |
| +#endif |
| + shared_main_thread_contexts_ = context_provider; |
| + } else |
| shared_main_thread_contexts_ = NULL; |
| } |
| return shared_main_thread_contexts_; |
| } |
| +#if defined(OS_ANDROID) |
| +scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { |
| + DCHECK(IsMainThread()); |
| + if (!stream_texture_factory_.get()) { |
| + // StreamTextureFactoryImpl is created while creating |
| + // ContextProviderCommandBuffer. |
| + SharedMainThreadContextProvider(); |
| + } |
| + return stream_texture_factory_; |
| +} |
| +#endif |
| + |
| AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { |
| if (!audio_renderer_mixer_manager_) { |
| audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); |