| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/renderer_host/media/video_capture_oracle.h" | 5 #include "content/browser/renderer_host/media/video_capture_oracle.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 bool was_paused = overdue_sample_count_ == redundant_capture_goal_; | 124 bool was_paused = overdue_sample_count_ == redundant_capture_goal_; |
| 125 if (HasUnrecordedEvent()) { | 125 if (HasUnrecordedEvent()) { |
| 126 last_sample_ = current_event_; | 126 last_sample_ = current_event_; |
| 127 overdue_sample_count_ = 0; | 127 overdue_sample_count_ = 0; |
| 128 } else { | 128 } else { |
| 129 ++overdue_sample_count_; | 129 ++overdue_sample_count_; |
| 130 } | 130 } |
| 131 bool is_paused = overdue_sample_count_ == redundant_capture_goal_; | 131 bool is_paused = overdue_sample_count_ == redundant_capture_goal_; |
| 132 | 132 |
| 133 LOG_IF(INFO, !was_paused && is_paused) | 133 VLOG_IF(0, !was_paused && is_paused) |
| 134 << "Tab content unchanged for " << redundant_capture_goal_ | 134 << "Tab content unchanged for " << redundant_capture_goal_ |
| 135 << " frames; capture will halt until content changes."; | 135 << " frames; capture will halt until content changes."; |
| 136 LOG_IF(INFO, was_paused && !is_paused) | 136 VLOG_IF(0, was_paused && !is_paused) |
| 137 << "Content changed; capture will resume."; | 137 << "Content changed; capture will resume."; |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool SmoothEventSampler::IsOverdueForSamplingAt(base::Time event_time) const { | 140 bool SmoothEventSampler::IsOverdueForSamplingAt(base::Time event_time) const { |
| 141 DCHECK(!event_time.is_null()); | 141 DCHECK(!event_time.is_null()); |
| 142 | 142 |
| 143 // If we don't get events on compositor updates on this platform, then we | 143 // If we don't get events on compositor updates on this platform, then we |
| 144 // don't reliably know whether we're dirty. | 144 // don't reliably know whether we're dirty. |
| 145 if (events_are_reliable_) { | 145 if (events_are_reliable_) { |
| 146 if (!HasUnrecordedEvent() && | 146 if (!HasUnrecordedEvent() && |
| 147 overdue_sample_count_ >= redundant_capture_goal_) { | 147 overdue_sample_count_ >= redundant_capture_goal_) { |
| 148 return false; // Not dirty. | 148 return false; // Not dirty. |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 // If we're dirty but not yet old, then we've recently gotten updates, so we | 152 // If we're dirty but not yet old, then we've recently gotten updates, so we |
| 153 // won't request a sample just yet. | 153 // won't request a sample just yet. |
| 154 base::TimeDelta dirty_interval = event_time - last_sample_; | 154 base::TimeDelta dirty_interval = event_time - last_sample_; |
| 155 if (dirty_interval < capture_period_ * 4) | 155 if (dirty_interval < capture_period_ * 4) |
| 156 return false; | 156 return false; |
| 157 else | 157 else |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool SmoothEventSampler::HasUnrecordedEvent() const { | 161 bool SmoothEventSampler::HasUnrecordedEvent() const { |
| 162 return !current_event_.is_null() && current_event_ != last_sample_; | 162 return !current_event_.is_null() && current_event_ != last_sample_; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace content | 165 } // namespace content |
| OLD | NEW |