зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1892516 - part1 : explicitly disable HEVC support to avoid running the initialization again. r=media-playback-reviewers,padenot
We can actually control whether HEVC is enabled by setting `sForceEnableHEVC` to false without running decoder module's initialization again, which can save some time because the initialization is expensive. [1] https://searchfox.org/mozilla-central/rev/ee9fd5e2df79c6d69af5aa9bc36041166f483227/dom/media/platforms/wmf/WMFDecoderModule.cpp#486 Differential Revision: https://phabricator.services.mozilla.com/D208243
This commit is contained in:
Родитель
d9534e99c8
Коммит
8d2a25def5
|
@ -485,6 +485,9 @@ bool WMFDecoderModule::IsHEVCSupported() {
|
|||
return sForceEnableHEVC || StaticPrefs::media_wmf_hevc_enabled() == 1;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void WMFDecoderModule::DisableForceEnableHEVC() { sForceEnableHEVC = false; }
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#undef WFM_DECODER_MODULE_STATUS_MARKER
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
# include "PlatformDecoderModule.h"
|
||||
# include "WMF.h"
|
||||
# include "WMFUtils.h"
|
||||
# include "mozilla/Atomics.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -55,11 +56,13 @@ class WMFDecoderModule : public PlatformDecoderModule {
|
|||
RefPtr<MFTDecoder>& aDecoder);
|
||||
static bool CanCreateMFTDecoder(const WMFStreamType& aType);
|
||||
|
||||
static void DisableForceEnableHEVC();
|
||||
|
||||
private:
|
||||
// This is used for GPU process only, where we can't set the preference
|
||||
// directly (it can only set in the parent process) So we need a way to force
|
||||
// enable the HEVC in order to report the support information via telemetry.
|
||||
static inline bool sForceEnableHEVC = false;
|
||||
static inline Atomic<bool> sForceEnableHEVC{false};
|
||||
|
||||
static bool IsHEVCSupported();
|
||||
|
||||
|
|
|
@ -120,12 +120,9 @@ static void ReportHardwareMediaCodecSupportIfNeeded() {
|
|||
}
|
||||
sReported = true;
|
||||
|
||||
// TODO : we can remove this after HEVC is enabled by default.
|
||||
// HEVC is not enabled. We need to force to enable it in order to know
|
||||
// its support as well, and it would be turn off later.
|
||||
if (StaticPrefs::media_wmf_hevc_enabled() != 1) {
|
||||
WMFDecoderModule::Init(WMFDecoderModule::Config::ForceEnableHEVC);
|
||||
}
|
||||
// We will disable HVEC later after reporting Telemetry if the pref is off.
|
||||
WMFDecoderModule::Init(WMFDecoderModule::Config::ForceEnableHEVC);
|
||||
|
||||
const auto support = PDMFactory::Supported(true /* force refresh */);
|
||||
if (support.contains(
|
||||
mozilla::media::MediaCodecsSupport::H264HardwareDecode)) {
|
||||
|
@ -155,7 +152,7 @@ static void ReportHardwareMediaCodecSupportIfNeeded() {
|
|||
true);
|
||||
}
|
||||
if (StaticPrefs::media_wmf_hevc_enabled() != 1) {
|
||||
WMFDecoderModule::Init();
|
||||
WMFDecoderModule::DisableForceEnableHEVC();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче