Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(893)

Unified Diff: media/filters/video_renderer_algorithm_unittest.cc

Issue 1459923003: Fix Bug: Video with Variable Frame Rate plays at incorrect speed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/video_renderer_algorithm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_algorithm_unittest.cc
diff --git a/media/filters/video_renderer_algorithm_unittest.cc b/media/filters/video_renderer_algorithm_unittest.cc
index 8a4930966e537598ffc7e647d24ecf40613dc0ea..bc9716a823268348c855e68303e61ea0e12a8383 100644
--- a/media/filters/video_renderer_algorithm_unittest.cc
+++ b/media/filters/video_renderer_algorithm_unittest.cc
@@ -1180,7 +1180,7 @@ TEST_F(VideoRendererAlgorithmTest, CadenceBasedTest) {
}
// Rotate through various playback rates and ensure algorithm adapts correctly.
-TEST_F(VideoRendererAlgorithmTest, VariableFrameRateCadence) {
+TEST_F(VideoRendererAlgorithmTest, VariablePlaybackRateCadence) {
TickGenerator frame_tg(base::TimeTicks(), NTSC(30));
TickGenerator display_tg(tick_clock_->NowTicks(), 60);
@@ -1241,6 +1241,51 @@ TEST_F(VideoRendererAlgorithmTest, UglyTimestampsHaveCadence) {
}
}
+// Ensures media with variable frame rate should not be applied with Cadence.
+TEST_F(VideoRendererAlgorithmTest, VariableFrameRateNoCadence) {
+ TickGenerator display_tg(tick_clock_->NowTicks(), 60);
+ time_source_.StartTicking();
+
+ const int kBadTimestampsMs[] = {200, 200, 200, 200, 200, 1000,
+ 1000, 1000, 1000, 200, 200, 200,
+ 200, 200, 1000, 1000, 1000, 1000};
+
+ // Run throught ~10 seconds worth of frames.
+ bool cadence_detected = false;
+ bool cadence_turned_off = false;
+ base::TimeDelta timestamp;
+ for (size_t i = 0; i < arraysize(kBadTimestampsMs);) {
+ while (algorithm_.EffectiveFramesQueued() < 3) {
+ algorithm_.EnqueueFrame(CreateFrame(timestamp));
+ timestamp += base::TimeDelta::FromMilliseconds(
+ kBadTimestampsMs[i % arraysize(kBadTimestampsMs)]);
+ ++i;
+ }
+
+ size_t frames_dropped = 0;
+ RenderAndStep(&display_tg, &frames_dropped);
+ ASSERT_EQ(0u, frames_dropped);
+
+ // Cadence would be detected during the first second, and then
+ // it should be off due to variable FPS detection, and then for this
+ // sample, it should never be on.
+ if (is_using_cadence())
+ cadence_detected = true;
+
+ if (cadence_detected) {
+ if (!is_using_cadence())
+ cadence_turned_off = true;
+ }
+
+ if (cadence_turned_off) {
+ ASSERT_FALSE(is_using_cadence());
+ }
+ }
+
+ // Make sure Cadence is turned off somewhen, not always on.
+ ASSERT_TRUE(cadence_turned_off);
+}
+
TEST_F(VideoRendererAlgorithmTest, EnqueueFrames) {
TickGenerator tg(base::TimeTicks(), 50);
time_source_.StartTicking();
« no previous file with comments | « media/filters/video_renderer_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698