| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 60 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 61 const DecodeCB& decode_cb) override; | 61 const DecodeCB& decode_cb) override; |
| 62 void Reset(const base::Closure& closure) override; | 62 void Reset(const base::Closure& closure) override; |
| 63 bool NeedsBitstreamConversion() const override; | 63 bool NeedsBitstreamConversion() const override; |
| 64 bool CanReadWithoutStalling() const override; | 64 bool CanReadWithoutStalling() const override; |
| 65 int GetMaxDecodeRequests() const override; | 65 int GetMaxDecodeRequests() const override; |
| 66 | 66 |
| 67 // VideoDecodeAccelerator::Client implementation. | 67 // VideoDecodeAccelerator::Client implementation. |
| 68 void NotifyCdmAttached(bool success) override; | 68 void NotifyCdmAttached(bool success) override; |
| 69 void ProvidePictureBuffers(uint32_t count, | 69 void ProvidePictureBuffers(uint32_t count, |
| 70 uint32_t textures_per_buffer, |
| 70 const gfx::Size& size, | 71 const gfx::Size& size, |
| 71 uint32_t texture_target) override; | 72 uint32_t texture_target) override; |
| 72 void DismissPictureBuffer(int32_t id) override; | 73 void DismissPictureBuffer(int32_t id) override; |
| 73 void PictureReady(const media::Picture& picture) override; | 74 void PictureReady(const media::Picture& picture) override; |
| 74 void NotifyEndOfBitstreamBuffer(int32_t id) override; | 75 void NotifyEndOfBitstreamBuffer(int32_t id) override; |
| 75 void NotifyFlushDone() override; | 76 void NotifyFlushDone() override; |
| 76 void NotifyResetDone() override; | 77 void NotifyResetDone() override; |
| 77 void NotifyError(media::VideoDecodeAccelerator::Error error) override; | 78 void NotifyError(media::VideoDecodeAccelerator::Error error) override; |
| 78 | 79 |
| 79 static const char kDecoderName[]; | 80 static const char kDecoderName[]; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 typedef std::map<int32_t, PictureBuffer> PictureBufferMap; | 113 typedef std::map<int32_t, PictureBuffer> PictureBufferMap; |
| 113 | 114 |
| 114 void DeliverFrame(const scoped_refptr<VideoFrame>& frame); | 115 void DeliverFrame(const scoped_refptr<VideoFrame>& frame); |
| 115 | 116 |
| 116 // Static method is to allow it to run even after GVD is deleted. | 117 // Static method is to allow it to run even after GVD is deleted. |
| 117 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, | 118 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, |
| 118 media::GpuVideoAcceleratorFactories* factories, | 119 media::GpuVideoAcceleratorFactories* factories, |
| 119 int64_t picture_buffer_id, | 120 int64_t picture_buffer_id, |
| 120 uint32_t texture_id, | 121 PictureBuffer::TextureIds ids, |
| 121 const gpu::SyncToken& release_sync_token); | 122 const gpu::SyncToken& release_sync_token); |
| 122 // Indicate the picture buffer can be reused by the decoder. | 123 // Indicate the picture buffer can be reused by the decoder. |
| 123 void ReusePictureBuffer(int64_t picture_buffer_id); | 124 void ReusePictureBuffer(int64_t picture_buffer_id); |
| 124 | 125 |
| 125 void RecordBufferData( | 126 void RecordBufferData( |
| 126 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); | 127 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); |
| 127 void GetBufferData(int32_t id, | 128 void GetBufferData(int32_t id, |
| 128 base::TimeDelta* timetamp, | 129 base::TimeDelta* timetamp, |
| 129 gfx::Rect* visible_rect, | 130 gfx::Rect* visible_rect, |
| 130 gfx::Size* natural_size); | 131 gfx::Size* natural_size); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Shared-memory buffer pool. Since allocating SHM segments requires a | 180 // Shared-memory buffer pool. Since allocating SHM segments requires a |
| 180 // round-trip to the browser process, we keep allocation out of the | 181 // round-trip to the browser process, we keep allocation out of the |
| 181 // steady-state of the decoder. | 182 // steady-state of the decoder. |
| 182 std::vector<SHMBuffer*> available_shm_segments_; | 183 std::vector<SHMBuffer*> available_shm_segments_; |
| 183 | 184 |
| 184 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; | 185 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; |
| 185 PictureBufferMap assigned_picture_buffers_; | 186 PictureBufferMap assigned_picture_buffers_; |
| 186 // PictureBuffers given to us by VDA via PictureReady, which we sent forward | 187 // PictureBuffers given to us by VDA via PictureReady, which we sent forward |
| 187 // as VideoFrames to be rendered via decode_cb_, and which will be returned | 188 // as VideoFrames to be rendered via decode_cb_, and which will be returned |
| 188 // to us via ReusePictureBuffer. | 189 // to us via ReusePictureBuffer. |
| 189 typedef std::map<int32_t /* picture_buffer_id */, uint32_t /* texture_id */> | 190 typedef std::map<int32_t /* picture_buffer_id */, |
| 191 PictureBuffer::TextureIds /* texture_id */> |
| 190 PictureBufferTextureMap; | 192 PictureBufferTextureMap; |
| 191 PictureBufferTextureMap picture_buffers_at_display_; | 193 PictureBufferTextureMap picture_buffers_at_display_; |
| 192 | 194 |
| 193 // The texture target used for decoded pictures. | 195 // The texture target used for decoded pictures. |
| 194 uint32_t decoder_texture_target_; | 196 uint32_t decoder_texture_target_; |
| 195 | 197 |
| 196 struct BufferData { | 198 struct BufferData { |
| 197 BufferData(int32_t bbid, | 199 BufferData(int32_t bbid, |
| 198 base::TimeDelta ts, | 200 base::TimeDelta ts, |
| 199 const gfx::Rect& visible_rect, | 201 const gfx::Rect& visible_rect, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 224 // Bound to factories_->GetMessageLoop(). | 226 // Bound to factories_->GetMessageLoop(). |
| 225 // NOTE: Weak pointers must be invalidated before all other member variables. | 227 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 226 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 228 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
| 227 | 229 |
| 228 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 230 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
| 229 }; | 231 }; |
| 230 | 232 |
| 231 } // namespace media | 233 } // namespace media |
| 232 | 234 |
| 233 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 235 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
| OLD | NEW |