From 6f21141c391cb0266f63474f7e120d0730d05d18 Mon Sep 17 00:00:00 2001 From: alwu Date: Tue, 16 Feb 2021 23:53:45 +0000 Subject: [PATCH] Bug 1690372 - part2 : add Telemetry probe for WMF usage. r=bryce Depends on D103836 Differential Revision: https://phabricator.services.mozilla.com/D103837 --- dom/media/platforms/wmf/WMFDecoderModule.cpp | 12 ++++++++++++ dom/media/platforms/wmf/WMFDecoderModule.h | 2 ++ toolkit/components/telemetry/Scalars.yaml | 17 +++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/dom/media/platforms/wmf/WMFDecoderModule.cpp b/dom/media/platforms/wmf/WMFDecoderModule.cpp index e1591bf8210f..0475e084018b 100644 --- a/dom/media/platforms/wmf/WMFDecoderModule.cpp +++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp @@ -178,6 +178,8 @@ nsresult WMFDecoderModule::Startup() { already_AddRefed WMFDecoderModule::CreateVideoDecoder( const CreateDecoderParams& aParams) { + ReportUsageForTelemetry(); + // In GPU process, only support decoding if an accelerated compositor is // known. if (XRE_IsGPUProcess() && @@ -214,6 +216,8 @@ already_AddRefed WMFDecoderModule::CreateVideoDecoder( already_AddRefed WMFDecoderModule::CreateAudioDecoder( const CreateDecoderParams& aParams) { + ReportUsageForTelemetry(); + if (XRE_IsGPUProcess()) { // Only allow video in the GPU process. return nullptr; @@ -288,6 +292,8 @@ bool WMFDecoderModule::SupportsMimeType( bool WMFDecoderModule::Supports(const SupportDecoderParams& aParams, DecoderDoctorDiagnostics* aDiagnostics) const { + ReportUsageForTelemetry(); + // In GPU process, only support decoding if video. This only gives a hint of // what the GPU decoder *may* support. The actual check will occur in // CreateVideoDecoder. @@ -341,6 +347,12 @@ bool WMFDecoderModule::Supports(const SupportDecoderParams& aParams, return false; } +void WMFDecoderModule::ReportUsageForTelemetry() const { + if (XRE_IsParentProcess() || XRE_IsContentProcess()) { + Telemetry::ScalarSet(Telemetry::ScalarID::MEDIA_WMF_PROCESS_USAGE, true); + } +} + } // namespace mozilla #undef WFM_DECODER_MODULE_STATUS_MARKER diff --git a/dom/media/platforms/wmf/WMFDecoderModule.h b/dom/media/platforms/wmf/WMFDecoderModule.h index 5bd461b1c340..d78ba0363ff0 100644 --- a/dom/media/platforms/wmf/WMFDecoderModule.h +++ b/dom/media/platforms/wmf/WMFDecoderModule.h @@ -50,6 +50,8 @@ class WMFDecoderModule : public PlatformDecoderModule { WMFDecoderModule() = default; virtual ~WMFDecoderModule(); + void ReportUsageForTelemetry() const; + bool mWMFInitialized = false; }; diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index dfa7d29238fd..bf6f1ba7d35e 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -2242,6 +2242,23 @@ media: record_in_processes: - 'content' + wmf_process_usage: + bug_numbers: + - 1690372 + description: > + Record whether the WMF decoder module is used in content or chrome process. + expires: "93" + kind: boolean + notification_emails: + - alwu@mozilla.com + - bvandyk@mozilla.com + release_channel_collection: opt-out + products: + - 'firefox' + record_in_processes: + - 'main' + - 'content' + # The following section contains content process base counters. dom.contentprocess: buildID_mismatch: