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 // Weak pointer to this, which can be dereferenced only on |vda_loop_proxy_|. | 204 // Weak pointer to this, which can be dereferenced only on |vda_task_runner_|. |
205 base::WeakPtr<RTCVideoDecoder> weak_this_; | 205 base::WeakPtr<RTCVideoDecoder> weak_this_; |
206 | 206 |
207 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; | 207 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; |
208 | 208 |
209 // The message loop to run callbacks on. This is from |factories_|. | 209 // The task runner to run callbacks on. This is from |factories_|. |
210 scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_; | 210 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_; |
211 | 211 |
212 // The texture target used for decoded pictures. | 212 // The texture target used for decoded pictures. |
213 uint32 decoder_texture_target_; | 213 uint32 decoder_texture_target_; |
214 | 214 |
215 // Metadata of the buffers that have been sent for decode. | 215 // Metadata of the buffers that have been sent for decode. |
216 std::list<BufferData> input_buffer_data_; | 216 std::list<BufferData> input_buffer_data_; |
217 | 217 |
218 // A map from bitstream buffer IDs to bitstream buffers that are being | 218 // A map from bitstream buffer IDs to bitstream buffers that are being |
219 // processed by VDA. The map owns SHM buffers. | 219 // processed by VDA. The map owns SHM buffers. |
220 std::map<int32, SHMBuffer*> bitstream_buffers_in_decoder_; | 220 std::map<int32, SHMBuffer*> bitstream_buffers_in_decoder_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // Factory used to populate |weak_this_|. Must be destroyed, or invalidated, | 271 // Factory used to populate |weak_this_|. Must be destroyed, or invalidated, |
272 // on |vda_loop_proxy_|. | 272 // on |vda_loop_proxy_|. |
273 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; | 273 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; |
274 | 274 |
275 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 275 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
276 }; | 276 }; |
277 | 277 |
278 } // namespace content | 278 } // namespace content |
279 | 279 |
280 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 280 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
OLD | NEW |