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

Unified Diff: content/browser/renderer_host/media/video_capture_oracle.cc

Issue 101843005: Convert video capture pipline to base::TimeTicks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 9890509b Rebase, Windows compile fixes Created 6 years, 11 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: content/browser/renderer_host/media/video_capture_oracle.cc
diff --git a/content/browser/renderer_host/media/video_capture_oracle.cc b/content/browser/renderer_host/media/video_capture_oracle.cc
index fb41ec2fe4eb56d43ba258e3b414aa79fb467d3b..499bde468aab112e5ffae4875505a6abc48ac34b 100644
--- a/content/browser/renderer_host/media/video_capture_oracle.cc
+++ b/content/browser/renderer_host/media/video_capture_oracle.cc
@@ -33,8 +33,8 @@ VideoCaptureOracle::VideoCaptureOracle(base::TimeDelta capture_period,
kNumRedundantCapturesOfStaticContent) {}
bool VideoCaptureOracle::ObserveEventAndDecideCapture(
- Event event,
- base::Time event_time) {
+ Event event,
+ base::TimeTicks event_time) {
// Record |event| and decide whether it's a good time to capture.
const bool content_is_dirty = (event == kCompositorUpdate ||
event == kSoftwarePaint);
@@ -54,7 +54,7 @@ int VideoCaptureOracle::RecordCapture() {
}
bool VideoCaptureOracle::CompleteCapture(int frame_number,
- base::Time timestamp) {
+ base::TimeTicks timestamp) {
// Drop frame if previous frame number is higher or we're trying to deliver
// a frame with the same timestamp.
if (last_delivered_frame_number_ > frame_number ||
@@ -88,7 +88,8 @@ SmoothEventSampler::SmoothEventSampler(base::TimeDelta capture_period,
DCHECK_GT(capture_period_.InMicroseconds(), 0);
}
-bool SmoothEventSampler::AddEventAndConsiderSampling(base::Time event_time) {
+bool SmoothEventSampler::AddEventAndConsiderSampling(
+ base::TimeTicks event_time) {
DCHECK(!event_time.is_null());
// Add tokens to the bucket based on advancement in time. Then, re-bound the
@@ -137,7 +138,8 @@ void SmoothEventSampler::RecordSample() {
<< "Content changed; capture will resume.";
}
-bool SmoothEventSampler::IsOverdueForSamplingAt(base::Time event_time) const {
+bool SmoothEventSampler::IsOverdueForSamplingAt(base::TimeTicks event_time)
+ const {
DCHECK(!event_time.is_null());
// If we don't get events on compositor updates on this platform, then we
@@ -149,6 +151,9 @@ bool SmoothEventSampler::IsOverdueForSamplingAt(base::Time event_time) const {
}
}
+ 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_;

Powered by Google App Engine
This is Rietveld 408576698