Make the requirements for activing VideoWakeLock stricter. [chromium/src : main]

0 views
Skip to first unread message

Dale Curtis (Gerrit)

unread,
Mar 17, 2023, 6:48:09 PM3/17/23
to Frank Liberato, Yoav Weiss, blink-rev...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, mattreyno...@chromium.org, poscia...@chromium.org

Attention is currently required from: Frank Liberato, Yoav Weiss.

Dale Curtis would like Frank Liberato and Yoav Weiss to review this change.

View Change

Make the requirements for activing VideoWakeLock stricter.

We've received several complaints that the video wake lock is being
held too liberally. E.g., for looping small emoji/videos and minor
video ads.

As such start enforcing stricter requirements:
- At least 75% of the video must be on screen.
- The video must take up at least 20% of the viewport.

Since visible wake lock restrictions launched in M84, this also
removes the stale RuntimeFeature entry for it. The new behavior is
behind a default on base::Feature flag per new feature policy (so
it can be turned off in the field if needed).

Fixed: 1340424
Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
---
M content/child/runtime_features.cc
M media/base/media_switches.cc
M media/base/media_switches.h
M third_party/blink/renderer/core/html/media/video_wake_lock.cc
M third_party/blink/renderer/core/html/media/video_wake_lock.h
M third_party/blink/renderer/core/html/media/video_wake_lock_test.cc
M third_party/blink/renderer/platform/runtime_enabled_features.json5
7 files changed, 236 insertions(+), 101 deletions(-)


To view, visit change 3964046. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
Gerrit-Change-Number: 3964046
Gerrit-PatchSet: 6
Gerrit-Owner: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Yoav Weiss <yoav...@chromium.org>
Gerrit-CC: Raphael Kubo Da Costa <raphael.ku...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Yoav Weiss <yoav...@chromium.org>
Gerrit-MessageType: newchange

Dale Curtis (Gerrit)

unread,
Mar 17, 2023, 6:48:16 PM3/17/23
to blink-rev...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, mattreyno...@chromium.org, poscia...@chromium.org, Frank Liberato, Yoav Weiss, chromium...@chromium.org, Raphael Kubo Da Costa

Attention is currently required from: Frank Liberato, Yoav Weiss.

Patch set 6:Commit-Queue +1

View Change

    To view, visit change 3964046. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
    Gerrit-Change-Number: 3964046
    Gerrit-PatchSet: 6
    Gerrit-Owner: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Yoav Weiss <yoav...@chromium.org>
    Gerrit-CC: Raphael Kubo Da Costa <raphael.ku...@intel.com>
    Gerrit-Attention: Frank Liberato <libe...@chromium.org>
    Gerrit-Attention: Yoav Weiss <yoav...@chromium.org>
    Gerrit-Comment-Date: Fri, 17 Mar 2023 22:48:06 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Frank Liberato (Gerrit)

    unread,
    Mar 17, 2023, 7:41:20 PM3/17/23
    to Dale Curtis, blink-rev...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, mattreyno...@chromium.org, poscia...@chromium.org, Chromium LUCI CQ, Yoav Weiss, chromium...@chromium.org, Raphael Kubo Da Costa

    Attention is currently required from: Dale Curtis, Yoav Weiss.

    View Change

    4 comments:

    • File third_party/blink/renderer/core/html/media/video_wake_lock.h:

      • Patch Set #7, Line 111: float visibility_threshold_ = 0.75f;

        you might be able to make this const since it's only modified in the ctor.

      • Patch Set #7, Line 115: float size_threshold_ = 0.2f;

        i didn't see anything that modified this -- const / static constexpr?

    • File third_party/blink/renderer/core/html/media/video_wake_lock.cc:

      • Patch Set #7, Line 166: : has_volume;

        i don't understand why this depends on the feature rather than always being the "then" clause. if there's no audio, why care if it has volume? or is this a spec thing?

      • Patch Set #7, Line 175: (page_visible && ((is_visible_ && is_big_enough_) || has_audio)));

        just to make sure that i understand the intended behavior -- background tabs get no wake lock even if it has audio?

    To view, visit change 3964046. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
    Gerrit-Change-Number: 3964046
    Gerrit-PatchSet: 7
    Gerrit-Owner: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Yoav Weiss <yoav...@chromium.org>
    Gerrit-CC: Raphael Kubo Da Costa <raphael.ku...@intel.com>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Yoav Weiss <yoav...@chromium.org>
    Gerrit-Comment-Date: Fri, 17 Mar 2023 23:41:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Dale Curtis (Gerrit)

    unread,
    Mar 18, 2023, 12:09:44 PM3/18/23
    to blink-rev...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, mattreyno...@chromium.org, poscia...@chromium.org, Chromium LUCI CQ, Frank Liberato, Yoav Weiss, chromium...@chromium.org, Raphael Kubo Da Costa

    Attention is currently required from: Frank Liberato, Yoav Weiss.

    View Change

    2 comments:

    • File third_party/blink/renderer/core/html/media/video_wake_lock.cc:

      • i don't understand why this depends on the feature rather than always being the "then" clause. […]

        I'm just trying to be safe and preserve the existing behavior behind a flag that we can turn off in case of stable regression.

      • just to make sure that i understand the intended behavior -- background tabs get no wake lock even i […]

        There are two wake locks a video one and an audio one, the video one keeps the screen on and prevents sleep while the audio one prevents sleep. So yes background videos shouldn't keep the screen on.

    To view, visit change 3964046. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
    Gerrit-Change-Number: 3964046
    Gerrit-PatchSet: 7
    Gerrit-Owner: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Yoav Weiss <yoav...@chromium.org>
    Gerrit-CC: Raphael Kubo Da Costa <raphael.ku...@intel.com>
    Gerrit-Attention: Frank Liberato <libe...@chromium.org>
    Gerrit-Attention: Yoav Weiss <yoav...@chromium.org>
    Gerrit-Comment-Date: Sat, 18 Mar 2023 16:09:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Frank Liberato <libe...@chromium.org>
    Gerrit-MessageType: comment

    Yoav Weiss (Gerrit)

    unread,
    Mar 20, 2023, 4:15:13 AM3/20/23
    to Dale Curtis, blink-rev...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, mattreyno...@chromium.org, poscia...@chromium.org, Chromium LUCI CQ, Frank Liberato, chromium...@chromium.org, Raphael Kubo Da Costa

    Attention is currently required from: Dale Curtis, Frank Liberato.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #7:

        Can you split the stable flag removal from the behavior change?

    To view, visit change 3964046. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
    Gerrit-Change-Number: 3964046
    Gerrit-PatchSet: 7
    Gerrit-Owner: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Yoav Weiss <yoav...@chromium.org>
    Gerrit-CC: Raphael Kubo Da Costa <raphael.ku...@intel.com>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Frank Liberato <libe...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Mar 2023 08:15:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Dale Curtis (Gerrit)

    unread,
    Mar 20, 2023, 3:07:16 PM3/20/23
    to blink-rev...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, mattreyno...@chromium.org, poscia...@chromium.org, Yoav Weiss, Frank Liberato

    Attention is currently required from: Frank Liberato, Yoav Weiss.

    Dale Curtis has uploaded this change for review.

    View Change

    Make the requirements for activing VideoWakeLock stricter.

    We've received several complaints that the video wake lock is being
    held too liberally. E.g., for looping small emoji/videos and minor
    video ads.

    As such start enforcing stricter requirements:
    - At least 75% of the video must be on screen.
    - The video must take up at least 20% of the viewport.

    Since visible wake lock restrictions launched in M84, this also
    removes the stale RuntimeFeature entry for it. The new behavior is
    behind a default on base::Feature flag per new feature policy (so
    it can be turned off in the field if needed).

    Fixed: 1340424
    Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
    ---
    M third_party/blink/renderer/core/html/media/video_wake_lock.cc
    M third_party/blink/renderer/core/html/media/video_wake_lock.h
    M third_party/blink/renderer/core/html/media/video_wake_lock_test.cc
    3 files changed, 278 insertions(+), 79 deletions(-)


    To view, visit change 3964046. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
    Gerrit-Change-Number: 3964046
    Gerrit-PatchSet: 8
    Gerrit-Owner: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-CC: Raphael Kubo Da Costa <raphael.ku...@intel.com>
    Gerrit-CC: Yoav Weiss <yoav...@chromium.org>
    Gerrit-Attention: Yoav Weiss <yoav...@chromium.org>
    Gerrit-Attention: Frank Liberato <libe...@chromium.org>
    Gerrit-MessageType: newchange

    Dale Curtis (Gerrit)

    unread,
    Mar 20, 2023, 3:07:22 PM3/20/23
    to blink-rev...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, mattreyno...@chromium.org, poscia...@chromium.org, Yoav Weiss, Chromium LUCI CQ, Frank Liberato, chromium...@chromium.org, Raphael Kubo Da Costa

    Attention is currently required from: Frank Liberato, Yoav Weiss.

    View Change

    2 comments:

    • Patchset:

      • Patch Set #7:

        Can you split the stable flag removal from the behavior change?

    To view, visit change 3964046. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I70896baffb0b7b791f6dd29e0b99e8df4126bceb
    Gerrit-Change-Number: 3964046
    Gerrit-PatchSet: 8
    Gerrit-Owner: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-CC: Raphael Kubo Da Costa <raphael.ku...@intel.com>
    Gerrit-CC: Yoav Weiss <yoav...@chromium.org>
    Gerrit-Attention: Yoav Weiss <yoav...@chromium.org>
    Gerrit-Attention: Frank Liberato <libe...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Mar 2023 19:07:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Yoav Weiss <yoav...@chromium.org>
    Gerrit-MessageType: comment
    Reply all
    Reply to author
    Forward
    0 new messages