| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/media/capture/smooth_event_sampler.h" | 5 #include "media/capture/smooth_event_sampler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace media { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // The maximum amount of time that can elapse before considering unchanged | 15 // The maximum amount of time that can elapse before considering unchanged |
| 16 // content as dirty for the purposes of timer-based overdue sampling. This is | 16 // content as dirty for the purposes of timer-based overdue sampling. This is |
| 17 // the same value found in cc::FrameRateCounter. | 17 // the same value found in cc::FrameRateCounter. |
| 18 const int kOverdueDirtyThresholdMillis = 250; // 4 FPS | 18 const int kOverdueDirtyThresholdMillis = 250; // 4 FPS |
| 19 | 19 |
| 20 } // anonymous namespace | 20 } // anonymous namespace |
| 21 | 21 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // won't request a sample just yet. | 90 // won't request a sample just yet. |
| 91 base::TimeDelta dirty_interval = event_time - last_sample_; | 91 base::TimeDelta dirty_interval = event_time - last_sample_; |
| 92 return dirty_interval >= | 92 return dirty_interval >= |
| 93 base::TimeDelta::FromMilliseconds(kOverdueDirtyThresholdMillis); | 93 base::TimeDelta::FromMilliseconds(kOverdueDirtyThresholdMillis); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool SmoothEventSampler::HasUnrecordedEvent() const { | 96 bool SmoothEventSampler::HasUnrecordedEvent() const { |
| 97 return !current_event_.is_null() && current_event_ != last_sample_; | 97 return !current_event_.is_null() && current_event_ != last_sample_; |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace content | 100 } // namespace media |
| OLD | NEW |