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 <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 int32 bitstream_buffer_id; | 105 int32 bitstream_buffer_id; |
106 uint32_t timestamp; // in 90KHz | 106 uint32_t timestamp; // in 90KHz |
107 uint32_t width; | 107 uint32_t width; |
108 uint32_t height; | 108 uint32_t height; |
109 size_t size; // buffer size | 109 size_t size; // buffer size |
110 }; | 110 }; |
111 | 111 |
112 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsBufferAfterReset); | 112 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsBufferAfterReset); |
113 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsFirstBufferAfterReset); | 113 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsFirstBufferAfterReset); |
114 | 114 |
115 // The meessage loop of |factories| will be saved to |vda_loop_proxy_|. | 115 // The meessage loop of |factories| will be saved to |vda_task_runner_|. |
116 RTCVideoDecoder( | 116 RTCVideoDecoder( |
117 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories); | 117 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories); |
118 | 118 |
119 void Initialize(base::WaitableEvent* waiter); | 119 void Initialize(base::WaitableEvent* waiter); |
120 | 120 |
121 // Requests a buffer to be decoded by VDA. | 121 // Requests a buffer to be decoded by VDA. |
122 void RequestBufferDecode(); | 122 void RequestBufferDecode(); |
123 | 123 |
124 bool CanMoreDecodeWorkBeDone(); | 124 bool CanMoreDecodeWorkBeDone(); |
125 | 125 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 static const int32 ID_LAST; // maximum bitstream buffer id | 194 static const int32 ID_LAST; // maximum bitstream buffer id |
195 static const int32 ID_HALF; // half of the maximum bitstream buffer id | 195 static const int32 ID_HALF; // half of the maximum bitstream buffer id |
196 static const int32 ID_INVALID; // indicates Reset or Release never occurred | 196 static const int32 ID_INVALID; // indicates Reset or Release never occurred |
197 | 197 |
198 // The hardware video decoder. | 198 // The hardware video decoder. |
199 scoped_ptr<media::VideoDecodeAccelerator> vda_; | 199 scoped_ptr<media::VideoDecodeAccelerator> vda_; |
200 | 200 |
201 // The size of the incoming video frames. | 201 // The size of the incoming video frames. |
202 gfx::Size frame_size_; | 202 gfx::Size frame_size_; |
203 | 203 |
204 // The weak pointer should live and die on the |vda_loop_proxy_|; | 204 // The weak pointer should live and die on the |vda_task_runner_|; |
205 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; | 205 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; |
206 base::WeakPtr<RTCVideoDecoder> weak_this_; | 206 base::WeakPtr<RTCVideoDecoder> weak_this_; |
207 | 207 |
208 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; | 208 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; |
209 | 209 |
210 // The message loop to run callbacks on. This is from |factories_|. | 210 // The task runner to run callbacks on. This is from |factories_|. |
211 scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_; | 211 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_; |
212 | 212 |
213 // The texture target used for decoded pictures. | 213 // The texture target used for decoded pictures. |
214 uint32 decoder_texture_target_; | 214 uint32 decoder_texture_target_; |
215 | 215 |
216 // Metadata of the buffers that have been sent for decode. | 216 // Metadata of the buffers that have been sent for decode. |
217 std::list<BufferData> input_buffer_data_; | 217 std::list<BufferData> input_buffer_data_; |
218 | 218 |
219 // A map from bitstream buffer IDs to bitstream buffers that are being | 219 // A map from bitstream buffer IDs to bitstream buffers that are being |
220 // processed by VDA. The map owns SHM buffers. | 220 // processed by VDA. The map owns SHM buffers. |
221 std::map<int32, SHMBuffer*> bitstream_buffers_in_decoder_; | 221 std::map<int32, SHMBuffer*> bitstream_buffers_in_decoder_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // A buffer that has an id less than this should be dropped because Reset or | 268 // A buffer that has an id less than this should be dropped because Reset or |
269 // Release has been called. Guarded by |lock_|. | 269 // Release has been called. Guarded by |lock_|. |
270 int32 reset_bitstream_buffer_id_; | 270 int32 reset_bitstream_buffer_id_; |
271 | 271 |
272 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 272 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
273 }; | 273 }; |
274 | 274 |
275 } // namespace content | 275 } // namespace content |
276 | 276 |
277 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 277 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
OLD | NEW |