OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <queue> | 10 #include <queue> |
(...skipping 14 matching lines...) Expand all Loading... |
25 // frames back to the ARC side. | 25 // frames back to the ARC side. |
26 class ArcGpuVideoDecodeAccelerator | 26 class ArcGpuVideoDecodeAccelerator |
27 : public ArcVideoAccelerator, | 27 : public ArcVideoAccelerator, |
28 public media::VideoDecodeAccelerator::Client, | 28 public media::VideoDecodeAccelerator::Client, |
29 public base::SupportsWeakPtr<ArcGpuVideoDecodeAccelerator> { | 29 public base::SupportsWeakPtr<ArcGpuVideoDecodeAccelerator> { |
30 public: | 30 public: |
31 ArcGpuVideoDecodeAccelerator(); | 31 ArcGpuVideoDecodeAccelerator(); |
32 ~ArcGpuVideoDecodeAccelerator() override; | 32 ~ArcGpuVideoDecodeAccelerator() override; |
33 | 33 |
34 // Implementation of the ArcVideoAccelerator interface. | 34 // Implementation of the ArcVideoAccelerator interface. |
35 bool Initialize(const Config& config, | 35 ArcVideoAccelerator::Result Initialize( |
36 ArcVideoAccelerator::Client* client) override; | 36 const Config& config, |
| 37 ArcVideoAccelerator::Client* client) override; |
37 void SetNumberOfOutputBuffers(size_t number) override; | 38 void SetNumberOfOutputBuffers(size_t number) override; |
38 void BindSharedMemory(PortType port, | 39 void BindSharedMemory(PortType port, |
39 uint32_t index, | 40 uint32_t index, |
40 base::ScopedFD ashmem_fd, | 41 base::ScopedFD ashmem_fd, |
41 off_t offset, | 42 off_t offset, |
42 size_t length) override; | 43 size_t length) override; |
43 void BindDmabuf(PortType port, | 44 void BindDmabuf(PortType port, |
44 uint32_t index, | 45 uint32_t index, |
45 base::ScopedFD dmabuf_fd, | 46 base::ScopedFD dmabuf_fd, |
46 int32_t stride) override; | 47 int32_t stride) override; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // |buffer_index| is the index of the associated input buffer. The |timestamp| | 113 // |buffer_index| is the index of the associated input buffer. The |timestamp| |
113 // is the time the video frame should be displayed. | 114 // is the time the video frame should be displayed. |
114 void CreateInputRecord(int32_t bitstream_buffer_id, | 115 void CreateInputRecord(int32_t bitstream_buffer_id, |
115 uint32_t buffer_index, | 116 uint32_t buffer_index, |
116 int64_t timestamp); | 117 int64_t timestamp); |
117 | 118 |
118 // Finds the InputRecord which matches to given |bitstream_buffer_id|. | 119 // Finds the InputRecord which matches to given |bitstream_buffer_id|. |
119 // Returns |nullptr| if it cannot be found. | 120 // Returns |nullptr| if it cannot be found. |
120 InputRecord* FindInputRecord(int32_t bitstream_buffer_id); | 121 InputRecord* FindInputRecord(int32_t bitstream_buffer_id); |
121 | 122 |
| 123 // Global counter that keeps track the number of active clients (i.e., how |
| 124 // many VDAs in use by this class). |
| 125 // Since this class only works on the same thread, it's safe to access |
| 126 // |client_count_| without lock. |
| 127 static int client_count_; |
| 128 |
122 std::unique_ptr<media::VideoDecodeAccelerator> vda_; | 129 std::unique_ptr<media::VideoDecodeAccelerator> vda_; |
123 | 130 |
124 // It's safe to use the pointer here, the life cycle of the |arc_client_| | 131 // It's safe to use the pointer here, the life cycle of the |arc_client_| |
125 // is longer than this ArcGpuVideoDecodeAccelerator. | 132 // is longer than this ArcGpuVideoDecodeAccelerator. |
126 ArcVideoAccelerator::Client* arc_client_; | 133 ArcVideoAccelerator::Client* arc_client_; |
127 | 134 |
128 // The next ID for the bitstream buffer, started from 0. | 135 // The next ID for the bitstream buffer, started from 0. |
129 int32_t next_bitstream_buffer_id_; | 136 int32_t next_bitstream_buffer_id_; |
130 | 137 |
131 gfx::Size coded_size_; | 138 gfx::Size coded_size_; |
(...skipping 16 matching lines...) Expand all Loading... |
148 | 155 |
149 gpu::GpuPreferences gpu_preferences_; | 156 gpu::GpuPreferences gpu_preferences_; |
150 | 157 |
151 DISALLOW_COPY_AND_ASSIGN(ArcGpuVideoDecodeAccelerator); | 158 DISALLOW_COPY_AND_ASSIGN(ArcGpuVideoDecodeAccelerator); |
152 }; | 159 }; |
153 | 160 |
154 } // namespace arc | 161 } // namespace arc |
155 } // namespace chromeos | 162 } // namespace chromeos |
156 | 163 |
157 #endif // CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 164 #endif // CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |