Index: content/renderer/media/gpu/rtc_video_decoder.cc |
diff --git a/content/renderer/media/gpu/rtc_video_decoder.cc b/content/renderer/media/gpu/rtc_video_decoder.cc |
index 51830b2938b1c1117a81a80cabaf168ea2fb57a2..1729882ab0d39d22e4cd45109d66b36396b351b6 100644 |
--- a/content/renderer/media/gpu/rtc_video_decoder.cc |
+++ b/content/renderer/media/gpu/rtc_video_decoder.cc |
@@ -236,6 +236,10 @@ int32_t RTCVideoDecoder::Decode( |
reset_bitstream_buffer_id_)) { |
// TODO(wuchengli): VDA should handle it. Remove this when |
// http://crosbug.com/p/21913 is fixed. |
+ |
+ // If we're are in an error condition, increase the counter. |
+ vda_error_counter_ += vda_error_counter_ ? 1 : 0; |
+ |
DVLOG(1) << "The first frame should be a key frame. Drop this."; |
return WEBRTC_VIDEO_CODEC_ERROR; |
} |
@@ -269,8 +273,6 @@ int32_t RTCVideoDecoder::Decode( |
base::AutoUnlock auto_unlock(lock_); |
Release(); |
} |
- |
- TryResetVDAErrorCounter_Locked(); |
return WEBRTC_VIDEO_CODEC_OK; |
} |
@@ -279,7 +281,6 @@ int32_t RTCVideoDecoder::Decode( |
FROM_HERE, |
base::Bind(&RTCVideoDecoder::RequestBufferDecode, |
weak_factory_.GetWeakPtr())); |
- TryResetVDAErrorCounter_Locked(); |
return WEBRTC_VIDEO_CODEC_OK; |
} |
@@ -443,6 +444,8 @@ void RTCVideoDecoder::PictureReady(const media::Picture& picture) { |
reset_bitstream_buffer_id_)) { |
decode_complete_callback_->Decoded(decoded_image); |
} |
+ // Reset error counter as we successfully decoded a frame. |
+ vda_error_counter_ = 0; |
} |
} |
@@ -889,12 +892,4 @@ void RTCVideoDecoder::ClearPendingBuffers() { |
pending_buffers_.clear(); |
} |
-void RTCVideoDecoder::TryResetVDAErrorCounter_Locked() { |
- lock_.AssertAcquired(); |
- |
- if (vda_error_counter_ == 0) |
- return; |
- vda_error_counter_ = 0; |
-} |
- |
} // namespace content |