| 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_ANIMATED_CONTENT_SAMPLER_H_ | 5 #ifndef MEDIA_CAPTURE_ANIMATED_CONTENT_SAMPLER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_ANIMATED_CONTENT_SAMPLER_H_ | 6 #define MEDIA_CAPTURE_ANIMATED_CONTENT_SAMPLER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "content/common/content_export.h" | 11 #include "media/base/media_export.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace media { |
| 15 | 15 |
| 16 // Analyzes a sequence of events to detect the presence of constant frame rate | 16 // Analyzes a sequence of events to detect the presence of constant frame rate |
| 17 // animated content. In the case where there are multiple regions of animated | 17 // animated content. In the case where there are multiple regions of animated |
| 18 // content, AnimatedContentSampler will propose sampling the one having the | 18 // content, AnimatedContentSampler will propose sampling the one having the |
| 19 // largest "smoothness" impact, according to human perception (e.g., a 24 FPS | 19 // largest "smoothness" impact, according to human perception (e.g., a 24 FPS |
| 20 // video versus a 60 FPS busy spinner). | 20 // video versus a 60 FPS busy spinner). |
| 21 // | 21 // |
| 22 // In addition, AnimatedContentSampler will provide rewritten frame timestamps, | 22 // In addition, AnimatedContentSampler will provide rewritten frame timestamps, |
| 23 // for downstream consumers, that are "truer" to the source content than to the | 23 // for downstream consumers, that are "truer" to the source content than to the |
| 24 // local presentation hardware. | 24 // local presentation hardware. |
| 25 class CONTENT_EXPORT AnimatedContentSampler { | 25 class MEDIA_EXPORT AnimatedContentSampler { |
| 26 public: | 26 public: |
| 27 explicit AnimatedContentSampler(base::TimeDelta min_capture_period); | 27 explicit AnimatedContentSampler(base::TimeDelta min_capture_period); |
| 28 ~AnimatedContentSampler(); | 28 ~AnimatedContentSampler(); |
| 29 | 29 |
| 30 // Get/Set the target sampling period. This is used to determine whether to | 30 // Get/Set the target sampling period. This is used to determine whether to |
| 31 // subsample the frames of animated content. | 31 // subsample the frames of animated content. |
| 32 base::TimeDelta target_sampling_period() const { | 32 base::TimeDelta target_sampling_period() const { |
| 33 return target_sampling_period_; | 33 return target_sampling_period_; |
| 34 } | 34 } |
| 35 void SetTargetSamplingPeriod(base::TimeDelta period); | 35 void SetTargetSamplingPeriod(base::TimeDelta period); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // A token bucket that is used to decide which subset of the frames containing | 145 // A token bucket that is used to decide which subset of the frames containing |
| 146 // the animated content should be sampled. Here, the smallest discrete unit | 146 // the animated content should be sampled. Here, the smallest discrete unit |
| 147 // of time (one microsecond) equals one token; and, tokens are only taken from | 147 // of time (one microsecond) equals one token; and, tokens are only taken from |
| 148 // the bucket when at least a full sampling period's worth are present. | 148 // the bucket when at least a full sampling period's worth are present. |
| 149 base::TimeDelta token_bucket_; | 149 base::TimeDelta token_bucket_; |
| 150 | 150 |
| 151 // The rewritten frame timestamp for the latest event. | 151 // The rewritten frame timestamp for the latest event. |
| 152 base::TimeTicks frame_timestamp_; | 152 base::TimeTicks frame_timestamp_; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace content | 155 } // namespace media |
| 156 | 156 |
| 157 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_ANIMATED_CONTENT_SAMPLER_H_ | 157 #endif // MEDIA_CAPTURE_ANIMATED_CONTENT_SAMPLER_H_ |
| OLD | NEW |