| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 struct Scenario { | 217 struct Scenario { |
| 218 base::TimeDelta vsync_interval; // Reflects compositor's update rate. | 218 base::TimeDelta vsync_interval; // Reflects compositor's update rate. |
| 219 base::TimeDelta min_capture_period; // Reflects maximum capture rate. | 219 base::TimeDelta min_capture_period; // Reflects maximum capture rate. |
| 220 base::TimeDelta content_period; // Reflects content animation rate. | 220 base::TimeDelta content_period; // Reflects content animation rate. |
| 221 base::TimeDelta target_sampling_period; | 221 base::TimeDelta target_sampling_period; |
| 222 | 222 |
| 223 Scenario(int compositor_frequency, int max_frame_rate, int content_frame_rate) | 223 Scenario(int compositor_frequency, int max_frame_rate, int content_frame_rate) |
| 224 : vsync_interval(FpsAsPeriod(compositor_frequency)), | 224 : vsync_interval(FpsAsPeriod(compositor_frequency)), |
| 225 min_capture_period(FpsAsPeriod(max_frame_rate)), | 225 min_capture_period(FpsAsPeriod(max_frame_rate)), |
| 226 content_period(FpsAsPeriod(content_frame_rate)) { | 226 content_period(FpsAsPeriod(content_frame_rate)) { |
| 227 CHECK(content_period >= vsync_interval) | 227 // Bad test params: Impossible to animate faster than the compositor. |
| 228 << "Bad test params: Impossible to animate faster than the compositor."; | 228 CHECK(content_period >= vsync_interval); |
| 229 } | 229 } |
| 230 | 230 |
| 231 Scenario(int compositor_frequency, | 231 Scenario(int compositor_frequency, |
| 232 int max_frame_rate, | 232 int max_frame_rate, |
| 233 int content_frame_rate, | 233 int content_frame_rate, |
| 234 int target_sampling_rate) | 234 int target_sampling_rate) |
| 235 : vsync_interval(FpsAsPeriod(compositor_frequency)), | 235 : vsync_interval(FpsAsPeriod(compositor_frequency)), |
| 236 min_capture_period(FpsAsPeriod(max_frame_rate)), | 236 min_capture_period(FpsAsPeriod(max_frame_rate)), |
| 237 content_period(FpsAsPeriod(content_frame_rate)), | 237 content_period(FpsAsPeriod(content_frame_rate)), |
| 238 target_sampling_period(FpsAsPeriod(target_sampling_rate)) { | 238 target_sampling_period(FpsAsPeriod(target_sampling_rate)) { |
| 239 CHECK(content_period >= vsync_interval) | 239 // Bad test params: Impossible to animate faster than the compositor. |
| 240 << "Bad test params: Impossible to animate faster than the compositor."; | 240 CHECK(content_period >= vsync_interval); |
| 241 } | 241 } |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 // Value printer for Scenario. | 244 // Value printer for Scenario. |
| 245 ::std::ostream& operator<<(::std::ostream& os, const Scenario& s) { | 245 ::std::ostream& operator<<(::std::ostream& os, const Scenario& s) { |
| 246 return os << "{ vsync_interval=" << s.vsync_interval.InMicroseconds() | 246 return os << "{ vsync_interval=" << s.vsync_interval.InMicroseconds() |
| 247 << ", min_capture_period=" << s.min_capture_period.InMicroseconds() | 247 << ", min_capture_period=" << s.min_capture_period.InMicroseconds() |
| 248 << ", content_period=" << s.content_period.InMicroseconds() << " }"; | 248 << ", content_period=" << s.content_period.InMicroseconds() << " }"; |
| 249 } | 249 } |
| 250 | 250 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 Scenario(60, 30, 23), | 744 Scenario(60, 30, 23), |
| 745 Scenario(60, 30, 26), | 745 Scenario(60, 30, 26), |
| 746 Scenario(60, 30, 27), | 746 Scenario(60, 30, 27), |
| 747 Scenario(60, 30, 28), | 747 Scenario(60, 30, 28), |
| 748 Scenario(60, 30, 29), | 748 Scenario(60, 30, 29), |
| 749 Scenario(60, 30, 31), | 749 Scenario(60, 30, 31), |
| 750 Scenario(60, 30, 32), | 750 Scenario(60, 30, 32), |
| 751 Scenario(60, 30, 33))); | 751 Scenario(60, 30, 33))); |
| 752 | 752 |
| 753 } // namespace media | 753 } // namespace media |
| OLD | NEW |