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

Side by Side Diff: media/capture/content/animated_content_sampler_unittest.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "media/capture/content/animated_content_sampler.h" 5 #include "media/capture/content/animated_content_sampler.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 frame_timestamps.clear(); // Reset until continuous lock-in. 596 frame_timestamps.clear(); // Reset until continuous lock-in.
597 } 597 }
598 } 598 }
599 ASSERT_LE(2u, frame_timestamps.size()); 599 ASSERT_LE(2u, frame_timestamps.size());
600 600
601 // Iterate through the |frame_timestamps|, building a histogram counting the 601 // Iterate through the |frame_timestamps|, building a histogram counting the
602 // number of times each frame was displayed k times. For example, 10 frames 602 // number of times each frame was displayed k times. For example, 10 frames
603 // of 30 Hz content on a 60 Hz v-sync interval should result in 603 // of 30 Hz content on a 60 Hz v-sync interval should result in
604 // display_counts[2] == 10. Quit early if any one frame was obviously 604 // display_counts[2] == 10. Quit early if any one frame was obviously
605 // repeated too many times. 605 // repeated too many times.
606 const int64 max_expected_repeats_per_frame = 606 const int64_t max_expected_repeats_per_frame =
607 1 + ComputeExpectedSamplingPeriod() / GetParam().vsync_interval; 607 1 + ComputeExpectedSamplingPeriod() / GetParam().vsync_interval;
608 std::vector<size_t> display_counts(max_expected_repeats_per_frame + 1, 0); 608 std::vector<size_t> display_counts(max_expected_repeats_per_frame + 1, 0);
609 base::TimeTicks last_present_time = frame_timestamps.front(); 609 base::TimeTicks last_present_time = frame_timestamps.front();
610 for (Timestamps::const_iterator i = frame_timestamps.begin() + 1; 610 for (Timestamps::const_iterator i = frame_timestamps.begin() + 1;
611 i != frame_timestamps.end(); ++i) { 611 i != frame_timestamps.end(); ++i) {
612 const size_t num_vsync_intervals = static_cast<size_t>( 612 const size_t num_vsync_intervals = static_cast<size_t>(
613 (*i - last_present_time) / GetParam().vsync_interval); 613 (*i - last_present_time) / GetParam().vsync_interval);
614 ASSERT_LT(0u, num_vsync_intervals); 614 ASSERT_LT(0u, num_vsync_intervals);
615 ASSERT_GT(display_counts.size(), num_vsync_intervals); // Quit early. 615 ASSERT_GT(display_counts.size(), num_vsync_intervals); // Quit early.
616 ++display_counts[num_vsync_intervals]; 616 ++display_counts[num_vsync_intervals];
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 Scenario(60, 30, 23), 741 Scenario(60, 30, 23),
742 Scenario(60, 30, 26), 742 Scenario(60, 30, 26),
743 Scenario(60, 30, 27), 743 Scenario(60, 30, 27),
744 Scenario(60, 30, 28), 744 Scenario(60, 30, 28),
745 Scenario(60, 30, 29), 745 Scenario(60, 30, 29),
746 Scenario(60, 30, 31), 746 Scenario(60, 30, 31),
747 Scenario(60, 30, 32), 747 Scenario(60, 30, 32),
748 Scenario(60, 30, 33))); 748 Scenario(60, 30, 33)));
749 749
750 } // namespace media 750 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698