| 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 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_SMOOTH_EVENT_SAMPLER_H_ | 5 #ifndef MEDIA_CAPTURE_SMOOTH_EVENT_SAMPLER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_SMOOTH_EVENT_SAMPLER_H_ | 6 #define MEDIA_CAPTURE_SMOOTH_EVENT_SAMPLER_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/common/content_export.h" | 9 #include "media/base/media_export.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace media { |
| 12 | 12 |
| 13 // Filters a sequence of events to achieve a target frequency. | 13 // Filters a sequence of events to achieve a target frequency. |
| 14 class CONTENT_EXPORT SmoothEventSampler { | 14 class MEDIA_EXPORT SmoothEventSampler { |
| 15 public: | 15 public: |
| 16 SmoothEventSampler(base::TimeDelta min_capture_period, | 16 SmoothEventSampler(base::TimeDelta min_capture_period, |
| 17 int redundant_capture_goal); | 17 int redundant_capture_goal); |
| 18 | 18 |
| 19 // Get/Set minimum capture period. When setting a new value, the state of the | 19 // Get/Set minimum capture period. When setting a new value, the state of the |
| 20 // sampler is retained so that sampling will continue smoothly. | 20 // sampler is retained so that sampling will continue smoothly. |
| 21 base::TimeDelta min_capture_period() const { return min_capture_period_; } | 21 base::TimeDelta min_capture_period() const { return min_capture_period_; } |
| 22 void SetMinCapturePeriod(base::TimeDelta p); | 22 void SetMinCapturePeriod(base::TimeDelta p); |
| 23 | 23 |
| 24 // Add a new event to the event history, and consider whether it ought to be | 24 // Add a new event to the event history, and consider whether it ought to be |
| (...skipping 23 matching lines...) Expand all Loading... |
| 48 base::TimeDelta token_bucket_capacity_; | 48 base::TimeDelta token_bucket_capacity_; |
| 49 | 49 |
| 50 base::TimeTicks current_event_; | 50 base::TimeTicks current_event_; |
| 51 base::TimeTicks last_sample_; | 51 base::TimeTicks last_sample_; |
| 52 int overdue_sample_count_; | 52 int overdue_sample_count_; |
| 53 base::TimeDelta token_bucket_; | 53 base::TimeDelta token_bucket_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(SmoothEventSampler); | 55 DISALLOW_COPY_AND_ASSIGN(SmoothEventSampler); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace content | 58 } // namespace media |
| 59 | 59 |
| 60 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_SMOOTH_EVENT_SAMPLER_H_ | 60 #endif // MEDIA_CAPTURE_SMOOTH_EVENT_SAMPLER_H_ |
| OLD | NEW |