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

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

Issue 1864813002: 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: Addressed comments from PS2, and sampling decision logic change w.r.t. recent animation. 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
Index: media/capture/content/smooth_event_sampler.cc
diff --git a/media/capture/content/smooth_event_sampler.cc b/media/capture/content/smooth_event_sampler.cc
index 9ac263dd13fc2a8c91c30fb8a3dc22e2de1fb858..7f7297f2038192655b24528e4ae29db1778d1c53 100644
--- a/media/capture/content/smooth_event_sampler.cc
+++ b/media/capture/content/smooth_event_sampler.cc
@@ -12,11 +12,8 @@
namespace media {
-SmoothEventSampler::SmoothEventSampler(base::TimeDelta min_capture_period,
- int redundant_capture_goal)
- : redundant_capture_goal_(redundant_capture_goal),
- overdue_sample_count_(0),
- token_bucket_(base::TimeDelta::Max()) {
+SmoothEventSampler::SmoothEventSampler(base::TimeDelta min_capture_period)
+ : token_bucket_(base::TimeDelta::Max()) {
SetMinCapturePeriod(min_capture_period);
}
@@ -59,29 +56,8 @@ void SmoothEventSampler::RecordSample() {
TRACE_COUNTER1("gpu.capture", "MirroringTokenBucketUsec",
std::max<int64_t>(0, token_bucket_.InMicroseconds()));
- if (HasUnrecordedEvent()) {
+ if (HasUnrecordedEvent())
last_sample_ = current_event_;
- overdue_sample_count_ = 0;
- } else {
- ++overdue_sample_count_;
- }
-}
-
-bool SmoothEventSampler::IsOverdueForSamplingAt(
- base::TimeTicks event_time) const {
- DCHECK(!event_time.is_null());
-
- if (!HasUnrecordedEvent() && overdue_sample_count_ >= redundant_capture_goal_)
- return false; // Not dirty.
-
- if (last_sample_.is_null())
- return true;
-
- // If we're dirty but not yet old, then we've recently gotten updates, so we
- // won't request a sample just yet.
- base::TimeDelta dirty_interval = event_time - last_sample_;
- return dirty_interval >=
- base::TimeDelta::FromMilliseconds(OVERDUE_DIRTY_THRESHOLD_MILLIS);
}
bool SmoothEventSampler::HasUnrecordedEvent() const {

Powered by Google App Engine
This is Rietveld 408576698