Commit d81b3e81 authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Don't count zero-cadence frames as having been dropped.

Without this change, things like 120fps in 60hz (60fps @ 2x rate)
count every other frame as dropped since the cadence is [1:0].

Since dropped frames are used as performance indicators for various
sites, we shouldn't consider these as dropped when they were fully
considered and just chosen to be skipped for smoothness.

BUG=856772
TEST=YT 60fps @ 2x playback rate, updated unittests.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I9520504bd7cb48dfadf3f403121dcd59b739b4fe
Reviewed-on: https://chromium-review.googlesource.com/1115698
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570583}
parent 0b5e22ba
......@@ -165,14 +165,22 @@ scoped_refptr<VideoFrame> VideoRendererAlgorithm::Render(
}
// Step 7: Drop frames which occur prior to the frame to be rendered. If any
// frame has a zero render count it should be reported as dropped.
// frame unexpectedly has a zero render count it should be reported as
// dropped. When using cadence some frames may be expected to be skipped and
// should not be counted as dropped.
if (frame_to_render > 0) {
if (frames_dropped) {
for (int i = 0; i < frame_to_render; ++i) {
const ReadyFrame& frame = frame_queue_[i];
// If a frame was ever rendered, don't count it as dropped.
if (frame.render_count != frame.drop_count)
continue;
// If we expected to never render the frame, don't count it as dropped.
if (cadence_estimator_.has_cadence() && !frame.ideal_render_count)
continue;
// If frame dropping is disabled, ignore the results of the algorithm
// and return the earliest unrendered frame.
if (frame_dropping_disabled_) {
......
......@@ -1122,22 +1122,15 @@ TEST_F(VideoRendererAlgorithmTest, BestFrameByFractionalCadence) {
TickGenerator frame_tg(base::TimeTicks(), test_rate[0]);
TickGenerator display_tg(tick_clock_->NowTicks(), test_rate[1]);
const size_t desired_drop_pattern = test_rate[0] / test_rate[1] - 1;
scoped_refptr<VideoFrame> current_frame;
RunFramePumpTest(
true, &frame_tg, &display_tg,
[&current_frame, desired_drop_pattern, this](
const scoped_refptr<VideoFrame>& frame, size_t frames_dropped) {
[&current_frame, this](const scoped_refptr<VideoFrame>& frame,
size_t frames_dropped) {
ASSERT_TRUE(frame);
// The first frame should have zero dropped frames, but each Render()
// call after should drop the same number of frames based on the
// fractional cadence.
if (!current_frame)
ASSERT_EQ(0u, frames_dropped);
else
ASSERT_EQ(desired_drop_pattern, frames_dropped);
// We don't count frames dropped that cadence says we should skip.
ASSERT_EQ(0u, frames_dropped);
ASSERT_NE(current_frame, frame);
ASSERT_TRUE(is_using_cadence());
current_frame = frame;
......
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