Index: media/capture/content/smooth_event_sampler.h |
diff --git a/media/capture/content/smooth_event_sampler.h b/media/capture/content/smooth_event_sampler.h |
index 748ad158de8b319dad332ac7774541ba7e0c9e88..6b69a10cc698eed1525960ba8606f03622a8ef5d 100644 |
--- a/media/capture/content/smooth_event_sampler.h |
+++ b/media/capture/content/smooth_event_sampler.h |
@@ -14,7 +14,15 @@ |
// Filters a sequence of events to achieve a target frequency. |
class MEDIA_EXPORT SmoothEventSampler { |
public: |
- explicit SmoothEventSampler(base::TimeDelta min_capture_period); |
+ enum { |
+ // The maximum amount of time that can elapse before considering unchanged |
+ // content as dirty for the purposes of timer-based overdue sampling. This |
+ // is the same value found in cc::FrameRateCounter. |
+ OVERDUE_DIRTY_THRESHOLD_MILLIS = 250 // 4 FPS |
+ }; |
+ |
+ SmoothEventSampler(base::TimeDelta min_capture_period, |
+ int redundant_capture_goal); |
// Get/Set minimum capture period. When setting a new value, the state of the |
// sampler is retained so that sampling will continue smoothly. |
@@ -34,16 +42,22 @@ |
// we have sampled the most recent event. |
void RecordSample(); |
+ // Returns true if, at time |event_time|, sampling should occur because too |
+ // much time will have passed relative to the last event and/or sample. |
+ bool IsOverdueForSamplingAt(base::TimeTicks event_time) const; |
+ |
// Returns true if ConsiderPresentationEvent() has been called since the last |
// call to RecordSample(). |
bool HasUnrecordedEvent() const; |
private: |
base::TimeDelta min_capture_period_; |
+ const int redundant_capture_goal_; |
base::TimeDelta token_bucket_capacity_; |
base::TimeTicks current_event_; |
base::TimeTicks last_sample_; |
+ int overdue_sample_count_; |
base::TimeDelta token_bucket_; |
DISALLOW_COPY_AND_ASSIGN(SmoothEventSampler); |