| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 public: | 45 public: |
| 46 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each | 46 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each |
| 47 // use. Safe to call from any thread. | 47 // use. Safe to call from any thread. |
| 48 static scoped_ptr<RendererGpuVideoAcceleratorFactories> Create( | 48 static scoped_ptr<RendererGpuVideoAcceleratorFactories> Create( |
| 49 GpuChannelHost* gpu_channel_host, | 49 GpuChannelHost* gpu_channel_host, |
| 50 const scoped_refptr<base::SingleThreadTaskRunner>& | 50 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 51 main_thread_task_runner, | 51 main_thread_task_runner, |
| 52 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 52 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 53 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 53 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 54 bool enable_gpu_memory_buffer_video_frames, | 54 bool enable_gpu_memory_buffer_video_frames, |
| 55 unsigned image_texture_target, | 55 std::vector<unsigned> image_texture_targets, |
| 56 bool enable_video_accelerator); | 56 bool enable_video_accelerator); |
| 57 | 57 |
| 58 // media::GpuVideoAcceleratorFactories implementation. | 58 // media::GpuVideoAcceleratorFactories implementation. |
| 59 bool IsGpuVideoAcceleratorEnabled() override; | 59 bool IsGpuVideoAcceleratorEnabled() override; |
| 60 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() | 60 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() |
| 61 override; | 61 override; |
| 62 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() | 62 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() |
| 63 override; | 63 override; |
| 64 // Creates textures and produces them into mailboxes. Returns true on success | 64 // Creates textures and produces them into mailboxes. Returns true on success |
| 65 // or false on failure. | 65 // or false on failure. |
| 66 bool CreateTextures(int32_t count, | 66 bool CreateTextures(int32_t count, |
| 67 const gfx::Size& size, | 67 const gfx::Size& size, |
| 68 std::vector<uint32_t>* texture_ids, | 68 std::vector<uint32_t>* texture_ids, |
| 69 std::vector<gpu::Mailbox>* texture_mailboxes, | 69 std::vector<gpu::Mailbox>* texture_mailboxes, |
| 70 uint32_t texture_target) override; | 70 uint32_t texture_target) override; |
| 71 void DeleteTexture(uint32_t texture_id) override; | 71 void DeleteTexture(uint32_t texture_id) override; |
| 72 void WaitSyncToken(const gpu::SyncToken& sync_token) override; | 72 void WaitSyncToken(const gpu::SyncToken& sync_token) override; |
| 73 | 73 |
| 74 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 74 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 75 const gfx::Size& size, | 75 const gfx::Size& size, |
| 76 gfx::BufferFormat format, | 76 gfx::BufferFormat format, |
| 77 gfx::BufferUsage usage) override; | 77 gfx::BufferUsage usage) override; |
| 78 | 78 |
| 79 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override; | 79 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override; |
| 80 unsigned ImageTextureTarget() override; | 80 std::vector<unsigned> ImageTextureTargets() override; |
| 81 media::VideoPixelFormat VideoFrameOutputFormat() override; | 81 media::VideoPixelFormat VideoFrameOutputFormat() override; |
| 82 scoped_ptr<media::GpuVideoAcceleratorFactories::ScopedGLContextLock> | 82 scoped_ptr<media::GpuVideoAcceleratorFactories::ScopedGLContextLock> |
| 83 GetGLContextLock() override; | 83 GetGLContextLock() override; |
| 84 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; | 84 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; |
| 85 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; | 85 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; |
| 86 | 86 |
| 87 media::VideoDecodeAccelerator::Capabilities | 87 media::VideoDecodeAccelerator::Capabilities |
| 88 GetVideoDecodeAcceleratorCapabilities() override; | 88 GetVideoDecodeAcceleratorCapabilities() override; |
| 89 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 89 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
| 90 GetVideoEncodeAcceleratorSupportedProfiles() override; | 90 GetVideoEncodeAcceleratorSupportedProfiles() override; |
| 91 | 91 |
| 92 void ReleaseContextProvider(); | 92 void ReleaseContextProvider(); |
| 93 | 93 |
| 94 ~RendererGpuVideoAcceleratorFactories() override; | 94 ~RendererGpuVideoAcceleratorFactories() override; |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 RendererGpuVideoAcceleratorFactories( | 97 RendererGpuVideoAcceleratorFactories( |
| 98 GpuChannelHost* gpu_channel_host, | 98 GpuChannelHost* gpu_channel_host, |
| 99 const scoped_refptr<base::SingleThreadTaskRunner>& | 99 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 100 main_thread_task_runner, | 100 main_thread_task_runner, |
| 101 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 101 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 102 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 102 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 103 bool enable_gpu_memory_buffer_video_frames, | 103 bool enable_gpu_memory_buffer_video_frames, |
| 104 unsigned image_texture_target, | 104 std::vector<unsigned> image_texture_targets, |
| 105 bool enable_video_accelerator); | 105 bool enable_video_accelerator); |
| 106 | 106 |
| 107 bool CheckContextLost(); | 107 bool CheckContextLost(); |
| 108 | 108 |
| 109 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 109 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 111 scoped_refptr<GpuChannelHost> gpu_channel_host_; | 111 scoped_refptr<GpuChannelHost> gpu_channel_host_; |
| 112 | 112 |
| 113 // Shared pointer to a shared context provider that should be accessed | 113 // Shared pointer to a shared context provider that should be accessed |
| 114 // and set only on the main thread. | 114 // and set only on the main thread. |
| 115 scoped_refptr<ContextProviderCommandBuffer> context_provider_refptr_; | 115 scoped_refptr<ContextProviderCommandBuffer> context_provider_refptr_; |
| 116 | 116 |
| 117 // Raw pointer to a context provider accessed from the media thread. | 117 // Raw pointer to a context provider accessed from the media thread. |
| 118 ContextProviderCommandBuffer* context_provider_; | 118 ContextProviderCommandBuffer* context_provider_; |
| 119 | 119 |
| 120 // Whether gpu memory buffers should be used to hold video frames data. | 120 // Whether gpu memory buffers should be used to hold video frames data. |
| 121 bool enable_gpu_memory_buffer_video_frames_; | 121 bool enable_gpu_memory_buffer_video_frames_; |
| 122 const unsigned image_texture_target_; | 122 const std::vector<unsigned> image_texture_targets_; |
| 123 // Whether video acceleration encoding/decoding should be enabled. | 123 // Whether video acceleration encoding/decoding should be enabled. |
| 124 const bool video_accelerator_enabled_; | 124 const bool video_accelerator_enabled_; |
| 125 | 125 |
| 126 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; | 126 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; |
| 127 | 127 |
| 128 // For sending requests to allocate shared memory in the Browser process. | 128 // For sending requests to allocate shared memory in the Browser process. |
| 129 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 129 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); | 131 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 } // namespace content | 134 } // namespace content |
| 135 | 135 |
| 136 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 136 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
| OLD | NEW |