Bug 1699249 - part1 : add a probe to measure the source buffer usage for different mime types. r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D108885
This commit is contained in:
alwu 2021-03-29 15:59:03 +00:00
parent 897010cdec
commit 7dfd8f5884
3 changed files with 49 additions and 0 deletions

View File

@ -88,6 +88,41 @@ static bool IsVP9Forced(DecoderDoctorDiagnostics* aDiagnostics) {
namespace dom {
static void RecordTypeForTelemetry(const nsAString& aType,
nsPIDOMWindowInner* aWindow) {
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
if (!containerType) {
return;
}
const MediaMIMEType& mimeType = containerType->Type();
if (mimeType == MEDIAMIMETYPE(VIDEO_WEBM)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::VideoWebm);
} else if (mimeType == MEDIAMIMETYPE(AUDIO_WEBM)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::AudioWebm);
} else if (mimeType == MEDIAMIMETYPE(VIDEO_MP4)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::VideoMp4);
} else if (mimeType == MEDIAMIMETYPE(AUDIO_MP4)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::AudioMp4);
} else if (mimeType == MEDIAMIMETYPE(VIDEO_MPEG_TS)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::VideoMp2t);
} else if (mimeType == MEDIAMIMETYPE(AUDIO_MPEG_TS)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::AudioMp2t);
} else if (mimeType == MEDIAMIMETYPE(AUDIO_MP3)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::AudioMpeg);
} else if (mimeType == MEDIAMIMETYPE(AUDIO_AAC)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_MSE_SOURCE_BUFFER_TYPE::AudioAac);
}
}
/* static */
void MediaSource::IsTypeSupported(const nsAString& aType,
DecoderDoctorDiagnostics* aDiagnostics,
@ -241,6 +276,7 @@ already_AddRefed<SourceBuffer> MediaSource::AddSourceBuffer(
MOZ_ASSERT(NS_IsMainThread());
DecoderDoctorDiagnostics diagnostics;
IsTypeSupported(aType, &diagnostics, aRv);
RecordTypeForTelemetry(aType, GetOwner());
bool supported = !aRv.Failed();
diagnostics.StoreFormatDiagnostics(
GetOwner() ? GetOwner()->GetExtantDoc() : nullptr, aType, supported,
@ -394,6 +430,7 @@ bool MediaSource::IsTypeSupported(const GlobalObject& aOwner,
bool supported = !rv.Failed();
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(aOwner.GetAsSupports());
RecordTypeForTelemetry(aType, window);
diagnostics.StoreFormatDiagnostics(window ? window->GetExtantDoc() : nullptr,
aType, supported, __func__);
MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug,

View File

@ -90,6 +90,7 @@
#define AUDIO_MIDI "audio/x-midi"
#define AUDIO_MATROSKA "audio/x-matroska"
#define AUDIO_AAC "audio/aac"
#define AUDIO_MPEG_TS "audio/mp2t"
#define BINARY_OCTET_STREAM "binary/octet-stream"

View File

@ -13291,6 +13291,17 @@
"releaseChannelCollection": "opt-out",
"description": "Count of use of audio/video codecs in HTMLMediaElements and WebAudio. Those with 'resource' prefix are approximate; report based on HTTP ContentType or sniffing. Those with 'webaudio' prefix are for WebAudio."
},
"MSE_SOURCE_BUFFER_TYPE": {
"products": ["firefox", "geckoview_streaming"],
"record_in_processes": ["main", "content"],
"alert_emails": ["alwu@mozilla.com", "bryce@mozilla.com"],
"bug_numbers": [1699249],
"expires_in_version": "never",
"kind": "categorical",
"labels": ["VideoWebm", "AudioWebm", "VideoMp4", "AudioMp4", "VideoMp2t", "AudioMp2t", "AudioMpeg", "AudioAac"],
"releaseChannelCollection": "opt-out",
"description": "Count the actual or possible (because we don't support some of them for now) usage amount for each media mime type used in MSE. We collect this data in MediaSource's `AddSourceBuffer()` and `IsTypeSupported()`."
},
"FX_SANITIZE_TOTAL": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],