| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each | 47 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each |
| 48 // use. Safe to call from any thread. | 48 // use. Safe to call from any thread. |
| 49 static std::unique_ptr<RendererGpuVideoAcceleratorFactories> Create( | 49 static std::unique_ptr<RendererGpuVideoAcceleratorFactories> Create( |
| 50 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 50 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
| 51 const scoped_refptr<base::SingleThreadTaskRunner>& | 51 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 52 main_thread_task_runner, | 52 main_thread_task_runner, |
| 53 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 53 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 54 const scoped_refptr<ui::ContextProviderCommandBuffer>& context_provider, | 54 const scoped_refptr<ui::ContextProviderCommandBuffer>& context_provider, |
| 55 bool enable_gpu_memory_buffer_video_frames, | 55 bool enable_gpu_memory_buffer_video_frames, |
| 56 const cc::BufferToTextureTargetMap& image_texture_targets, | 56 const cc::BufferToTextureTargetMap& image_texture_targets, |
| 57 bool enable_video_accelerator); | 57 bool enable_video_decode_accelerator); |
| 58 | 58 |
| 59 // media::GpuVideoAcceleratorFactories implementation. | 59 // media::GpuVideoAcceleratorFactories implementation. |
| 60 bool IsGpuVideoAcceleratorEnabled() override; | 60 bool IsGpuVideoDecodeAcceleratorEnabled() override; |
| 61 base::UnguessableToken GetChannelToken() override; | 61 base::UnguessableToken GetChannelToken() override; |
| 62 int32_t GetCommandBufferRouteId() override; | 62 int32_t GetCommandBufferRouteId() override; |
| 63 std::unique_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() | 63 std::unique_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() |
| 64 override; | 64 override; |
| 65 std::unique_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() | 65 std::unique_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() |
| 66 override; | 66 override; |
| 67 // Creates textures and produces them into mailboxes. Returns true on success | 67 // Creates textures and produces them into mailboxes. Returns true on success |
| 68 // or false on failure. | 68 // or false on failure. |
| 69 bool CreateTextures(int32_t count, | 69 bool CreateTextures(int32_t count, |
| 70 const gfx::Size& size, | 70 const gfx::Size& size, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 RendererGpuVideoAcceleratorFactories( | 103 RendererGpuVideoAcceleratorFactories( |
| 104 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 104 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
| 105 const scoped_refptr<base::SingleThreadTaskRunner>& | 105 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 106 main_thread_task_runner, | 106 main_thread_task_runner, |
| 107 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 107 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 108 const scoped_refptr<ui::ContextProviderCommandBuffer>& context_provider, | 108 const scoped_refptr<ui::ContextProviderCommandBuffer>& context_provider, |
| 109 bool enable_gpu_memory_buffer_video_frames, | 109 bool enable_gpu_memory_buffer_video_frames, |
| 110 const cc::BufferToTextureTargetMap& image_texture_targets, | 110 const cc::BufferToTextureTargetMap& image_texture_targets, |
| 111 bool enable_video_accelerator); | 111 bool enable_video_decode_accelerator); |
| 112 | 112 |
| 113 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 113 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 114 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 114 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 115 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; | 115 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; |
| 116 | 116 |
| 117 // Shared pointer to a shared context provider that should be accessed | 117 // Shared pointer to a shared context provider that should be accessed |
| 118 // and set only on the main thread. | 118 // and set only on the main thread. |
| 119 scoped_refptr<ui::ContextProviderCommandBuffer> context_provider_refptr_; | 119 scoped_refptr<ui::ContextProviderCommandBuffer> context_provider_refptr_; |
| 120 | 120 |
| 121 // Raw pointer to a context provider accessed from the media thread. | 121 // Raw pointer to a context provider accessed from the media thread. |
| 122 ui::ContextProviderCommandBuffer* context_provider_; | 122 ui::ContextProviderCommandBuffer* context_provider_; |
| 123 | 123 |
| 124 base::UnguessableToken channel_token_; | 124 base::UnguessableToken channel_token_; |
| 125 | 125 |
| 126 // Whether gpu memory buffers should be used to hold video frames data. | 126 // Whether gpu memory buffers should be used to hold video frames data. |
| 127 bool enable_gpu_memory_buffer_video_frames_; | 127 bool enable_gpu_memory_buffer_video_frames_; |
| 128 const cc::BufferToTextureTargetMap image_texture_targets_; | 128 const cc::BufferToTextureTargetMap image_texture_targets_; |
| 129 // Whether video acceleration encoding/decoding should be enabled. | 129 // Whether video acceleration decoding should be enabled. |
| 130 const bool video_accelerator_enabled_; | 130 const bool video_decode_accelerator_enabled_; |
| 131 | 131 |
| 132 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; | 132 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; |
| 133 | 133 |
| 134 // For sending requests to allocate shared memory in the Browser process. | 134 // For sending requests to allocate shared memory in the Browser process. |
| 135 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 135 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 136 | 136 |
| 137 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); | 137 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace content | 140 } // namespace content |
| 141 | 141 |
| 142 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 142 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
| OLD | NEW |