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 |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "cc/output/buffer_to_texture_target_map.h" |
18 #include "content/child/thread_safe_sender.h" | 19 #include "content/child/thread_safe_sender.h" |
19 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
20 #include "media/renderers/gpu_video_accelerator_factories.h" | 21 #include "media/renderers/gpu_video_accelerator_factories.h" |
21 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 class WaitableEvent; | 25 class WaitableEvent; |
25 } | 26 } |
26 | 27 |
27 namespace gpu { | 28 namespace gpu { |
(...skipping 17 matching lines...) Expand all Loading... |
45 public: | 46 public: |
46 // 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 |
47 // use. Safe to call from any thread. | 48 // use. Safe to call from any thread. |
48 static std::unique_ptr<RendererGpuVideoAcceleratorFactories> Create( | 49 static std::unique_ptr<RendererGpuVideoAcceleratorFactories> Create( |
49 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 50 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
50 const scoped_refptr<base::SingleThreadTaskRunner>& | 51 const scoped_refptr<base::SingleThreadTaskRunner>& |
51 main_thread_task_runner, | 52 main_thread_task_runner, |
52 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 53 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
53 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 54 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
54 bool enable_gpu_memory_buffer_video_frames, | 55 bool enable_gpu_memory_buffer_video_frames, |
55 std::vector<unsigned> image_texture_targets, | 56 const cc::BufferToTextureTargetMap& image_texture_targets, |
56 bool enable_video_accelerator); | 57 bool enable_video_accelerator); |
57 | 58 |
58 // media::GpuVideoAcceleratorFactories implementation. | 59 // media::GpuVideoAcceleratorFactories implementation. |
59 bool IsGpuVideoAcceleratorEnabled() override; | 60 bool IsGpuVideoAcceleratorEnabled() override; |
60 std::unique_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() | 61 std::unique_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() |
61 override; | 62 override; |
62 std::unique_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() | 63 std::unique_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() |
63 override; | 64 override; |
64 // Creates textures and produces them into mailboxes. Returns true on success | 65 // Creates textures and produces them into mailboxes. Returns true on success |
65 // or false on failure. | 66 // or false on failure. |
(...skipping 30 matching lines...) Expand all Loading... |
96 ~RendererGpuVideoAcceleratorFactories() override; | 97 ~RendererGpuVideoAcceleratorFactories() override; |
97 | 98 |
98 private: | 99 private: |
99 RendererGpuVideoAcceleratorFactories( | 100 RendererGpuVideoAcceleratorFactories( |
100 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 101 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
101 const scoped_refptr<base::SingleThreadTaskRunner>& | 102 const scoped_refptr<base::SingleThreadTaskRunner>& |
102 main_thread_task_runner, | 103 main_thread_task_runner, |
103 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 104 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
104 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 105 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
105 bool enable_gpu_memory_buffer_video_frames, | 106 bool enable_gpu_memory_buffer_video_frames, |
106 std::vector<unsigned> image_texture_targets, | 107 const cc::BufferToTextureTargetMap& image_texture_targets, |
107 bool enable_video_accelerator); | 108 bool enable_video_accelerator); |
108 | 109 |
109 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 110 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 111 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
111 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; | 112 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; |
112 | 113 |
113 // Shared pointer to a shared context provider that should be accessed | 114 // Shared pointer to a shared context provider that should be accessed |
114 // and set only on the main thread. | 115 // and set only on the main thread. |
115 scoped_refptr<ContextProviderCommandBuffer> context_provider_refptr_; | 116 scoped_refptr<ContextProviderCommandBuffer> context_provider_refptr_; |
116 | 117 |
117 // Raw pointer to a context provider accessed from the media thread. | 118 // Raw pointer to a context provider accessed from the media thread. |
118 ContextProviderCommandBuffer* context_provider_; | 119 ContextProviderCommandBuffer* context_provider_; |
119 | 120 |
120 // Whether gpu memory buffers should be used to hold video frames data. | 121 // Whether gpu memory buffers should be used to hold video frames data. |
121 bool enable_gpu_memory_buffer_video_frames_; | 122 bool enable_gpu_memory_buffer_video_frames_; |
122 const std::vector<unsigned> image_texture_targets_; | 123 const cc::BufferToTextureTargetMap image_texture_targets_; |
123 // Whether video acceleration encoding/decoding should be enabled. | 124 // Whether video acceleration encoding/decoding should be enabled. |
124 const bool video_accelerator_enabled_; | 125 const bool video_accelerator_enabled_; |
125 | 126 |
126 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; | 127 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; |
127 | 128 |
128 // For sending requests to allocate shared memory in the Browser process. | 129 // For sending requests to allocate shared memory in the Browser process. |
129 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 130 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
130 | 131 |
131 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); | 132 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); |
132 }; | 133 }; |
133 | 134 |
134 } // namespace content | 135 } // namespace content |
135 | 136 |
136 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 137 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
OLD | NEW |