From 2e925a9a8b607f84ba0df8a29cb011ee506c12e7 Mon Sep 17 00:00:00 2001 From: alwu <alwu@mozilla.com> Date: Tue, 16 Apr 2024 20:15:12 +0000 Subject: [PATCH] Bug 1884962 - report kProtectionHDCP for the protection mask. r=media-playback-reviewers,padenot, a=dmeehan According to what Widevine told us, `kProtectionNone` will cause playback to stop if HDCP_V1 is required. Therefore, we would report HDCP protection if there is no potential capturing. Differential Revision: https://phabricator.services.mozilla.com/D207483 --- dom/media/gmp/ChromiumCDMProxy.cpp | 9 ++++++++- modules/libpref/init/StaticPrefList.yaml | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dom/media/gmp/ChromiumCDMProxy.cpp b/dom/media/gmp/ChromiumCDMProxy.cpp index 26d0475ad8980..debcb71b6fcac 100644 --- a/dom/media/gmp/ChromiumCDMProxy.cpp +++ b/dom/media/gmp/ChromiumCDMProxy.cpp @@ -7,6 +7,7 @@ #include "ChromiumCDMProxy.h" #include "ChromiumCDMCallbackProxy.h" #include "MediaResult.h" +#include "mozilla/StaticPrefs_media.h" #include "mozilla/dom/MediaKeySession.h" #include "GMPUtils.h" #include "nsPrintfCString.h" @@ -381,13 +382,19 @@ void ChromiumCDMProxy::NotifyOutputProtectionStatus( } uint32_t linkMask{}; - uint32_t protectionMask{}; // Unused/always zeroed. + uint32_t protectionMask{}; if (aCheckStatus == OutputProtectionCheckStatus::CheckSuccessful && aCaptureStatus == OutputProtectionCaptureStatus::CapturePossilbe) { // The result indicates the capture is possible, so set the mask // to indicate this. linkMask |= cdm::OutputLinkTypes::kLinkTypeNetwork; } + // `kProtectionNone` can cause playback to stop if HDCP_V1 is required. Report + // HDCP protection if there's no potential capturing. + if (linkMask == cdm::OutputLinkTypes::kLinkTypeNone && + StaticPrefs::media_widevine_hdcp_protection_mask()) { + protectionMask = cdm::OutputProtectionMethods::kProtectionHDCP; + } mGMPThread->Dispatch(NewRunnableMethod<bool, uint32_t, uint32_t>( "gmp::ChromiumCDMParent::NotifyOutputProtectionStatus", cdm, &gmp::ChromiumCDMParent::NotifyOutputProtectionStatus, diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 12ed7cfb441fc..d2e9414437f08 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -11151,6 +11151,13 @@ value: true mirror: always +# When this is true, the protection mask that Firefox replies to Widevine API +# QueryOutputProtectionStatus is `kProtectionHDCP` when no potential capturing. +- name: media.widevine.hdcp-protection-mask + type: RelaxedAtomicBool + value: true + mirror: always + #--------------------------------------------------------------------------- # Prefs starting with "midi." #--------------------------------------------------------------------------- -- GitLab