Commit a9fcc813 authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

Video Wake Lock: wrap optimisation for hidden muted videos around a Feature flag.

Bug: 1086776
Change-Id: I90070ae55c0f6b9ee790ac4df9af1722b75f2489
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225746
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774864}
parent fd56fc19
...@@ -323,7 +323,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() { ...@@ -323,7 +323,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
device::kWebAuthGetAssertionFeaturePolicy, kUseFeatureState}, device::kWebAuthGetAssertionFeaturePolicy, kUseFeatureState},
{wf::EnableTransformInterop, blink::features::kTransformInterop, {wf::EnableTransformInterop, blink::features::kTransformInterop,
kUseFeatureState}, kUseFeatureState},
{wf::EnableVideoWakeLockOptimisationHiddenMuted,
media::kWakeLockOptimisationHiddenMuted, kUseFeatureState},
}; };
for (const auto& mapping : blinkFeatureToBaseFeatureMapping) { for (const auto& mapping : blinkFeatureToBaseFeatureMapping) {
SetRuntimeFeatureFromChromiumFeature( SetRuntimeFeatureFromChromiumFeature(
......
...@@ -464,6 +464,9 @@ const base::Feature kFailUrlProvisionFetcherForTesting{ ...@@ -464,6 +464,9 @@ const base::Feature kFailUrlProvisionFetcherForTesting{
const base::Feature kHardwareSecureDecryption{ const base::Feature kHardwareSecureDecryption{
"HardwareSecureDecryption", base::FEATURE_DISABLED_BY_DEFAULT}; "HardwareSecureDecryption", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kWakeLockOptimisationHiddenMuted{
"kWakeLockOptimisationHiddenMuted", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables encrypted AV1 support in EME requestMediaKeySystemAccess() query by // Enables encrypted AV1 support in EME requestMediaKeySystemAccess() query by
// Widevine key system if it is also supported by the underlying Widevine CDM. // Widevine key system if it is also supported by the underlying Widevine CDM.
// This feature does not affect the actual playback of encrypted AV1 if it's // This feature does not affect the actual playback of encrypted AV1 if it's
......
...@@ -171,6 +171,7 @@ MEDIA_EXPORT extern const base::Feature kVaapiLowPowerEncoderGen9x; ...@@ -171,6 +171,7 @@ MEDIA_EXPORT extern const base::Feature kVaapiLowPowerEncoderGen9x;
MEDIA_EXPORT extern const base::Feature kVaapiVP8Encoder; MEDIA_EXPORT extern const base::Feature kVaapiVP8Encoder;
MEDIA_EXPORT extern const base::Feature kVaapiVP9Encoder; MEDIA_EXPORT extern const base::Feature kVaapiVP9Encoder;
MEDIA_EXPORT extern const base::Feature kVideoBlitColorAccuracy; MEDIA_EXPORT extern const base::Feature kVideoBlitColorAccuracy;
MEDIA_EXPORT extern const base::Feature kWakeLockOptimisationHiddenMuted;
MEDIA_EXPORT extern const base::Feature kWidevineAv1; MEDIA_EXPORT extern const base::Feature kWidevineAv1;
MEDIA_EXPORT extern const base::Feature kWidevineAv1ForceSupportForTesting; MEDIA_EXPORT extern const base::Feature kWidevineAv1ForceSupportForTesting;
......
...@@ -242,8 +242,9 @@ class WebRuntimeFeatures { ...@@ -242,8 +242,9 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableTrustTokensAlwaysAllowIssuance(bool); BLINK_PLATFORM_EXPORT static void EnableTrustTokensAlwaysAllowIssuance(bool);
BLINK_PLATFORM_EXPORT static void EnableInstalledApp(bool); BLINK_PLATFORM_EXPORT static void EnableInstalledApp(bool);
BLINK_PLATFORM_EXPORT static void EnableTransformInterop(bool); BLINK_PLATFORM_EXPORT static void EnableTransformInterop(bool);
BLINK_PLATFORM_EXPORT static void EnableVideoWakeLockOptimisationHiddenMuted(
bool);
private: private:
WebRuntimeFeatures(); WebRuntimeFeatures();
......
...@@ -30,7 +30,10 @@ VideoWakeLock::VideoWakeLock(HTMLVideoElement& video) ...@@ -30,7 +30,10 @@ VideoWakeLock::VideoWakeLock(HTMLVideoElement& video)
this, true); this, true);
VideoElement().addEventListener(event_type_names::kVolumechange, this, true); VideoElement().addEventListener(event_type_names::kVolumechange, this, true);
StartIntersectionObserver(); if (RuntimeEnabledFeatures::VideoWakeLockOptimisationHiddenMutedEnabled())
StartIntersectionObserver();
else
is_visible_ = true;
RemotePlaybackController* remote_playback_controller = RemotePlaybackController* remote_playback_controller =
RemotePlaybackController::From(VideoElement()); RemotePlaybackController::From(VideoElement());
...@@ -43,8 +46,10 @@ VideoWakeLock::VideoWakeLock(HTMLVideoElement& video) ...@@ -43,8 +46,10 @@ VideoWakeLock::VideoWakeLock(HTMLVideoElement& video)
void VideoWakeLock::ElementDidMoveToNewDocument() { void VideoWakeLock::ElementDidMoveToNewDocument() {
SetExecutionContext(VideoElement().GetExecutionContext()); SetExecutionContext(VideoElement().GetExecutionContext());
intersection_observer_->disconnect(); if (RuntimeEnabledFeatures::VideoWakeLockOptimisationHiddenMutedEnabled()) {
StartIntersectionObserver(); intersection_observer_->disconnect();
StartIntersectionObserver();
}
} }
void VideoWakeLock::PageVisibilityChanged() { void VideoWakeLock::PageVisibilityChanged() {
...@@ -53,6 +58,8 @@ void VideoWakeLock::PageVisibilityChanged() { ...@@ -53,6 +58,8 @@ void VideoWakeLock::PageVisibilityChanged() {
void VideoWakeLock::OnVisibilityChanged( void VideoWakeLock::OnVisibilityChanged(
const HeapVector<Member<IntersectionObserverEntry>>& entries) { const HeapVector<Member<IntersectionObserverEntry>>& entries) {
DCHECK(RuntimeEnabledFeatures::VideoWakeLockOptimisationHiddenMutedEnabled());
is_visible_ = (entries.back()->intersectionRatio() > 0); is_visible_ = (entries.back()->intersectionRatio() > 0);
Update(); Update();
} }
......
...@@ -688,4 +688,10 @@ void WebRuntimeFeatures::EnableTransformInterop(bool enable) { ...@@ -688,4 +688,10 @@ void WebRuntimeFeatures::EnableTransformInterop(bool enable) {
RuntimeEnabledFeatures::SetTransformInteropEnabled(enable); RuntimeEnabledFeatures::SetTransformInteropEnabled(enable);
} }
void WebRuntimeFeatures::EnableVideoWakeLockOptimisationHiddenMuted(
bool enable) {
RuntimeEnabledFeatures::SetVideoWakeLockOptimisationHiddenMutedEnabled(
enable);
}
} // namespace blink } // namespace blink
...@@ -1860,6 +1860,10 @@ ...@@ -1860,6 +1860,10 @@
{ {
name: "VideoRotateToFullscreen", name: "VideoRotateToFullscreen",
}, },
{
name: "VideoWakeLockOptimisationHiddenMuted",
status: "stable",
},
{ {
name: "VirtualKeyboard", name: "VirtualKeyboard",
status: "test", status: "test",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment