Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Side by Side Diff: media/filters/gpu_video_decoder.h

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 NotifyCdmAttached(bool success) override;
62 void ProvidePictureBuffers(uint32 count, 62 void ProvidePictureBuffers(uint32_t count,
63 const gfx::Size& size, 63 const gfx::Size& size,
64 uint32 texture_target) override; 64 uint32_t texture_target) override;
65 void DismissPictureBuffer(int32 id) override; 65 void DismissPictureBuffer(int32_t id) override;
66 void PictureReady(const media::Picture& picture) override; 66 void PictureReady(const media::Picture& picture) override;
67 void NotifyEndOfBitstreamBuffer(int32 id) override; 67 void NotifyEndOfBitstreamBuffer(int32_t id) override;
68 void NotifyFlushDone() override; 68 void NotifyFlushDone() override;
69 void NotifyResetDone() override; 69 void NotifyResetDone() override;
70 void NotifyError(media::VideoDecodeAccelerator::Error error) override; 70 void NotifyError(media::VideoDecodeAccelerator::Error error) override;
71 71
72 static const char kDecoderName[]; 72 static const char kDecoderName[];
73 73
74 protected: 74 protected:
75 ~GpuVideoDecoder() override; 75 ~GpuVideoDecoder() override;
76 76
77 private: 77 private:
(...skipping 16 matching lines...) Expand all
94 struct PendingDecoderBuffer { 94 struct PendingDecoderBuffer {
95 PendingDecoderBuffer(SHMBuffer* s, 95 PendingDecoderBuffer(SHMBuffer* s,
96 const scoped_refptr<DecoderBuffer>& b, 96 const scoped_refptr<DecoderBuffer>& b,
97 const DecodeCB& done_cb); 97 const DecodeCB& done_cb);
98 ~PendingDecoderBuffer(); 98 ~PendingDecoderBuffer();
99 SHMBuffer* shm_buffer; 99 SHMBuffer* shm_buffer;
100 scoped_refptr<DecoderBuffer> buffer; 100 scoped_refptr<DecoderBuffer> buffer;
101 DecodeCB done_cb; 101 DecodeCB done_cb;
102 }; 102 };
103 103
104 typedef std::map<int32, PictureBuffer> PictureBufferMap; 104 typedef std::map<int32_t, PictureBuffer> PictureBufferMap;
105 105
106 // Callback to set CDM. |cdm_attached_cb| is called when the decryptor in the 106 // Callback to set CDM. |cdm_attached_cb| is called when the decryptor in the
107 // CDM has been completely attached to the pipeline. 107 // CDM has been completely attached to the pipeline.
108 void SetCdm(CdmContext* cdm_context, const CdmAttachedCB& cdm_attached_cb); 108 void SetCdm(CdmContext* cdm_context, const CdmAttachedCB& cdm_attached_cb);
109 109
110 void DeliverFrame(const scoped_refptr<VideoFrame>& frame); 110 void DeliverFrame(const scoped_refptr<VideoFrame>& frame);
111 111
112 // 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.
113 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, 113 static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder,
114 media::GpuVideoAcceleratorFactories* factories, 114 media::GpuVideoAcceleratorFactories* factories,
115 int64 picture_buffer_id, 115 int64_t picture_buffer_id,
116 uint32 texture_id, 116 uint32_t texture_id,
117 const gpu::SyncToken& release_sync_token); 117 const gpu::SyncToken& release_sync_token);
118 // Indicate the picture buffer can be reused by the decoder. 118 // Indicate the picture buffer can be reused by the decoder.
119 void ReusePictureBuffer(int64 picture_buffer_id); 119 void ReusePictureBuffer(int64_t picture_buffer_id);
120 120
121 void RecordBufferData( 121 void RecordBufferData(
122 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); 122 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer);
123 void GetBufferData(int32 id, base::TimeDelta* timetamp, 123 void GetBufferData(int32_t id,
124 gfx::Rect* visible_rect, gfx::Size* natural_size); 124 base::TimeDelta* timetamp,
125 gfx::Rect* visible_rect,
126 gfx::Size* natural_size);
125 127
126 void DestroyVDA(); 128 void DestroyVDA();
127 129
128 // Request a shared-memory segment of at least |min_size| bytes. Will 130 // Request a shared-memory segment of at least |min_size| bytes. Will
129 // allocate as necessary. 131 // allocate as necessary.
130 scoped_ptr<SHMBuffer> GetSHM(size_t min_size); 132 scoped_ptr<SHMBuffer> GetSHM(size_t min_size);
131 133
132 // Return a shared-memory segment to the available pool. 134 // Return a shared-memory segment to the available pool.
133 void PutSHM(scoped_ptr<SHMBuffer> shm_buffer); 135 void PutSHM(scoped_ptr<SHMBuffer> shm_buffer);
134 136
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 169
168 // Callback to request/cancel CDM ready notification. 170 // Callback to request/cancel CDM ready notification.
169 SetCdmReadyCB set_cdm_ready_cb_; 171 SetCdmReadyCB set_cdm_ready_cb_;
170 CdmAttachedCB cdm_attached_cb_; 172 CdmAttachedCB cdm_attached_cb_;
171 173
172 // Shared-memory buffer pool. Since allocating SHM segments requires a 174 // Shared-memory buffer pool. Since allocating SHM segments requires a
173 // round-trip to the browser process, we keep allocation out of the 175 // round-trip to the browser process, we keep allocation out of the
174 // steady-state of the decoder. 176 // steady-state of the decoder.
175 std::vector<SHMBuffer*> available_shm_segments_; 177 std::vector<SHMBuffer*> available_shm_segments_;
176 178
177 std::map<int32, PendingDecoderBuffer> bitstream_buffers_in_decoder_; 179 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_;
178 PictureBufferMap assigned_picture_buffers_; 180 PictureBufferMap assigned_picture_buffers_;
179 // PictureBuffers given to us by VDA via PictureReady, which we sent forward 181 // PictureBuffers given to us by VDA via PictureReady, which we sent forward
180 // as VideoFrames to be rendered via decode_cb_, and which will be returned 182 // as VideoFrames to be rendered via decode_cb_, and which will be returned
181 // to us via ReusePictureBuffer. 183 // to us via ReusePictureBuffer.
182 typedef std::map<int32 /* picture_buffer_id */, uint32 /* texture_id */> 184 typedef std::map<int32_t /* picture_buffer_id */, uint32_t /* texture_id */>
183 PictureBufferTextureMap; 185 PictureBufferTextureMap;
184 PictureBufferTextureMap picture_buffers_at_display_; 186 PictureBufferTextureMap picture_buffers_at_display_;
185 187
186 // The texture target used for decoded pictures. 188 // The texture target used for decoded pictures.
187 uint32 decoder_texture_target_; 189 uint32_t decoder_texture_target_;
188 190
189 struct BufferData { 191 struct BufferData {
190 BufferData(int32 bbid, base::TimeDelta ts, const gfx::Rect& visible_rect, 192 BufferData(int32_t bbid,
193 base::TimeDelta ts,
194 const gfx::Rect& visible_rect,
191 const gfx::Size& natural_size); 195 const gfx::Size& natural_size);
192 ~BufferData(); 196 ~BufferData();
193 int32 bitstream_buffer_id; 197 int32_t bitstream_buffer_id;
194 base::TimeDelta timestamp; 198 base::TimeDelta timestamp;
195 gfx::Rect visible_rect; 199 gfx::Rect visible_rect;
196 gfx::Size natural_size; 200 gfx::Size natural_size;
197 }; 201 };
198 std::list<BufferData> input_buffer_data_; 202 std::list<BufferData> input_buffer_data_;
199 203
200 // picture_buffer_id and the frame wrapping the corresponding Picture, for 204 // picture_buffer_id and the frame wrapping the corresponding Picture, for
201 // frames that have been decoded but haven't been requested by a Decode() yet. 205 // frames that have been decoded but haven't been requested by a Decode() yet.
202 int32 next_picture_buffer_id_; 206 int32_t next_picture_buffer_id_;
203 int32 next_bitstream_buffer_id_; 207 int32_t next_bitstream_buffer_id_;
204 208
205 // Set during ProvidePictureBuffers(), used for checking and implementing 209 // Set during ProvidePictureBuffers(), used for checking and implementing
206 // HasAvailableOutputFrames(). 210 // HasAvailableOutputFrames().
207 int available_pictures_; 211 int available_pictures_;
208 212
209 // If true, the client cannot expect the VDA to produce any new decoded 213 // If true, the client cannot expect the VDA to produce any new decoded
210 // frames, until it returns all PictureBuffers it may be holding back to the 214 // frames, until it returns all PictureBuffers it may be holding back to the
211 // VDA. In other words, the VDA may require all PictureBuffers to be able to 215 // VDA. In other words, the VDA may require all PictureBuffers to be able to
212 // proceed with decoding the next frame. 216 // proceed with decoding the next frame.
213 bool needs_all_picture_buffers_to_decode_; 217 bool needs_all_picture_buffers_to_decode_;
214 218
215 // Bound to factories_->GetMessageLoop(). 219 // Bound to factories_->GetMessageLoop().
216 // NOTE: Weak pointers must be invalidated before all other member variables. 220 // NOTE: Weak pointers must be invalidated before all other member variables.
217 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; 221 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_;
218 222
219 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); 223 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder);
220 }; 224 };
221 225
222 } // namespace media 226 } // namespace media
223 227
224 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 228 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698