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_FILTERS_GPU_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 class MediaLog; | 39 class MediaLog; |
40 | 40 |
41 // GPU-accelerated video decoder implementation. Relies on | 41 // GPU-accelerated video decoder implementation. Relies on |
42 // AcceleratedVideoDecoderMsg_Decode and friends. Can be created on any thread | 42 // AcceleratedVideoDecoderMsg_Decode and friends. Can be created on any thread |
43 // but must be accessed and destroyed on GpuVideoAcceleratorFactories's | 43 // but must be accessed and destroyed on GpuVideoAcceleratorFactories's |
44 // GetMessageLoop(). | 44 // GetMessageLoop(). |
45 class MEDIA_EXPORT GpuVideoDecoder | 45 class MEDIA_EXPORT GpuVideoDecoder |
46 : public VideoDecoder, | 46 : public VideoDecoder, |
47 public VideoDecodeAccelerator::Client { | 47 public VideoDecodeAccelerator::Client { |
48 public: | 48 public: |
49 explicit GpuVideoDecoder(GpuVideoAcceleratorFactories* factories, | 49 GpuVideoDecoder(GpuVideoAcceleratorFactories* factories, |
50 const RequestSurfaceCB& request_surface_cb); | 50 const RequestSurfaceCB& request_surface_cb, |
| 51 scoped_refptr<MediaLog> media_log); |
51 | 52 |
52 // VideoDecoder implementation. | 53 // VideoDecoder implementation. |
53 std::string GetDisplayName() const override; | 54 std::string GetDisplayName() const override; |
54 void Initialize(const VideoDecoderConfig& config, | 55 void Initialize(const VideoDecoderConfig& config, |
55 bool low_delay, | 56 bool low_delay, |
56 CdmContext* cdm_context, | 57 CdmContext* cdm_context, |
57 const InitCB& init_cb, | 58 const InitCB& init_cb, |
58 const OutputCB& output_cb) override; | 59 const OutputCB& output_cb) override; |
59 void CompleteInitialization(int cdm_id, int surface_id); | 60 void CompleteInitialization(int cdm_id, int surface_id); |
60 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 61 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const gfx::Size& coded_size, | 152 const gfx::Size& coded_size, |
152 bool is_encrypted); | 153 bool is_encrypted); |
153 | 154 |
154 // Assert the contract that this class is operated on the right thread. | 155 // Assert the contract that this class is operated on the right thread. |
155 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; | 156 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; |
156 | 157 |
157 bool needs_bitstream_conversion_; | 158 bool needs_bitstream_conversion_; |
158 | 159 |
159 GpuVideoAcceleratorFactories* factories_; | 160 GpuVideoAcceleratorFactories* factories_; |
160 | 161 |
| 162 // For requesting a suface to render to. If this is null the VDA will return |
| 163 // normal video frames and not render them to a surface. |
| 164 RequestSurfaceCB request_surface_cb_; |
| 165 |
| 166 scoped_refptr<MediaLog> media_log_; |
| 167 |
161 // Populated during Initialize() (on success) and unchanged until an error | 168 // Populated during Initialize() (on success) and unchanged until an error |
162 // occurs. | 169 // occurs. |
163 std::unique_ptr<VideoDecodeAccelerator> vda_; | 170 std::unique_ptr<VideoDecodeAccelerator> vda_; |
164 | 171 |
165 InitCB init_cb_; | 172 InitCB init_cb_; |
166 OutputCB output_cb_; | 173 OutputCB output_cb_; |
167 | 174 |
168 DecodeCB eos_decode_cb_; | 175 DecodeCB eos_decode_cb_; |
169 | 176 |
170 // Not null only during reset. | 177 // Not null only during reset. |
171 base::Closure pending_reset_cb_; | 178 base::Closure pending_reset_cb_; |
172 | 179 |
173 State state_; | 180 State state_; |
174 | 181 |
175 VideoDecoderConfig config_; | 182 VideoDecoderConfig config_; |
176 | 183 |
177 // For requesting a suface to render to. If this is null the VDA will return | |
178 // normal video frames and not render them to a surface. | |
179 RequestSurfaceCB request_surface_cb_; | |
180 | |
181 // Shared-memory buffer pool. Since allocating SHM segments requires a | 184 // Shared-memory buffer pool. Since allocating SHM segments requires a |
182 // round-trip to the browser process, we keep allocation out of the | 185 // round-trip to the browser process, we keep allocation out of the |
183 // steady-state of the decoder. | 186 // steady-state of the decoder. |
184 std::vector<SHMBuffer*> available_shm_segments_; | 187 std::vector<SHMBuffer*> available_shm_segments_; |
185 | 188 |
186 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; | 189 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; |
187 PictureBufferMap assigned_picture_buffers_; | 190 PictureBufferMap assigned_picture_buffers_; |
188 // PictureBuffers given to us by VDA via PictureReady, which we sent forward | 191 // PictureBuffers given to us by VDA via PictureReady, which we sent forward |
189 // as VideoFrames to be rendered via decode_cb_, and which will be returned | 192 // as VideoFrames to be rendered via decode_cb_, and which will be returned |
190 // to us via ReusePictureBuffer. | 193 // to us via ReusePictureBuffer. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // Bound to factories_->GetMessageLoop(). | 238 // Bound to factories_->GetMessageLoop(). |
236 // NOTE: Weak pointers must be invalidated before all other member variables. | 239 // NOTE: Weak pointers must be invalidated before all other member variables. |
237 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 240 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
238 | 241 |
239 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 242 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
240 }; | 243 }; |
241 | 244 |
242 } // namespace media | 245 } // namespace media |
243 | 246 |
244 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 247 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |