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 #ifndef MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_ | 5 #ifndef MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_ORACLE_H_ |
6 #define MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_ | 6 #define MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_ORACLE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
12 #include "media/capture/content/animated_content_sampler.h" | 12 #include "media/capture/content/animated_content_sampler.h" |
13 #include "media/capture/content/capture_resolution_chooser.h" | 13 #include "media/capture/content/capture_resolution_chooser.h" |
14 #include "media/capture/content/feedback_signal_accumulator.h" | 14 #include "media/capture/content/feedback_signal_accumulator.h" |
15 #include "media/capture/content/smooth_event_sampler.h" | 15 #include "media/capture/content/smooth_event_sampler.h" |
16 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // be non-zero if the call returned true. | 91 // be non-zero if the call returned true. |
92 base::TimeDelta estimated_frame_duration() const { | 92 base::TimeDelta estimated_frame_duration() const { |
93 return duration_of_next_frame_; | 93 return duration_of_next_frame_; |
94 } | 94 } |
95 | 95 |
96 // Returns the capture frame size the client should use. This is updated by | 96 // Returns the capture frame size the client should use. This is updated by |
97 // calls to ObserveEventAndDecideCapture(). The oracle prevents too-frequent | 97 // calls to ObserveEventAndDecideCapture(). The oracle prevents too-frequent |
98 // changes to the capture size, to avoid stressing the end-to-end pipeline. | 98 // changes to the capture size, to avoid stressing the end-to-end pipeline. |
99 gfx::Size capture_size() const { return capture_size_; } | 99 gfx::Size capture_size() const { return capture_size_; } |
100 | 100 |
| 101 // Returns the oracle's estimate of the last time animation was detected. |
| 102 base::TimeTicks last_time_animation_was_detected() const { |
| 103 return last_time_animation_was_detected_; |
| 104 } |
| 105 |
101 private: | 106 private: |
102 // Retrieve/Assign a frame timestamp by capture |frame_number|. Only valid | 107 // Retrieve/Assign a frame timestamp by capture |frame_number|. Only valid |
103 // when IsFrameInRecentHistory(frame_number) returns true. | 108 // when IsFrameInRecentHistory(frame_number) returns true. |
104 base::TimeTicks GetFrameTimestamp(int frame_number) const; | 109 base::TimeTicks GetFrameTimestamp(int frame_number) const; |
105 void SetFrameTimestamp(int frame_number, base::TimeTicks timestamp); | 110 void SetFrameTimestamp(int frame_number, base::TimeTicks timestamp); |
106 | 111 |
107 // Returns true if the frame timestamp ring-buffer currently includes a | 112 // Returns true if the frame timestamp ring-buffer currently includes a |
108 // slot for the given |frame_number|. | 113 // slot for the given |frame_number|. |
109 bool IsFrameInRecentHistory(int frame_number) const; | 114 bool IsFrameInRecentHistory(int frame_number) const; |
110 | 115 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 base::TimeTicks start_time_of_underutilization_; | 197 base::TimeTicks start_time_of_underutilization_; |
193 | 198 |
194 // The timestamp of the frame where |content_sampler_| last detected | 199 // The timestamp of the frame where |content_sampler_| last detected |
195 // animation. This determines whether capture size increases will be | 200 // animation. This determines whether capture size increases will be |
196 // aggressive (because content is not animating). | 201 // aggressive (because content is not animating). |
197 base::TimeTicks last_time_animation_was_detected_; | 202 base::TimeTicks last_time_animation_was_detected_; |
198 }; | 203 }; |
199 | 204 |
200 } // namespace media | 205 } // namespace media |
201 | 206 |
202 #endif // MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_ | 207 #endif // MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_ORACLE_H_ |
OLD | NEW |