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 #ifndef MEDIA_FILTERS_VIDEO_CADENCE_ESTIMATOR_H_ | 5 #ifndef MEDIA_FILTERS_VIDEO_CADENCE_ESTIMATOR_H_ |
6 #define MEDIA_FILTERS_VIDEO_CADENCE_ESTIMATOR_H_ | 6 #define MEDIA_FILTERS_VIDEO_CADENCE_ESTIMATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Clients should call this and then update the cadence for all frames via the | 81 // Clients should call this and then update the cadence for all frames via the |
82 // GetCadenceForFrame() method if the cadence changes. | 82 // GetCadenceForFrame() method if the cadence changes. |
83 // | 83 // |
84 // Cadence changes will not take affect until enough render intervals have | 84 // Cadence changes will not take affect until enough render intervals have |
85 // elapsed. For the purposes of hysteresis, each UpdateCadenceEstimate() call | 85 // elapsed. For the purposes of hysteresis, each UpdateCadenceEstimate() call |
86 // is assumed to elapse one |render_interval| worth of time. | 86 // is assumed to elapse one |render_interval| worth of time. |
87 // | 87 // |
88 // Returns true if the cadence has changed since the last call. | 88 // Returns true if the cadence has changed since the last call. |
89 bool UpdateCadenceEstimate(base::TimeDelta render_interval, | 89 bool UpdateCadenceEstimate(base::TimeDelta render_interval, |
90 base::TimeDelta frame_duration, | 90 base::TimeDelta frame_duration, |
| 91 base::TimeDelta frame_duration_deviation, |
91 base::TimeDelta max_acceptable_drift); | 92 base::TimeDelta max_acceptable_drift); |
92 | 93 |
93 // Returns true if a useful cadence was found. | 94 // Returns true if a useful cadence was found. |
94 bool has_cadence() const { return !cadence_.empty(); } | 95 bool has_cadence() const { return !cadence_.empty(); } |
95 | 96 |
96 // Given a |frame_number|, where zero is the most recently rendered frame, | 97 // Given a |frame_number|, where zero is the most recently rendered frame, |
97 // returns the ideal cadence for that frame. | 98 // returns the ideal cadence for that frame. |
98 // | 99 // |
99 // Note: Callers must track the base |frame_number| relative to all frames | 100 // Note: Callers must track the base |frame_number| relative to all frames |
100 // rendered or removed after the first frame for which cadence is detected. | 101 // rendered or removed after the first frame for which cadence is detected. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 // Tracks how many times cadence has switched during a given playback, used to | 148 // Tracks how many times cadence has switched during a given playback, used to |
148 // histogram the number of cadence changes in a playback. | 149 // histogram the number of cadence changes in a playback. |
149 bool first_update_call_; | 150 bool first_update_call_; |
150 int cadence_changes_; | 151 int cadence_changes_; |
151 | 152 |
152 // The minimum amount of time allowed before a glitch occurs before confirming | 153 // The minimum amount of time allowed before a glitch occurs before confirming |
153 // cadence for a given render interval and frame duration. | 154 // cadence for a given render interval and frame duration. |
154 const base::TimeDelta minimum_time_until_max_drift_; | 155 const base::TimeDelta minimum_time_until_max_drift_; |
155 | 156 |
| 157 bool is_variable_frame_rate_; |
| 158 |
156 DISALLOW_COPY_AND_ASSIGN(VideoCadenceEstimator); | 159 DISALLOW_COPY_AND_ASSIGN(VideoCadenceEstimator); |
157 }; | 160 }; |
158 | 161 |
159 } // namespace media | 162 } // namespace media |
160 | 163 |
161 #endif // MEDIA_FILTERS_VIDEO_CADENCE_ESTIMATOR_H_ | 164 #endif // MEDIA_FILTERS_VIDEO_CADENCE_ESTIMATOR_H_ |
OLD | NEW |