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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class MEDIA_EXPORT GpuVideoDecoder | 44 class MEDIA_EXPORT GpuVideoDecoder |
45 : public VideoDecoder, | 45 : public VideoDecoder, |
46 public VideoDecodeAccelerator::Client { | 46 public VideoDecodeAccelerator::Client { |
47 public: | 47 public: |
48 explicit GpuVideoDecoder(GpuVideoAcceleratorFactories* factories); | 48 explicit GpuVideoDecoder(GpuVideoAcceleratorFactories* factories); |
49 | 49 |
50 // VideoDecoder implementation. | 50 // VideoDecoder implementation. |
51 std::string GetDisplayName() const override; | 51 std::string GetDisplayName() const override; |
52 void Initialize(const VideoDecoderConfig& config, | 52 void Initialize(const VideoDecoderConfig& config, |
53 bool low_delay, | 53 bool low_delay, |
54 const SetCdmReadyCB& set_cdm_ready_cb, | 54 CdmContext* cdm_context, |
55 const InitCB& init_cb, | 55 const InitCB& init_cb, |
56 const OutputCB& output_cb) override; | 56 const OutputCB& output_cb) override; |
57 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 57 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
58 const DecodeCB& decode_cb) override; | 58 const DecodeCB& decode_cb) override; |
59 void Reset(const base::Closure& closure) override; | 59 void Reset(const base::Closure& closure) override; |
60 bool NeedsBitstreamConversion() const override; | 60 bool NeedsBitstreamConversion() const override; |
61 bool CanReadWithoutStalling() const override; | 61 bool CanReadWithoutStalling() const override; |
62 int GetMaxDecodeRequests() const override; | 62 int GetMaxDecodeRequests() const override; |
63 | 63 |
64 // VideoDecodeAccelerator::Client implementation. | 64 // VideoDecodeAccelerator::Client implementation. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const scoped_refptr<DecoderBuffer>& b, | 100 const scoped_refptr<DecoderBuffer>& b, |
101 const DecodeCB& done_cb); | 101 const DecodeCB& done_cb); |
102 ~PendingDecoderBuffer(); | 102 ~PendingDecoderBuffer(); |
103 SHMBuffer* shm_buffer; | 103 SHMBuffer* shm_buffer; |
104 scoped_refptr<DecoderBuffer> buffer; | 104 scoped_refptr<DecoderBuffer> buffer; |
105 DecodeCB done_cb; | 105 DecodeCB done_cb; |
106 }; | 106 }; |
107 | 107 |
108 typedef std::map<int32_t, PictureBuffer> PictureBufferMap; | 108 typedef std::map<int32_t, PictureBuffer> PictureBufferMap; |
109 | 109 |
110 // Callback to set CDM. |cdm_attached_cb| is called when the decryptor in the | |
111 // CDM has been completely attached to the pipeline. | |
112 void SetCdm(CdmContext* cdm_context, const CdmAttachedCB& cdm_attached_cb); | |
113 | |
114 void DeliverFrame(const scoped_refptr<VideoFrame>& frame); | 110 void DeliverFrame(const scoped_refptr<VideoFrame>& frame); |
115 | 111 |
116 // Static method is to allow it to run even after GVD is deleted. | 112 // Static method is to allow it to run even after GVD is deleted. |
117 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, | 113 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, |
118 media::GpuVideoAcceleratorFactories* factories, | 114 media::GpuVideoAcceleratorFactories* factories, |
119 int64_t picture_buffer_id, | 115 int64_t picture_buffer_id, |
120 uint32_t texture_id, | 116 uint32_t texture_id, |
121 const gpu::SyncToken& release_sync_token); | 117 const gpu::SyncToken& release_sync_token); |
122 // Indicate the picture buffer can be reused by the decoder. | 118 // Indicate the picture buffer can be reused by the decoder. |
123 void ReusePictureBuffer(int64_t picture_buffer_id); | 119 void ReusePictureBuffer(int64_t picture_buffer_id); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 160 |
165 DecodeCB eos_decode_cb_; | 161 DecodeCB eos_decode_cb_; |
166 | 162 |
167 // Not null only during reset. | 163 // Not null only during reset. |
168 base::Closure pending_reset_cb_; | 164 base::Closure pending_reset_cb_; |
169 | 165 |
170 State state_; | 166 State state_; |
171 | 167 |
172 VideoDecoderConfig config_; | 168 VideoDecoderConfig config_; |
173 | 169 |
174 // Callback to request/cancel CDM ready notification. | |
175 SetCdmReadyCB set_cdm_ready_cb_; | |
176 CdmAttachedCB cdm_attached_cb_; | |
177 | |
178 // Shared-memory buffer pool. Since allocating SHM segments requires a | 170 // Shared-memory buffer pool. Since allocating SHM segments requires a |
179 // round-trip to the browser process, we keep allocation out of the | 171 // round-trip to the browser process, we keep allocation out of the |
180 // steady-state of the decoder. | 172 // steady-state of the decoder. |
181 std::vector<SHMBuffer*> available_shm_segments_; | 173 std::vector<SHMBuffer*> available_shm_segments_; |
182 | 174 |
183 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; | 175 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; |
184 PictureBufferMap assigned_picture_buffers_; | 176 PictureBufferMap assigned_picture_buffers_; |
185 // PictureBuffers given to us by VDA via PictureReady, which we sent forward | 177 // PictureBuffers given to us by VDA via PictureReady, which we sent forward |
186 // as VideoFrames to be rendered via decode_cb_, and which will be returned | 178 // as VideoFrames to be rendered via decode_cb_, and which will be returned |
187 // to us via ReusePictureBuffer. | 179 // to us via ReusePictureBuffer. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // Bound to factories_->GetMessageLoop(). | 215 // Bound to factories_->GetMessageLoop(). |
224 // NOTE: Weak pointers must be invalidated before all other member variables. | 216 // NOTE: Weak pointers must be invalidated before all other member variables. |
225 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 217 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
226 | 218 |
227 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 219 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
228 }; | 220 }; |
229 | 221 |
230 } // namespace media | 222 } // namespace media |
231 | 223 |
232 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 224 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |