OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 time_source_.StartTicking(); | 184 time_source_.StartTicking(); |
185 | 185 |
186 const bool fresh_algorithm = !algorithm_.have_rendered_frames_; | 186 const bool fresh_algorithm = !algorithm_.have_rendered_frames_; |
187 | 187 |
188 base::TimeDelta last_start_timestamp = kNoTimestamp; | 188 base::TimeDelta last_start_timestamp = kNoTimestamp; |
189 bool should_use_cadence = false; | 189 bool should_use_cadence = false; |
190 int glitch_count = 0; | 190 int glitch_count = 0; |
191 const base::TimeTicks start_time = tick_clock_->NowTicks(); | 191 const base::TimeTicks start_time = tick_clock_->NowTicks(); |
192 while (tick_clock_->NowTicks() - start_time < minimum_glitch_time()) { | 192 while (tick_clock_->NowTicks() - start_time < minimum_glitch_time()) { |
193 while (EffectiveFramesQueued() < 3 || | 193 while (EffectiveFramesQueued() < 3 || |
194 frame_tg->current() - time_source_.CurrentMediaTime() < | 194 frame_tg->current() - time_source_.CurrentMediaTime(nullptr) < |
195 base::TimeTicks()) { | 195 base::TimeTicks()) { |
196 algorithm_.EnqueueFrame( | 196 algorithm_.EnqueueFrame( |
197 CreateFrame(frame_tg->current() - base::TimeTicks())); | 197 CreateFrame(frame_tg->current() - base::TimeTicks())); |
198 frame_tg->step(); | 198 frame_tg->step(); |
199 } | 199 } |
200 | 200 |
201 size_t frames_dropped = 0; | 201 size_t frames_dropped = 0; |
202 const base::TimeTicks deadline_min = display_tg->current(); | 202 const base::TimeTicks deadline_min = display_tg->current(); |
203 const base::TimeTicks deadline_max = display_tg->step(); | 203 const base::TimeTicks deadline_max = display_tg->step(); |
204 scoped_refptr<VideoFrame> frame = | 204 scoped_refptr<VideoFrame> frame = |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 ASSERT_TRUE(is_using_cadence()); | 1447 ASSERT_TRUE(is_using_cadence()); |
1448 | 1448 |
1449 // Finally the last frame. | 1449 // Finally the last frame. |
1450 rendered_frame = RenderAndStep(&tg, &frames_dropped); | 1450 rendered_frame = RenderAndStep(&tg, &frames_dropped); |
1451 EXPECT_EQ(1u, frames_queued()); | 1451 EXPECT_EQ(1u, frames_queued()); |
1452 EXPECT_EQ(tg.interval(12), rendered_frame->timestamp()); | 1452 EXPECT_EQ(tg.interval(12), rendered_frame->timestamp()); |
1453 ASSERT_TRUE(is_using_cadence()); | 1453 ASSERT_TRUE(is_using_cadence()); |
1454 } | 1454 } |
1455 | 1455 |
1456 } // namespace media | 1456 } // namespace media |
OLD | NEW |