Commit 4a85d946 authored by Johannes Kron's avatar Johannes Kron Committed by Chromium LUCI CQ

Add UMA histograms to track the failure reason in RTCVideoDecoderAdapter

Bug: 1155078
Change-Id: Iff1f94f3c34862fc54a8ac679a75565532a5d206
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580526
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835467}
parent 1741977f
...@@ -124,6 +124,38 @@ void RecordReinitializationLatency(base::TimeDelta latency) { ...@@ -124,6 +124,38 @@ void RecordReinitializationLatency(base::TimeDelta latency) {
latency); latency);
} }
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class FallbackReason {
kSpatialLayers = 0,
kConsecutivePendingBufferOverflow = 1,
kReinitializationFailed = 2,
kPreviousErrorOnDecode = 3,
kPreviousErrorOnRegisterCallback = 4,
kMaxValue = kPreviousErrorOnRegisterCallback,
};
void RecordFallbackReason(media::VideoCodec codec,
FallbackReason fallback_reason) {
switch (codec) {
case media::VideoCodec::kCodecH264:
base::UmaHistogramEnumeration("Media.RTCVideoDecoderFallbackReason.H264",
fallback_reason);
break;
case media::VideoCodec::kCodecVP8:
base::UmaHistogramEnumeration("Media.RTCVideoDecoderFallbackReason.Vp8",
fallback_reason);
break;
case media::VideoCodec::kCodecVP9:
base::UmaHistogramEnumeration("Media.RTCVideoDecoderFallbackReason.Vp9",
fallback_reason);
break;
default:
base::UmaHistogramEnumeration("Media.RTCVideoDecoderFallbackReason.Other",
fallback_reason);
}
}
} // namespace } // namespace
// static // static
...@@ -267,9 +299,11 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image, ...@@ -267,9 +299,11 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image,
input_image.SpatialIndex().value_or(0) > 0) { input_image.SpatialIndex().value_or(0) > 0) {
#if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_ASH) #if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_ASH)
if (!base::FeatureList::IsEnabled(media::kVp9kSVCHWDecoding)) { if (!base::FeatureList::IsEnabled(media::kVp9kSVCHWDecoding)) {
RecordFallbackReason(config_.codec(), FallbackReason::kSpatialLayers);
return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
} }
#else #else
RecordFallbackReason(config_.codec(), FallbackReason::kSpatialLayers);
return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
#endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_ASH) #endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_ASH)
} }
...@@ -322,8 +356,11 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image, ...@@ -322,8 +356,11 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image,
if (ShouldReinitializeForSettingHDRColorSpace(input_image)) { if (ShouldReinitializeForSettingHDRColorSpace(input_image)) {
config_.set_color_space_info( config_.set_color_space_info(
blink::WebRtcToMediaVideoColorSpace(*input_image.ColorSpace())); blink::WebRtcToMediaVideoColorSpace(*input_image.ColorSpace()));
if (!ReinitializeSync(config_)) if (!ReinitializeSync(config_)) {
RecordFallbackReason(config_.codec(),
FallbackReason::kReinitializationFailed);
return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
}
if (input_image._frameType != webrtc::VideoFrameType::kVideoFrameKey) if (input_image._frameType != webrtc::VideoFrameType::kVideoFrameKey)
return WEBRTC_VIDEO_CODEC_ERROR; return WEBRTC_VIDEO_CODEC_ERROR;
} }
...@@ -331,8 +368,11 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image, ...@@ -331,8 +368,11 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image,
// Queue for decoding. // Queue for decoding.
{ {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
if (has_error_) if (has_error_) {
RecordFallbackReason(config_.codec(),
FallbackReason::kPreviousErrorOnDecode);
return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
}
if (pending_buffers_.size() >= kMaxPendingBuffers) { if (pending_buffers_.size() >= kMaxPendingBuffers) {
// We are severely behind. Drop pending buffers and request a keyframe to // We are severely behind. Drop pending buffers and request a keyframe to
...@@ -344,6 +384,8 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image, ...@@ -344,6 +384,8 @@ int32_t RTCVideoDecoderAdapter::Decode(const webrtc::EncodedImage& input_image,
key_frame_required_ = true; key_frame_required_ = true;
if (++consecutive_error_count_ > kMaxConsecutiveErrors) { if (++consecutive_error_count_ > kMaxConsecutiveErrors) {
decode_timestamps_.clear(); decode_timestamps_.clear();
RecordFallbackReason(config_.codec(),
FallbackReason::kConsecutivePendingBufferOverflow);
return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
} }
return WEBRTC_VIDEO_CODEC_ERROR; return WEBRTC_VIDEO_CODEC_ERROR;
...@@ -366,6 +408,10 @@ int32_t RTCVideoDecoderAdapter::RegisterDecodeCompleteCallback( ...@@ -366,6 +408,10 @@ int32_t RTCVideoDecoderAdapter::RegisterDecodeCompleteCallback(
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
decode_complete_callback_ = callback; decode_complete_callback_ = callback;
if (has_error_) {
RecordFallbackReason(config_.codec(),
FallbackReason::kPreviousErrorOnRegisterCallback);
}
return has_error_ ? WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE return has_error_ ? WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE
: WEBRTC_VIDEO_CODEC_OK; : WEBRTC_VIDEO_CODEC_OK;
} }
......
...@@ -64567,6 +64567,14 @@ https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf ...@@ -64567,6 +64567,14 @@ https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf
<int value="2" label="NoDataWithFin"/> <int value="2" label="NoDataWithFin"/>
</enum> </enum>
<enum name="RTCVideoDecoderFallbackReason">
<int value="0" label="SpatialLayers"/>
<int value="1" label="ConsecutivePendingBufferOverflow"/>
<int value="2" label="ReinitializationFailed"/>
<int value="3" label="PreviousErrorOnDecode"/>
<int value="4" label="PreviousErrorOnRegisterCallback"/>
</enum>
<enum name="RulesetVerificationStatus"> <enum name="RulesetVerificationStatus">
<int value="0" label="Not verified"/> <int value="0" label="Not verified"/>
<int value="1" label="Intact"/> <int value="1" label="Intact"/>
...@@ -3165,6 +3165,21 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -3165,6 +3165,21 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<summary>Counts of video decode errors reported to RTCVideoDecoder.</summary> <summary>Counts of video decode errors reported to RTCVideoDecoder.</summary>
</histogram> </histogram>
<histogram name="Media.RTCVideoDecoderFallbackReason.{Codecs}"
enum="RTCVideoDecoderFallbackReason" expires_after="2021-06-01">
<owner>kron@chromium.org</owner>
<owner>webrtc-video@google.com</owner>
<summary>
The reason for fallback to software decoding for the codec {Codecs}.
</summary>
<token key="Codecs">
<variant name="H264" summary=""/>
<variant name="Other" summary=""/>
<variant name="Vp8" summary=""/>
<variant name="Vp9" summary=""/>
</token>
</histogram>
<histogram name="Media.RTCVideoDecoderInitDecodeSuccess" enum="BooleanSuccess" <histogram name="Media.RTCVideoDecoderInitDecodeSuccess" enum="BooleanSuccess"
expires_after="never"> expires_after="never">
<!-- expires-never: WebRTC health metric. --> <!-- expires-never: WebRTC health metric. -->
......
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