Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 8974dd5

Browse files
committed
Bug 1690406 - Update AVIF telemetry probes. r=chutten
Differential Revision: https://phabricator.services.mozilla.com/D104448
1 parent 4c2a389 commit 8974dd5

File tree

6 files changed

+100
-63
lines changed

6 files changed

+100
-63
lines changed

image/decoders/nsAVIFDecoder.cpp

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717
#include "SurfacePipeFactory.h"
1818

1919
#include "mozilla/Telemetry.h"
20+
#include "mozilla/TelemetryComms.h"
2021

2122
using namespace mozilla::gfx;
2223

2324
namespace mozilla {
2425
namespace image {
2526

27+
using Telemetry::LABELS_AVIF_AOM_DECODE_ERROR;
2628
using Telemetry::LABELS_AVIF_BIT_DEPTH;
2729
using Telemetry::LABELS_AVIF_DECODE_RESULT;
2830
using Telemetry::LABELS_AVIF_DECODER;
2931
using Telemetry::LABELS_AVIF_YUV_COLOR_SPACE;
30-
using Telemetry::ScalarID;
3132

3233
static LazyLogModule sAVIFLog("AVIFDecoder");
3334

@@ -270,12 +271,20 @@ class Dav1dDecoder final : AVIFDecoderInterface {
270271
MOZ_LOG(sAVIFLog, r == 0 ? LogLevel::Debug : LogLevel::Error,
271272
("[this=%p] dav1d_get_picture -> %d", this, r));
272273

273-
// Discard the value outside of the range of uint32
274-
if (!aIsMetadataDecode && std::numeric_limits<int>::digits <= 31) {
275-
// De-negate POSIX error code returned from DAV1D. This must be sync with
276-
// DAV1D_ERR macro.
277-
uint32_t value = r < 0 ? -r : r;
278-
ScalarSet(ScalarID::AVIF_DAV1D_DECODE_ERROR, value);
274+
// When bug 1682662 is fixed, revise this assert and subsequent condition
275+
MOZ_ASSERT(aIsMetadataDecode || r == 0);
276+
277+
// We already have the AVIF_DECODE_RESULT histogram to record all the
278+
// successful calls, so only bother recording what type of errors we see
279+
// via events. Unlike AOM, dav1d returns an int, not an enum, so this is the
280+
// easiest way to see if we're getting unexpected behavior to investigate.
281+
if (aIsMetadataDecode && r != 0) {
282+
// Uncomment once bug 1691156 is fixed
283+
// mozilla::Telemetry::SetEventRecordingEnabled("avif"_ns, true);
284+
285+
mozilla::Telemetry::RecordEvent(
286+
mozilla::Telemetry::EventID::Avif_Dav1dGetPicture_ReturnValue,
287+
Some(nsPrintfCString("%d", r)), Nothing());
279288
}
280289

281290
return r;
@@ -422,8 +431,38 @@ class AOMDecoder final : AVIFDecoderInterface {
422431
("[this=%p] aom_codec_decode -> %d", this, r));
423432

424433
if (aIsMetadataDecode) {
425-
uint32_t value = static_cast<uint32_t>(r);
426-
ScalarSet(ScalarID::AVIF_AOM_DECODE_ERROR, value);
434+
switch (r) {
435+
case AOM_CODEC_OK:
436+
// No need to record any telemetry for the common case
437+
break;
438+
case AOM_CODEC_ERROR:
439+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::error);
440+
break;
441+
case AOM_CODEC_MEM_ERROR:
442+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::mem_error);
443+
break;
444+
case AOM_CODEC_ABI_MISMATCH:
445+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::abi_mismatch);
446+
break;
447+
case AOM_CODEC_INCAPABLE:
448+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::incapable);
449+
break;
450+
case AOM_CODEC_UNSUP_BITSTREAM:
451+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::unsup_bitstream);
452+
break;
453+
case AOM_CODEC_UNSUP_FEATURE:
454+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::unsup_feature);
455+
break;
456+
case AOM_CODEC_CORRUPT_FRAME:
457+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::corrupt_frame);
458+
break;
459+
case AOM_CODEC_INVALID_PARAM:
460+
AccumulateCategorical(LABELS_AVIF_AOM_DECODE_ERROR::invalid_param);
461+
break;
462+
default:
463+
MOZ_ASSERT_UNREACHABLE(
464+
"Unknown aom_codec_err_t value from aom_codec_decode");
465+
}
427466
}
428467

429468
if (r != AOM_CODEC_OK) {

toolkit/components/telemetry/Events.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2621,6 +2621,20 @@ dom.quota.try:
26212621
source_file: The name of the source code file where the error occured.
26222622
source_line: The line within source_file where the error occured.
26232623

2624+
avif:
2625+
dav1d_get_picture:
2626+
objects: ["return_value"]
2627+
bug_numbers: [1690406]
2628+
description: Return value from dav1d_get_picture
2629+
products:
2630+
- firefox # event telemetry is not supported on fenix
2631+
record_in_processes: ["all"]
2632+
release_channel_collection: opt-out
2633+
expiry_version: never
2634+
notification_emails:
2635+
- cchang@mozilla.com
2636+
- jbauman@mozilla.com
2637+
26242638
installation:
26252639
first_seen:
26262640
description: >

toolkit/components/telemetry/Histograms.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,26 @@
16371637
"description": "Decode result of AVIF image",
16381638
"bug_numbers": [1670827]
16391639
},
1640+
"AVIF_AOM_DECODE_ERROR": {
1641+
"record_in_processes": ["main", "content"],
1642+
"products": ["firefox", "geckoview_streaming"],
1643+
"alert_emails": ["cchang@mozilla.com", "jbauman@mozilla.com"],
1644+
"expires_in_version": "never",
1645+
"releaseChannelCollection": "opt-out",
1646+
"kind": "categorical",
1647+
"labels": [
1648+
"error",
1649+
"mem_error",
1650+
"abi_mismatch",
1651+
"incapable",
1652+
"unsup_bitstream",
1653+
"unsup_feature",
1654+
"corrupt_frame",
1655+
"invalid_param"
1656+
],
1657+
"description": "Error code from aom_codec_decode when decoding AVIF image",
1658+
"bug_numbers": [1690406]
1659+
},
16401660
"AVIF_DECODER": {
16411661
"record_in_processes": ["main", "content"],
16421662
"products": ["firefox", "geckoview_streaming"],

toolkit/components/telemetry/Scalars.yaml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,41 +2241,6 @@ media:
22412241
record_in_processes:
22422242
- 'content'
22432243

2244-
avif:
2245-
dav1d_decode_error:
2246-
bug_numbers:
2247-
- 1670827
2248-
description: >
2249-
Image-decode Error from dav1d decoder
2250-
kind: uint
2251-
expires: "never"
2252-
notification_emails:
2253-
- cchang@mozilla.com
2254-
- jbauman@mozilla.com
2255-
products:
2256-
- 'firefox'
2257-
- 'geckoview_streaming'
2258-
record_in_processes:
2259-
- 'main'
2260-
- 'content'
2261-
2262-
aom_decode_error:
2263-
bug_numbers:
2264-
- 1670827
2265-
description: >
2266-
Image-decode Error from aom decoder
2267-
kind: uint
2268-
expires: "never"
2269-
notification_emails:
2270-
- cchang@mozilla.com
2271-
- jbauman@mozilla.com
2272-
products:
2273-
- 'firefox'
2274-
- 'geckoview_streaming'
2275-
record_in_processes:
2276-
- 'main'
2277-
- 'content'
2278-
22792244
# The following section contains content process base counters.
22802245
dom.contentprocess:
22812246
buildID_mismatch:

toolkit/components/telemetry/core/TelemetryEvent.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,9 @@ void TelemetryEvent::InitializeGlobalState(bool aCanRecordBase,
712712
gCategoryNames.PutEntry(info.common_info.category());
713713
}
714714

715+
// A hack until bug 1691156 is fixed
716+
gEnabledCategories.PutEntry("avif"_ns);
717+
715718
gInitDone = true;
716719
}
717720

toolkit/components/telemetry/geckoview/streaming/metrics.yaml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -836,34 +836,30 @@ avif:
836836
expires: never
837837

838838
aom_decode_error:
839-
type: quantity
840-
unit: error code
841-
gecko_datapoint: avif.aom_decode_error
839+
type: labeled_counter
840+
labels:
841+
- error
842+
- mem_error
843+
- abi_mismatch
844+
- incapable
845+
- unsup_bitstream
846+
- unsup_feature
847+
- corrupt_frame
848+
- invalid_param
849+
gecko_datapoint: AVIF_AOM_DECODE_ERROR
842850
description: >
843851
Image-decode Error from AOM decoder
844852
bugs:
845-
- https://bugzilla.mozilla.org/show_bug.cgi?id=1670827
853+
- https://bugzilla.mozilla.org/show_bug.cgi?id=1690406
846854
data_reviews:
847-
- https://bugzilla.mozilla.org/show_bug.cgi?id=1670827#c9
855+
- https://bugzilla.mozilla.org/show_bug.cgi?id=1690406#c3
848856
notification_emails:
849857
- cchang@mozilla.com
850858
- jbauman@mozilla.com
851859
expires: never
852860

853-
dav1d_decode_error:
854-
type: quantity
855-
unit: error code
856-
gecko_datapoint: avif.dav1d_decode_error
857-
description: >
858-
Image-decode Error from dav1d decoder
859-
bugs:
860-
- https://bugzilla.mozilla.org/show_bug.cgi?id=1670827
861-
data_reviews:
862-
- https://bugzilla.mozilla.org/show_bug.cgi?id=1670827#c9
863-
notification_emails:
864-
- cchang@mozilla.com
865-
- jbauman@mozilla.com
866-
expires: never
861+
# dav1d_decode_error is replaced by avif.dav1d_get_picture in Events.yaml
862+
# Unfortunately, events are not currently supported for geckoview
867863

868864
yuv_color_space:
869865
type: labeled_counter

0 commit comments

Comments
 (0)