Commit b445603c authored by Frank Liberato's avatar Frank Liberato Committed by Chromium LUCI CQ

Remove `consecutive_error_count_` from DecoderStreamAdapter

When RTCVideoDecoderStreamAdapter detects that too many frames are
pending decode, it resets once and increases the maximum threshold
for underflow to allow the DecoderStream to restart.  If it runs
out of space a second time, then it'll fall back to software.

Counting the number of consecutive failures (== without a decoded
video frame) isn't meaningful; it can be at most two.  It has a
similar effect as the consecutive error count, though; after 40
frames input without one decoded frame, it will fall back to
software decoding.

Bug: 1150100
Change-Id: Ie846a98c4002153cde119a32b5bdb1485ed44fc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2591457Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836932}
parent 5caa1dea
...@@ -73,10 +73,6 @@ constexpr int32_t kMaxPendingBuffers = 8; ...@@ -73,10 +73,6 @@ constexpr int32_t kMaxPendingBuffers = 8;
// never completed, or (c) we're hopelessly behind. // never completed, or (c) we're hopelessly behind.
constexpr int32_t kAbsoluteMaxPendingBuffers = 32; constexpr int32_t kAbsoluteMaxPendingBuffers = 32;
// Maximum number of consecutive frames that can fail to decode before
// requesting fallback to software decode.
constexpr int32_t kMaxConsecutiveErrors = 5;
// Map webrtc::VideoCodecType to media::VideoCodec. // Map webrtc::VideoCodecType to media::VideoCodec.
media::VideoCodec ToVideoCodec(webrtc::VideoCodecType video_codec_type) { media::VideoCodec ToVideoCodec(webrtc::VideoCodecType video_codec_type) {
switch (video_codec_type) { switch (video_codec_type) {
...@@ -445,12 +441,8 @@ int32_t RTCVideoDecoderStreamAdapter::Decode( ...@@ -445,12 +441,8 @@ int32_t RTCVideoDecoderStreamAdapter::Decode(
// drop any other non-key frame. // drop any other non-key frame.
key_frame_required_ = true; key_frame_required_ = true;
// If we hit the limit too many times, or if we hit the absolute limit, // If we hit the absolute limit, then give up.
// then give up. if (pending_buffer_count_ >= kAbsoluteMaxPendingBuffers) {
// TODO(crbug.com/1150100): `consecutive_error_count_` doesn't measure
// this now. Probably the whole case can be removed.
if (++consecutive_error_count_ > kMaxConsecutiveErrors ||
pending_buffer_count_ >= kAbsoluteMaxPendingBuffers) {
has_error_ = true; has_error_ = true;
PostCrossThreadTask( PostCrossThreadTask(
*media_task_runner_.get(), FROM_HERE, *media_task_runner_.get(), FROM_HERE,
...@@ -668,7 +660,6 @@ void RTCVideoDecoderStreamAdapter::OnFrameReady( ...@@ -668,7 +660,6 @@ void RTCVideoDecoderStreamAdapter::OnFrameReady(
if (pending_buffer_count_ > 0) if (pending_buffer_count_ > 0)
pending_buffer_count_--; pending_buffer_count_--;
decode_complete_callback_->Decoded(rtc_frame); decode_complete_callback_->Decoded(rtc_frame);
consecutive_error_count_ = 0;
AdjustQueueLength_Locked(); AdjustQueueLength_Locked();
} }
......
...@@ -157,7 +157,6 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter ...@@ -157,7 +157,6 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter
// Shared members. // Shared members.
base::Lock lock_; base::Lock lock_;
int32_t consecutive_error_count_ GUARDED_BY(lock_) = 0;
bool has_error_ GUARDED_BY(lock_) = false; bool has_error_ GUARDED_BY(lock_) = false;
// Current maximum number of in-flight undecoded frames. // Current maximum number of in-flight undecoded frames.
size_t max_pending_buffer_count_ GUARDED_BY(lock_); size_t max_pending_buffer_count_ GUARDED_BY(lock_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment