From eeae815abc01272695a75432040951944175a6e6 Mon Sep 17 00:00:00 2001 From: Chun-Min Chang Date: Tue, 3 Nov 2020 01:57:10 +0000 Subject: [PATCH] Bug 1670827 - P5: Telemetry tracking decoder errors r=jbauman Add a telemetry probe tracking the errors in dav1d or aom decoder. We only care the errors from `aom_codec_decode` and `dav1d_get_picture` so other error code won't be counted. Differential Revision: https://phabricator.services.mozilla.com/D94489 --- image/decoders/nsAVIFDecoder.cpp | 14 ++++++++ toolkit/components/telemetry/Scalars.yaml | 35 +++++++++++++++++++ .../geckoview/streaming/metrics.yaml | 30 ++++++++++++++++ 3 files changed, 79 insertions(+) diff --git a/image/decoders/nsAVIFDecoder.cpp b/image/decoders/nsAVIFDecoder.cpp index 5068a6e8179b..0d47c237dcfa 100644 --- a/image/decoders/nsAVIFDecoder.cpp +++ b/image/decoders/nsAVIFDecoder.cpp @@ -26,6 +26,7 @@ using Telemetry::LABELS_AVIF_BIT_DEPTH; using Telemetry::LABELS_AVIF_DECODE_RESULT; using Telemetry::LABELS_AVIF_DECODER; using Telemetry::LABELS_AVIF_YUV_COLOR_SPACE; +using Telemetry::ScalarID; static LazyLogModule sAVIFLog("AVIFDecoder"); @@ -165,6 +166,14 @@ nsAVIFDecoder::Dav1dResult nsAVIFDecoder::DecodeWithDav1d( MOZ_LOG(sAVIFLog, res == 0 ? LogLevel::Debug : LogLevel::Error, ("[this=%p] dav1d_get_picture -> %d", this, res)); + // Discard the value outside of the range of uint32 + if (!IsMetadataDecode() && std::numeric_limits::digits <= 31) { + // De-negate POSIX error code returned from DAV1D. This must be sync with + // DAV1D_ERR macro. + uint32_t value = res < 0 ? -res : res; + ScalarSet(ScalarID::AVIF_DAV1D_DECODE_ERROR, value); + } + if (res != 0) { return res; } @@ -290,6 +299,11 @@ nsAVIFDecoder::AOMResult nsAVIFDecoder::DecodeWithAOM( MOZ_LOG(sAVIFLog, res == AOM_CODEC_OK ? LogLevel::Verbose : LogLevel::Error, ("[this=%p] aom_codec_decode -> %d", this, res)); + if (!IsMetadataDecode()) { + uint32_t value = static_cast(res); + ScalarSet(ScalarID::AVIF_AOM_DECODE_ERROR, value); + } + if (res != AOM_CODEC_OK) { return AsVariant(res); } diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index 0055663337fc..ed44b8256c10 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -2139,6 +2139,41 @@ media: record_in_processes: - main +avif: + dav1d_decode_error: + bug_numbers: + - 1670827 + description: > + Image-decode Error from dav1d decoder + kind: uint + expires: "never" + notification_emails: + - cchang@mozilla.com + - jbauman@mozilla.com + products: + - 'firefox' + - 'geckoview_streaming' + record_in_processes: + - 'main' + - 'content' + + aom_decode_error: + bug_numbers: + - 1670827 + description: > + Image-decode Error from aom decoder + kind: uint + expires: "never" + notification_emails: + - cchang@mozilla.com + - jbauman@mozilla.com + products: + - 'firefox' + - 'geckoview_streaming' + record_in_processes: + - 'main' + - 'content' + # The following section contains content process base counters. dom.contentprocess: buildID_mismatch: diff --git a/toolkit/components/telemetry/geckoview/streaming/metrics.yaml b/toolkit/components/telemetry/geckoview/streaming/metrics.yaml index 070509fa065a..f32e9797de1a 100644 --- a/toolkit/components/telemetry/geckoview/streaming/metrics.yaml +++ b/toolkit/components/telemetry/geckoview/streaming/metrics.yaml @@ -835,6 +835,36 @@ avif: - jbauman@mozilla.com expires: never + aom_decode_error: + type: quantity + unit: error code + gecko_datapoint: avif.aom_decode_error + description: > + Image-decode Error from AOM decoder + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1670827 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1670827#c9 + notification_emails: + - cchang@mozilla.com + - jbauman@mozilla.com + expires: never + + dav1d_decode_error: + type: quantity + unit: error code + gecko_datapoint: avif.dav1d_decode_error + description: > + Image-decode Error from dav1d decoder + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1670827 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1670827#c9 + notification_emails: + - cchang@mozilla.com + - jbauman@mozilla.com + expires: never + yuv_color_space: type: labeled_counter labels: