OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 static const int32 ID_LAST; // maximum bitstream buffer id | 195 static const int32 ID_LAST; // maximum bitstream buffer id |
196 static const int32 ID_HALF; // half of the maximum bitstream buffer id | 196 static const int32 ID_HALF; // half of the maximum bitstream buffer id |
197 static const int32 ID_INVALID; // indicates Reset or Release never occurred | 197 static const int32 ID_INVALID; // indicates Reset or Release never occurred |
198 | 198 |
199 // The hardware video decoder. | 199 // The hardware video decoder. |
200 scoped_ptr<media::VideoDecodeAccelerator> vda_; | 200 scoped_ptr<media::VideoDecodeAccelerator> vda_; |
201 | 201 |
202 // The size of the incoming video frames. | 202 // The size of the incoming video frames. |
203 gfx::Size frame_size_; | 203 gfx::Size frame_size_; |
204 | 204 |
205 // Weak pointer to this, which can be dereferenced only on |vda_task_runner_|. | |
206 base::WeakPtr<RTCVideoDecoder> weak_this_; | |
207 | |
208 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; | 205 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; |
209 | 206 |
210 // The task runner to run callbacks on. This is from |factories_|. | 207 // The task runner to run callbacks on. This is from |factories_|. |
211 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_; | 208 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_; |
212 | 209 |
213 // The texture target used for decoded pictures. | 210 // The texture target used for decoded pictures. |
214 uint32 decoder_texture_target_; | 211 uint32 decoder_texture_target_; |
215 | 212 |
216 // Metadata of the buffers that have been sent for decode. | 213 // Metadata of the buffers that have been sent for decode. |
217 std::list<BufferData> input_buffer_data_; | 214 std::list<BufferData> input_buffer_data_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // decode. The queue owns SHM buffers. Guarded by |lock_|. | 259 // decode. The queue owns SHM buffers. Guarded by |lock_|. |
263 std::deque<std::pair<SHMBuffer*, BufferData> > decode_buffers_; | 260 std::deque<std::pair<SHMBuffer*, BufferData> > decode_buffers_; |
264 | 261 |
265 // The id that will be given to the next bitstream buffer. Guarded by |lock_|. | 262 // The id that will be given to the next bitstream buffer. Guarded by |lock_|. |
266 int32 next_bitstream_buffer_id_; | 263 int32 next_bitstream_buffer_id_; |
267 | 264 |
268 // A buffer that has an id less than this should be dropped because Reset or | 265 // A buffer that has an id less than this should be dropped because Reset or |
269 // Release has been called. Guarded by |lock_|. | 266 // Release has been called. Guarded by |lock_|. |
270 int32 reset_bitstream_buffer_id_; | 267 int32 reset_bitstream_buffer_id_; |
271 | 268 |
272 // Factory used to populate |weak_this_|. Must be destroyed, or invalidated, | 269 // Must be destroyed, or invalidated, on |vda_loop_proxy_| |
273 // on |vda_loop_proxy_|. | 270 // NOTE: Weak pointers must be invalidated before all other member variables. |
274 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; | 271 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; |
275 | 272 |
276 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 273 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
277 }; | 274 }; |
278 | 275 |
279 } // namespace content | 276 } // namespace content |
280 | 277 |
281 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 278 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
OLD | NEW |