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

Unified Diff: media/capture/content/smooth_event_sampler.h

Issue 1865283003: Revert of Tab/Desktop Capture: Use requests instead of timer-based refreshing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_refresh_from_sinks
Patch Set: Created 4 years, 8 months 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/capture/content/screen_capture_device_core.cc ('k') | media/capture/content/smooth_event_sampler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « media/capture/content/screen_capture_device_core.cc ('k') | media/capture/content/smooth_event_sampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698