| 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 <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const InitCB& init_cb, | 51 const InitCB& init_cb, |
| 52 const OutputCB& output_cb) override; | 52 const OutputCB& output_cb) override; |
| 53 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 53 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 54 const DecodeCB& decode_cb) override; | 54 const DecodeCB& decode_cb) override; |
| 55 void Reset(const base::Closure& closure) override; | 55 void Reset(const base::Closure& closure) override; |
| 56 bool NeedsBitstreamConversion() const override; | 56 bool NeedsBitstreamConversion() const override; |
| 57 bool CanReadWithoutStalling() const override; | 57 bool CanReadWithoutStalling() const override; |
| 58 int GetMaxDecodeRequests() const override; | 58 int GetMaxDecodeRequests() const override; |
| 59 | 59 |
| 60 // VideoDecodeAccelerator::Client implementation. | 60 // VideoDecodeAccelerator::Client implementation. |
| 61 void NotifyCdmAttached(bool success) override; |
| 61 void ProvidePictureBuffers(uint32 count, | 62 void ProvidePictureBuffers(uint32 count, |
| 62 const gfx::Size& size, | 63 const gfx::Size& size, |
| 63 uint32 texture_target) override; | 64 uint32 texture_target) override; |
| 64 void DismissPictureBuffer(int32 id) override; | 65 void DismissPictureBuffer(int32 id) override; |
| 65 void PictureReady(const media::Picture& picture) override; | 66 void PictureReady(const media::Picture& picture) override; |
| 66 void NotifyEndOfBitstreamBuffer(int32 id) override; | 67 void NotifyEndOfBitstreamBuffer(int32 id) override; |
| 67 void NotifyFlushDone() override; | 68 void NotifyFlushDone() override; |
| 68 void NotifyResetDone() override; | 69 void NotifyResetDone() override; |
| 69 void NotifyError(media::VideoDecodeAccelerator::Error error) override; | 70 void NotifyError(media::VideoDecodeAccelerator::Error error) override; |
| 70 | 71 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 95 const scoped_refptr<DecoderBuffer>& b, | 96 const scoped_refptr<DecoderBuffer>& b, |
| 96 const DecodeCB& done_cb); | 97 const DecodeCB& done_cb); |
| 97 ~PendingDecoderBuffer(); | 98 ~PendingDecoderBuffer(); |
| 98 SHMBuffer* shm_buffer; | 99 SHMBuffer* shm_buffer; |
| 99 scoped_refptr<DecoderBuffer> buffer; | 100 scoped_refptr<DecoderBuffer> buffer; |
| 100 DecodeCB done_cb; | 101 DecodeCB done_cb; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 typedef std::map<int32, PictureBuffer> PictureBufferMap; | 104 typedef std::map<int32, PictureBuffer> PictureBufferMap; |
| 104 | 105 |
| 106 // Callback to set CDM. |cdm_attached_cb| is called when the decryptor in the |
| 107 // CDM has been completely attached to the pipeline. |
| 108 void SetCdm(CdmContext* cdm_context, const CdmAttachedCB& cdm_attached_cb); |
| 109 |
| 105 void DeliverFrame(const scoped_refptr<VideoFrame>& frame); | 110 void DeliverFrame(const scoped_refptr<VideoFrame>& frame); |
| 106 | 111 |
| 107 // 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. |
| 108 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, | 113 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, |
| 109 media::GpuVideoAcceleratorFactories* factories, | 114 media::GpuVideoAcceleratorFactories* factories, |
| 110 int64 picture_buffer_id, | 115 int64 picture_buffer_id, |
| 111 uint32 texture_id, | 116 uint32 texture_id, |
| 112 const gpu::SyncToken& release_sync_token); | 117 const gpu::SyncToken& release_sync_token); |
| 113 // Indicate the picture buffer can be reused by the decoder. | 118 // Indicate the picture buffer can be reused by the decoder. |
| 114 void ReusePictureBuffer(int64 picture_buffer_id); | 119 void ReusePictureBuffer(int64 picture_buffer_id); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 138 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; | 143 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; |
| 139 | 144 |
| 140 bool needs_bitstream_conversion_; | 145 bool needs_bitstream_conversion_; |
| 141 | 146 |
| 142 GpuVideoAcceleratorFactories* factories_; | 147 GpuVideoAcceleratorFactories* factories_; |
| 143 | 148 |
| 144 // Populated during Initialize() (on success) and unchanged until an error | 149 // Populated during Initialize() (on success) and unchanged until an error |
| 145 // occurs. | 150 // occurs. |
| 146 scoped_ptr<VideoDecodeAccelerator> vda_; | 151 scoped_ptr<VideoDecodeAccelerator> vda_; |
| 147 | 152 |
| 153 InitCB init_cb_; |
| 148 OutputCB output_cb_; | 154 OutputCB output_cb_; |
| 149 | 155 |
| 150 DecodeCB eos_decode_cb_; | 156 DecodeCB eos_decode_cb_; |
| 151 | 157 |
| 152 // Not null only during reset. | 158 // Not null only during reset. |
| 153 base::Closure pending_reset_cb_; | 159 base::Closure pending_reset_cb_; |
| 154 | 160 |
| 155 State state_; | 161 State state_; |
| 156 | 162 |
| 157 VideoDecoderConfig config_; | 163 VideoDecoderConfig config_; |
| 158 | 164 |
| 165 // Callback to request/cancel CDM ready notification. |
| 166 SetCdmReadyCB set_cdm_ready_cb_; |
| 167 CdmAttachedCB cdm_attached_cb_; |
| 168 |
| 159 // Shared-memory buffer pool. Since allocating SHM segments requires a | 169 // Shared-memory buffer pool. Since allocating SHM segments requires a |
| 160 // round-trip to the browser process, we keep allocation out of the | 170 // round-trip to the browser process, we keep allocation out of the |
| 161 // steady-state of the decoder. | 171 // steady-state of the decoder. |
| 162 std::vector<SHMBuffer*> available_shm_segments_; | 172 std::vector<SHMBuffer*> available_shm_segments_; |
| 163 | 173 |
| 164 std::map<int32, PendingDecoderBuffer> bitstream_buffers_in_decoder_; | 174 std::map<int32, PendingDecoderBuffer> bitstream_buffers_in_decoder_; |
| 165 PictureBufferMap assigned_picture_buffers_; | 175 PictureBufferMap assigned_picture_buffers_; |
| 166 // PictureBuffers given to us by VDA via PictureReady, which we sent forward | 176 // PictureBuffers given to us by VDA via PictureReady, which we sent forward |
| 167 // as VideoFrames to be rendered via decode_cb_, and which will be returned | 177 // as VideoFrames to be rendered via decode_cb_, and which will be returned |
| 168 // to us via ReusePictureBuffer. | 178 // to us via ReusePictureBuffer. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 196 // Bound to factories_->GetMessageLoop(). | 206 // Bound to factories_->GetMessageLoop(). |
| 197 // NOTE: Weak pointers must be invalidated before all other member variables. | 207 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 198 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 208 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
| 199 | 209 |
| 200 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 210 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
| 201 }; | 211 }; |
| 202 | 212 |
| 203 } // namespace media | 213 } // namespace media |
| 204 | 214 |
| 205 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 215 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
| OLD | NEW |