mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Bug 1670827 - P1: Telemetry tracking decode results r=jbauman
Add a telemetry probe tracking all kinds of decode results of the AVIF decoder Differential Revision: https://phabricator.services.mozilla.com/D93291
This commit is contained in:
parent
fd31cffe8e
commit
a2ff64d95f
@ -15,11 +15,15 @@
|
||||
|
||||
#include "SurfacePipeFactory.h"
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace image {
|
||||
|
||||
using Telemetry::LABELS_AVIF_DECODE_RESULT;
|
||||
|
||||
static LazyLogModule sAVIFLog("AVIFDecoder");
|
||||
|
||||
// Wrapper to allow rust to call our read adaptor.
|
||||
@ -395,6 +399,23 @@ bool nsAVIFDecoder::DecodeWithAOM(const Mp4parseByteData& aPrimaryItem,
|
||||
|
||||
LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
IResumable* aOnResume) {
|
||||
DecodeResult r = Decode(aIterator, aOnResume);
|
||||
|
||||
RecordDecodeResultTelemetry(r);
|
||||
|
||||
if (r == DecodeResult::NeedMoreData) {
|
||||
return LexerResult(Yield::NEED_MORE_DATA);
|
||||
}
|
||||
|
||||
if (r == DecodeResult::Success || r == DecodeResult::MetadataOk) {
|
||||
return LexerResult(TerminalState::SUCCESS);
|
||||
}
|
||||
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
}
|
||||
|
||||
nsAVIFDecoder::DecodeResult nsAVIFDecoder::Decode(
|
||||
SourceBufferIterator& aIterator, IResumable* aOnResume) {
|
||||
MOZ_LOG(sAVIFLog, LogLevel::Debug,
|
||||
("[this=%p] nsAVIFDecoder::DoDecode", this));
|
||||
|
||||
@ -412,7 +433,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
|
||||
switch (state) {
|
||||
case SourceBufferIterator::WAITING:
|
||||
return LexerResult(Yield::NEED_MORE_DATA);
|
||||
return DecodeResult::NeedMoreData;
|
||||
|
||||
case SourceBufferIterator::COMPLETE:
|
||||
mReadCursor = mBufferedData.begin();
|
||||
@ -449,7 +470,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
}
|
||||
|
||||
if (!mParser) {
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
return DecodeResult::ParseError;
|
||||
}
|
||||
|
||||
Mp4parseByteData primaryItem = {};
|
||||
@ -460,7 +481,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
status, primaryItem.length));
|
||||
|
||||
if (status != MP4PARSE_STATUS_OK) {
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
return DecodeResult::NoPrimaryItem;
|
||||
}
|
||||
|
||||
layers::PlanarYCbCrData decodedData;
|
||||
@ -473,7 +494,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
StaticPrefs::image_avif_use_dav1d() ? "Dav1d" : "AOM",
|
||||
decodeOK ? "OK" : "Fail"));
|
||||
if (!decodeOK) {
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
return DecodeResult::DecodeError;
|
||||
}
|
||||
|
||||
PostSize(decodedData.mPicSize.width, decodedData.mPicSize.height);
|
||||
@ -485,7 +506,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
}
|
||||
|
||||
if (IsMetadataDecode()) {
|
||||
return LexerResult(TerminalState::SUCCESS);
|
||||
return DecodeResult::MetadataOk;
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat format =
|
||||
@ -505,7 +526,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
"rgbSize.height: %d, "
|
||||
"bytesPerPixel: %u",
|
||||
this, rgbSize.width, rgbSize.height, bytesPerPixel));
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
return DecodeResult::SizeOverflow;
|
||||
}
|
||||
|
||||
UniquePtr<uint8_t[]> rgbBuf = MakeUnique<uint8_t[]>(rgbBufLength.value());
|
||||
@ -515,7 +536,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
MOZ_LOG(sAVIFLog, LogLevel::Debug,
|
||||
("[this=%p] allocation of %u-byte rgbBuf failed", this,
|
||||
rgbBufLength.value()));
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
return DecodeResult::OutOfMemory;
|
||||
}
|
||||
|
||||
MOZ_LOG(sAVIFLog, LogLevel::Debug,
|
||||
@ -532,7 +553,7 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
if (!pipe) {
|
||||
MOZ_LOG(sAVIFLog, LogLevel::Debug,
|
||||
("[this=%p] could not initialize surface pipe", this));
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
return DecodeResult::PipeInitError;
|
||||
}
|
||||
|
||||
MOZ_LOG(sAVIFLog, LogLevel::Debug, ("[this=%p] writing to surface", this));
|
||||
@ -563,10 +584,47 @@ LexerResult nsAVIFDecoder::DoDecode(SourceBufferIterator& aIterator,
|
||||
PostFrameStop(hasAlpha ? Opacity::SOME_TRANSPARENCY
|
||||
: Opacity::FULLY_OPAQUE);
|
||||
PostDecodeDone();
|
||||
return LexerResult(TerminalState::SUCCESS);
|
||||
return DecodeResult::Success;
|
||||
}
|
||||
|
||||
return LexerResult(TerminalState::FAILURE);
|
||||
return DecodeResult::WriteBufferError;
|
||||
}
|
||||
|
||||
void nsAVIFDecoder::RecordDecodeResultTelemetry(
|
||||
nsAVIFDecoder::DecodeResult aResult) {
|
||||
switch (aResult) {
|
||||
case DecodeResult::NeedMoreData:
|
||||
break;
|
||||
case DecodeResult::MetadataOk:
|
||||
break;
|
||||
case DecodeResult::Success:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::success);
|
||||
break;
|
||||
case DecodeResult::ParseError:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::parse_error);
|
||||
break;
|
||||
case DecodeResult::NoPrimaryItem:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::no_primary_item);
|
||||
break;
|
||||
case DecodeResult::DecodeError:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::decode_error);
|
||||
break;
|
||||
case DecodeResult::SizeOverflow:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::size_overflow);
|
||||
break;
|
||||
case DecodeResult::OutOfMemory:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::out_of_memory);
|
||||
break;
|
||||
case DecodeResult::PipeInitError:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::pipe_init_error);
|
||||
break;
|
||||
case DecodeResult::WriteBufferError:
|
||||
AccumulateCategorical(LABELS_AVIF_DECODE_RESULT::write_buffer_error);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("unknown result");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace image
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "aom/aom_decoder.h"
|
||||
#include "dav1d/dav1d.h"
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace image {
|
||||
class RasterImage;
|
||||
@ -44,6 +46,23 @@ class nsAVIFDecoder final : public Decoder {
|
||||
bool DecodeWithAOM(const Mp4parseByteData& aPrimaryItem,
|
||||
layers::PlanarYCbCrData& aDecodedData);
|
||||
|
||||
enum class DecodeResult {
|
||||
NeedMoreData,
|
||||
MetadataOk,
|
||||
Success,
|
||||
ParseError,
|
||||
NoPrimaryItem,
|
||||
DecodeError,
|
||||
SizeOverflow,
|
||||
OutOfMemory,
|
||||
PipeInitError,
|
||||
WriteBufferError
|
||||
};
|
||||
|
||||
DecodeResult Decode(SourceBufferIterator& aIterator, IResumable* aOnResume);
|
||||
|
||||
void RecordDecodeResultTelemetry(DecodeResult aResult);
|
||||
|
||||
Mp4parseAvifParser* mParser;
|
||||
Maybe<Variant<aom_codec_ctx_t, Dav1dContext*>> mCodecContext;
|
||||
|
||||
|
@ -1640,6 +1640,26 @@
|
||||
"description": "Track how many image requests required event dispatching because we were unable to predict the correct scheduler group: true if the request required dispatching. See image/imgRequestProxy.cpp for details.",
|
||||
"bug_numbers": [1359833]
|
||||
},
|
||||
"AVIF_DECODE_RESULT": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "geckoview_streaming"],
|
||||
"alert_emails": ["cchang@mozilla.com", "jbauman@mozilla.com"],
|
||||
"expires_in_version": "never",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"kind": "categorical",
|
||||
"labels": [
|
||||
"success",
|
||||
"parse_error",
|
||||
"no_primary_item",
|
||||
"decode_error",
|
||||
"size_overflow",
|
||||
"out_of_memory",
|
||||
"pipe_init_error",
|
||||
"write_buffer_error"
|
||||
],
|
||||
"description": "Decode result of AVIF image",
|
||||
"bug_numbers": [1670827]
|
||||
},
|
||||
"KEYPRESS_PRESENT_LATENCY": {
|
||||
"record_in_processes": [ "all" ],
|
||||
"products": ["firefox", "fennec", "geckoview_streaming"],
|
||||
|
@ -794,6 +794,30 @@ gfx.status:
|
||||
- jmuizelaar@mozilla.com
|
||||
expires: never
|
||||
|
||||
avif:
|
||||
decode_result:
|
||||
type: labeled_counter
|
||||
labels:
|
||||
- success
|
||||
- parse_error
|
||||
- no_primary_item
|
||||
- decode_error
|
||||
- size_overflow
|
||||
- out_of_memory
|
||||
- pipe_init_error
|
||||
- write_buffer_error
|
||||
gecko_datapoint: AVIF_DECODE_RESULT
|
||||
description: >
|
||||
Decode result of AVIF image.
|
||||
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
|
||||
|
||||
network:
|
||||
cache_hit_time:
|
||||
type: timing_distribution
|
||||
|
Loading…
x
Reference in New Issue
Block a user