Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; | 187 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; |
| 188 | 188 |
| 189 // Query factories_ whether |profile| is supported and return true is so, | 189 // Query factories_ whether |profile| is supported and return true is so, |
| 190 // false otherwise. If true, also set resolution limits for |profile| | 190 // false otherwise. If true, also set resolution limits for |profile| |
| 191 // in min/max_resolution_. | 191 // in min/max_resolution_. |
| 192 bool IsProfileSupported(media::VideoCodecProfile profile); | 192 bool IsProfileSupported(media::VideoCodecProfile profile); |
| 193 | 193 |
| 194 // Clear the pending_buffers_ queue, freeing memory. | 194 // Clear the pending_buffers_ queue, freeing memory. |
| 195 void ClearPendingBuffers(); | 195 void ClearPendingBuffers(); |
| 196 | 196 |
| 197 // Keep track of VDA errors. | |
|
mcasas
2016/04/01 16:39:09
s/Keep/Keeps/ , from [1]
"These comments should b
emircan
2016/04/05 18:02:18
Done.
| |
| 198 void IncrementVDAErrorCounter(); | |
| 199 | |
| 200 // Reset |vda_error_counter_| after a successfull run of decode. | |
| 201 void TryResetVDAErrorCounter(); | |
| 202 | |
| 197 enum State { | 203 enum State { |
| 198 UNINITIALIZED, // The decoder has not initialized. | 204 UNINITIALIZED, // The decoder has not initialized. |
| 199 INITIALIZED, // The decoder has initialized. | 205 INITIALIZED, // The decoder has initialized. |
| 200 RESETTING, // The decoder is being reset. | 206 RESETTING, // The decoder is being reset. |
| 201 DECODE_ERROR, // Decoding error happened. | 207 DECODE_ERROR, // Decoding error happened. |
| 202 }; | 208 }; |
| 203 | 209 |
| 204 static const int32_t ID_LAST; // maximum bitstream buffer id | 210 static const int32_t ID_LAST; // maximum bitstream buffer id |
| 205 static const int32_t ID_HALF; // half of the maximum bitstream buffer id | 211 static const int32_t ID_HALF; // half of the maximum bitstream buffer id |
| 206 static const int32_t ID_INVALID; // indicates Reset or Release never occurred | 212 static const int32_t ID_INVALID; // indicates Reset or Release never occurred |
| 207 | 213 |
| 208 // The hardware video decoder. | 214 // The hardware video decoder. |
| 209 scoped_ptr<media::VideoDecodeAccelerator> vda_; | 215 scoped_ptr<media::VideoDecodeAccelerator> vda_; |
| 210 | 216 |
| 211 media::VideoCodecProfile vda_codec_profile_; | 217 media::VideoCodecProfile vda_codec_profile_; |
| 212 | 218 |
| 213 // Number of times that |vda_| notified of an error. | 219 // Number of times that |vda_| notified of an error. |
| 214 uint32_t num_vda_errors_; | 220 uint32_t vda_error_counter_; |
| 221 | |
| 222 // Number of decode completed consecutively since the last vda error. | |
| 223 uint32_t num_consecutive_vda_success_since_error_; | |
| 215 | 224 |
| 216 // The video codec type, as reported by WebRTC. | 225 // The video codec type, as reported by WebRTC. |
| 217 const webrtc::VideoCodecType video_codec_type_; | 226 const webrtc::VideoCodecType video_codec_type_; |
| 218 | 227 |
| 219 // The size of the incoming video frames. | 228 // The size of the incoming video frames. |
| 220 gfx::Size frame_size_; | 229 gfx::Size frame_size_; |
| 221 | 230 |
| 222 media::GpuVideoAcceleratorFactories* const factories_; | 231 media::GpuVideoAcceleratorFactories* const factories_; |
| 223 | 232 |
| 224 // The texture target used for decoded pictures. | 233 // The texture target used for decoded pictures. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 239 // to us via ReusePictureBuffer. | 248 // to us via ReusePictureBuffer. |
| 240 typedef std::map<int32_t /* picture_buffer_id */, uint32_t /* texture_id */> | 249 typedef std::map<int32_t /* picture_buffer_id */, uint32_t /* texture_id */> |
| 241 PictureBufferTextureMap; | 250 PictureBufferTextureMap; |
| 242 PictureBufferTextureMap picture_buffers_at_display_; | 251 PictureBufferTextureMap picture_buffers_at_display_; |
| 243 | 252 |
| 244 // The id that will be given to the next picture buffer. | 253 // The id that will be given to the next picture buffer. |
| 245 int32_t next_picture_buffer_id_; | 254 int32_t next_picture_buffer_id_; |
| 246 | 255 |
| 247 // Protects |state_|, |decode_complete_callback_| , |num_shm_buffers_|, | 256 // Protects |state_|, |decode_complete_callback_| , |num_shm_buffers_|, |
| 248 // |available_shm_segments_|, |pending_buffers_|, |decode_buffers_|, | 257 // |available_shm_segments_|, |pending_buffers_|, |decode_buffers_|, |
| 249 // |next_bitstream_buffer_id_| and |reset_bitstream_buffer_id_|. | 258 // |next_bitstream_buffer_id_| and |reset_bitstream_buffer_id_|. |
|
mcasas
2016/04/01 16:39:09
Now |lock_| also protects |vda_error_counter_| and
emircan
2016/04/05 18:02:18
Yes. Done.
| |
| 250 base::Lock lock_; | 259 base::Lock lock_; |
| 251 | 260 |
| 252 // The state of RTCVideoDecoder. Guarded by |lock_|. | 261 // The state of RTCVideoDecoder. Guarded by |lock_|. |
| 253 State state_; | 262 State state_; |
| 254 | 263 |
| 255 // Guarded by |lock_|. | 264 // Guarded by |lock_|. |
| 256 webrtc::DecodedImageCallback* decode_complete_callback_; | 265 webrtc::DecodedImageCallback* decode_complete_callback_; |
| 257 | 266 |
| 258 // Total number of allocated SHM buffers. Guarded by |lock_|. | 267 // Total number of allocated SHM buffers. Guarded by |lock_|. |
| 259 size_t num_shm_buffers_; | 268 size_t num_shm_buffers_; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 286 // Must be destroyed, or invalidated, on |vda_loop_proxy_| | 295 // Must be destroyed, or invalidated, on |vda_loop_proxy_| |
| 287 // NOTE: Weak pointers must be invalidated before all other member variables. | 296 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 288 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; | 297 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; |
| 289 | 298 |
| 290 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 299 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
| 291 }; | 300 }; |
| 292 | 301 |
| 293 } // namespace content | 302 } // namespace content |
| 294 | 303 |
| 295 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 304 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
| OLD | NEW |