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 28 matching lines...) Expand all Loading... | |
144 static void ReleaseMailbox( | 145 static void ReleaseMailbox( |
145 base::WeakPtr<RTCVideoDecoder> decoder, | 146 base::WeakPtr<RTCVideoDecoder> decoder, |
146 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories, | 147 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories, |
147 int64 picture_buffer_id, | 148 int64 picture_buffer_id, |
148 uint32 texture_id, | 149 uint32 texture_id, |
149 uint32 release_sync_point); | 150 uint32 release_sync_point); |
150 // Tells VDA that a picture buffer can be recycled. | 151 // Tells VDA that a picture buffer can be recycled. |
151 void ReusePictureBuffer(int64 picture_buffer_id); | 152 void ReusePictureBuffer(int64 picture_buffer_id); |
152 | 153 |
153 // Create |vda_| on |vda_loop_proxy_|. | 154 // Create |vda_| on |vda_loop_proxy_|. |
154 void CreateVDA(media::VideoCodecProfile profile, base::WaitableEvent* waiter); | 155 void CreateVDA(media::VideoCodecProfile profile, |
156 base::WaitableEvent* waiter); | |
155 | 157 |
156 void DestroyTextures(); | 158 void DestroyTextures(); |
157 void DestroyVDA(); | 159 void DestroyVDA(); |
158 | 160 |
159 // Gets a shared-memory segment of at least |min_size| bytes from | 161 // Gets a shared-memory segment of at least |min_size| bytes from |
160 // |available_shm_segments_|. Returns NULL if there is no buffer or the | 162 // |available_shm_segments_|. Returns NULL if there is no buffer or the |
161 // buffer is not big enough. | 163 // buffer is not big enough. |
162 scoped_ptr<SHMBuffer> GetSHM_Locked(size_t min_size); | 164 scoped_ptr<SHMBuffer> GetSHM_Locked(size_t min_size); |
163 | 165 |
164 // Returns a shared-memory segment to the available pool. | 166 // Returns a shared-memory segment to the available pool. |
(...skipping 21 matching lines...) Expand all Loading... | |
186 DECODE_ERROR, // Decoding error happened. | 188 DECODE_ERROR, // Decoding error happened. |
187 }; | 189 }; |
188 | 190 |
189 static const int32 ID_LAST; // maximum bitstream buffer id | 191 static const int32 ID_LAST; // maximum bitstream buffer id |
190 static const int32 ID_HALF; // half of the maximum bitstream buffer id | 192 static const int32 ID_HALF; // half of the maximum bitstream buffer id |
191 static const int32 ID_INVALID; // indicates Reset or Release never occurred | 193 static const int32 ID_INVALID; // indicates Reset or Release never occurred |
192 | 194 |
193 // The hardware video decoder. | 195 // The hardware video decoder. |
194 scoped_ptr<media::VideoDecodeAccelerator> vda_; | 196 scoped_ptr<media::VideoDecodeAccelerator> vda_; |
195 | 197 |
198 // The video codec type, as reported to WebRTC. | |
Pawel Osciak
2014/08/12 11:06:38
Nit s/to/by/ ?
hshi1
2014/08/12 18:08:22
Done.
| |
199 const webrtc::VideoCodecType video_codec_type_; | |
200 | |
196 // The size of the incoming video frames. | 201 // The size of the incoming video frames. |
197 gfx::Size frame_size_; | 202 gfx::Size frame_size_; |
198 | 203 |
199 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; | 204 scoped_refptr<media::GpuVideoAcceleratorFactories> factories_; |
200 | 205 |
201 // The texture target used for decoded pictures. | 206 // The texture target used for decoded pictures. |
202 uint32 decoder_texture_target_; | 207 uint32 decoder_texture_target_; |
203 | 208 |
204 // Metadata of the buffers that have been sent for decode. | 209 // Metadata of the buffers that have been sent for decode. |
205 std::list<BufferData> input_buffer_data_; | 210 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_| | 264 // Must be destroyed, or invalidated, on |vda_loop_proxy_| |
260 // NOTE: Weak pointers must be invalidated before all other member variables. | 265 // NOTE: Weak pointers must be invalidated before all other member variables. |
261 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; | 266 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; |
262 | 267 |
263 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 268 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
264 }; | 269 }; |
265 | 270 |
266 } // namespace content | 271 } // namespace content |
267 | 272 |
268 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 273 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
OLD | NEW |