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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 ~BufferData(); | 96 ~BufferData(); |
97 int32 bitstream_buffer_id; | 97 int32 bitstream_buffer_id; |
98 uint32_t timestamp; // in 90KHz | 98 uint32_t timestamp; // in 90KHz |
99 size_t size; // buffer size | 99 size_t size; // buffer size |
100 }; | 100 }; |
101 | 101 |
102 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsBufferAfterReset); | 102 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsBufferAfterReset); |
103 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsFirstBufferAfterReset); | 103 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsFirstBufferAfterReset); |
104 | 104 |
105 RTCVideoDecoder( | 105 RTCVideoDecoder( |
| 106 webrtc::VideoCodecType type, |
106 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories); | 107 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories); |
107 | 108 |
108 // Requests a buffer to be decoded by VDA. | 109 // Requests a buffer to be decoded by VDA. |
109 void RequestBufferDecode(); | 110 void RequestBufferDecode(); |
110 | 111 |
111 bool CanMoreDecodeWorkBeDone(); | 112 bool CanMoreDecodeWorkBeDone(); |
112 | 113 |
113 // Returns true if bitstream buffer id |id_buffer| comes after |id_reset|. | 114 // Returns true if bitstream buffer id |id_buffer| comes after |id_reset|. |
114 // This handles the wraparound. | 115 // This handles the wraparound. |
115 bool IsBufferAfterReset(int32 id_buffer, int32 id_reset); | 116 bool IsBufferAfterReset(int32 id_buffer, int32 id_reset); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 DECODE_ERROR, // Decoding error happened. | 187 DECODE_ERROR, // Decoding error happened. |
187 }; | 188 }; |
188 | 189 |
189 static const int32 ID_LAST; // maximum bitstream buffer id | 190 static const int32 ID_LAST; // maximum bitstream buffer id |
190 static const int32 ID_HALF; // half of the maximum bitstream buffer id | 191 static const int32 ID_HALF; // half of the maximum bitstream buffer id |
191 static const int32 ID_INVALID; // indicates Reset or Release never occurred | 192 static const int32 ID_INVALID; // indicates Reset or Release never occurred |
192 | 193 |
193 // The hardware video decoder. | 194 // The hardware video decoder. |
194 scoped_ptr<media::VideoDecodeAccelerator> vda_; | 195 scoped_ptr<media::VideoDecodeAccelerator> vda_; |
195 | 196 |
| 197 // The video codec type, as reported by WebRTC. |
| 198 const webrtc::VideoCodecType video_codec_type_; |
| 199 |
196 // The size of the incoming video frames. | 200 // The size of the incoming video frames. |
197 gfx::Size frame_size_; | 201 gfx::Size frame_size_; |
198 | 202 |
199 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; | 203 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; |
200 | 204 |
201 // The texture target used for decoded pictures. | 205 // The texture target used for decoded pictures. |
202 uint32 decoder_texture_target_; | 206 uint32 decoder_texture_target_; |
203 | 207 |
204 // Metadata of the buffers that have been sent for decode. | 208 // Metadata of the buffers that have been sent for decode. |
205 std::list<BufferData> input_buffer_data_; | 209 std::list<BufferData> input_buffer_data_; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Must be destroyed, or invalidated, on |vda_loop_proxy_| | 263 // Must be destroyed, or invalidated, on |vda_loop_proxy_| |
260 // NOTE: Weak pointers must be invalidated before all other member variables. | 264 // NOTE: Weak pointers must be invalidated before all other member variables. |
261 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; | 265 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; |
262 | 266 |
263 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 267 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
264 }; | 268 }; |
265 | 269 |
266 } // namespace content | 270 } // namespace content |
267 | 271 |
268 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 272 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
OLD | NEW |