| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/shared_memory.h" | 17 #include "base/memory/shared_memory.h" |
| 18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "gpu/command_buffer/service/texture_manager.h" | 19 #include "gpu/command_buffer/service/texture_manager.h" |
| 20 #include "gpu/config/gpu_info.h" | 20 #include "gpu/config/gpu_info.h" |
| 21 #include "gpu/ipc/service/gpu_command_buffer_stub.h" | 21 #include "gpu/ipc/service/gpu_command_buffer_stub.h" |
| 22 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
| 23 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
| 24 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" | 24 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" |
| 25 #include "media/video/video_decode_accelerator.h" | 25 #include "media/video/video_decode_accelerator.h" |
| 26 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
| 27 | 27 |
| 28 namespace gpu { | 28 namespace gpu { |
| 29 class GpuDriverBugWorkarounds; |
| 29 struct GpuPreferences; | 30 struct GpuPreferences; |
| 30 } // namespace gpu | 31 } // namespace gpu |
| 31 | 32 |
| 32 namespace media { | 33 namespace media { |
| 33 | 34 |
| 34 class GpuVideoDecodeAccelerator | 35 class GpuVideoDecodeAccelerator |
| 35 : public IPC::Listener, | 36 : public IPC::Listener, |
| 36 public IPC::Sender, | 37 public IPC::Sender, |
| 37 public VideoDecodeAccelerator::Client, | 38 public VideoDecodeAccelerator::Client, |
| 38 public gpu::GpuCommandBufferStub::DestructionObserver { | 39 public gpu::GpuCommandBufferStub::DestructionObserver { |
| 39 public: | 40 public: |
| 40 // Each of the arguments to the constructor must outlive this object. | 41 // Each of the arguments to the constructor must outlive this object. |
| 41 // |stub->decoder()| will be made current around any operation that touches | 42 // |stub->decoder()| will be made current around any operation that touches |
| 42 // the underlying VDA so that it can make GL calls safely. | 43 // the underlying VDA so that it can make GL calls safely. |
| 43 GpuVideoDecodeAccelerator( | 44 GpuVideoDecodeAccelerator( |
| 44 int32_t host_route_id, | 45 int32_t host_route_id, |
| 45 gpu::GpuCommandBufferStub* stub, | 46 gpu::GpuCommandBufferStub* stub, |
| 46 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 47 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 47 | 48 |
| 48 // Static query for the capabilities, which includes the supported profiles. | 49 // Static query for the capabilities, which includes the supported profiles. |
| 49 // This query calls the appropriate platform-specific version. The returned | 50 // This query calls the appropriate platform-specific version. The returned |
| 50 // capabilities will not contain duplicate supported profile entries. | 51 // capabilities will not contain duplicate supported profile entries. |
| 51 static gpu::VideoDecodeAcceleratorCapabilities GetCapabilities( | 52 static gpu::VideoDecodeAcceleratorCapabilities GetCapabilities( |
| 52 const gpu::GpuPreferences& gpu_preferences); | 53 const gpu::GpuPreferences& gpu_preferences, |
| 54 const gpu::GpuDriverBugWorkarounds& workarounds); |
| 53 | 55 |
| 54 // IPC::Listener implementation. | 56 // IPC::Listener implementation. |
| 55 bool OnMessageReceived(const IPC::Message& message) override; | 57 bool OnMessageReceived(const IPC::Message& message) override; |
| 56 | 58 |
| 57 // VideoDecodeAccelerator::Client implementation. | 59 // VideoDecodeAccelerator::Client implementation. |
| 58 void NotifyInitializationComplete(bool success) override; | 60 void NotifyInitializationComplete(bool success) override; |
| 59 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, | 61 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, |
| 60 VideoPixelFormat format, | 62 VideoPixelFormat format, |
| 61 uint32_t textures_per_buffer, | 63 uint32_t textures_per_buffer, |
| 62 const gfx::Size& dimensions, | 64 const gfx::Size& dimensions, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // cleared. | 163 // cleared. |
| 162 std::map<int32_t, std::vector<scoped_refptr<gpu::gles2::TextureRef>>> | 164 std::map<int32_t, std::vector<scoped_refptr<gpu::gles2::TextureRef>>> |
| 163 uncleared_textures_; | 165 uncleared_textures_; |
| 164 | 166 |
| 165 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 167 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
| 166 }; | 168 }; |
| 167 | 169 |
| 168 } // namespace media | 170 } // namespace media |
| 169 | 171 |
| 170 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 172 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |