From d00fc5db087ac126b709b8598963b6be3851faba Mon Sep 17 00:00:00 2001 From: Andrew Osmond Date: Fri, 15 Dec 2023 22:18:41 +0000 Subject: [PATCH] Bug 1870346 - Add WebCodecs pref to force decoding of H264 on OSX for testing. r=media-playback-reviewers,chunmin This is needed so that we can write talos tests that exercise different codecs on Windows/OSX/Linux. We can't distinguish between platforms to skip or gracefully fail this test for a particular platform, and since the H264 we are testing with is able to be decoded successfully, let's just make a pref to allow us (and others) to test with what we have implemented even if partially broken. Differential Revision: https://phabricator.services.mozilla.com/D196603 --- dom/media/webcodecs/VideoDecoder.cpp | 4 +++- modules/libpref/init/StaticPrefList.yaml | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dom/media/webcodecs/VideoDecoder.cpp b/dom/media/webcodecs/VideoDecoder.cpp index f9c88c763fa9..be831169e619 100644 --- a/dom/media/webcodecs/VideoDecoder.cpp +++ b/dom/media/webcodecs/VideoDecoder.cpp @@ -19,6 +19,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/Logging.h" #include "mozilla/Maybe.h" +#include "mozilla/StaticPrefs_dom.h" #include "mozilla/Try.h" #include "mozilla/Unused.h" #include "mozilla/dom/EncodedVideoChunk.h" @@ -232,7 +233,8 @@ static bool CanDecode(const Config& aConfig) { if (!IsSupportedCodec(param.mParsedCodec)) { return false; } - if (IsOnMacOS() && IsH264CodecString(param.mParsedCodec)) { + if (IsOnMacOS() && IsH264CodecString(param.mParsedCodec) && + !StaticPrefs::dom_media_webcodecs_force_osx_h264_enabled()) { // This will be fixed in Bug 1846796. return false; } diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 7f10cadc2a10..2e96d0fd698b 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -3042,6 +3042,11 @@ value: @IS_NIGHTLY_BUILD@ mirror: always +- name: dom.media.webcodecs.force-osx-h264-enabled + type: RelaxedAtomicBool + value: false + mirror: always + # Number of seconds of very quiet or silent audio before considering the audio # inaudible. - name: dom.media.silence_duration_for_audibility