| 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_CONTENT_VIDEO_CAPTURE_ORACLE_H_ | 5 #ifndef MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_ORACLE_H_ |
| 6 #define MEDIA_CAPTURE_CONTENT_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/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/base/feedback_signal_accumulator.h" | 10 #include "media/base/feedback_signal_accumulator.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void SetSourceSize(const gfx::Size& source_size); | 43 void SetSourceSize(const gfx::Size& source_size); |
| 44 | 44 |
| 45 // Record a event of type |event|, and decide whether the caller should do a | 45 // Record a event of type |event|, and decide whether the caller should do a |
| 46 // frame capture. |damage_rect| is the region of a frame about to be drawn, | 46 // frame capture. |damage_rect| is the region of a frame about to be drawn, |
| 47 // and may be an empty Rect, if this is not known. If the caller accepts the | 47 // and may be an empty Rect, if this is not known. If the caller accepts the |
| 48 // oracle's proposal, it should call RecordCapture() to indicate this. | 48 // oracle's proposal, it should call RecordCapture() to indicate this. |
| 49 bool ObserveEventAndDecideCapture(Event event, | 49 bool ObserveEventAndDecideCapture(Event event, |
| 50 const gfx::Rect& damage_rect, | 50 const gfx::Rect& damage_rect, |
| 51 base::TimeTicks event_time); | 51 base::TimeTicks event_time); |
| 52 | 52 |
| 53 // Returns the |frame_number| to be used with CompleteCapture(). |
| 54 int next_frame_number() const; |
| 55 |
| 53 // Record and update internal state based on whether the frame capture will be | 56 // Record and update internal state based on whether the frame capture will be |
| 54 // started. |pool_utilization| is a value in the range 0.0 to 1.0 to indicate | 57 // started. |pool_utilization| is a value in the range 0.0 to 1.0 to indicate |
| 55 // the current buffer pool utilization relative to a sustainable maximum (not | 58 // the current buffer pool utilization relative to a sustainable maximum (not |
| 56 // the absolute maximum). This method should only be called if the last call | 59 // the absolute maximum). This method should only be called if the last call |
| 57 // to ObserveEventAndDecideCapture() returned true. The first method returns | 60 // to ObserveEventAndDecideCapture() returned true. |
| 58 // the |frame_number| to be used with CompleteCapture(). | 61 void RecordCapture(double pool_utilization); |
| 59 int RecordCapture(double pool_utilization); | |
| 60 void RecordWillNotCapture(double pool_utilization); | 62 void RecordWillNotCapture(double pool_utilization); |
| 61 | 63 |
| 62 // Notify of the completion of a capture, and whether it was successful. | 64 // Notify of the completion of a capture, and whether it was successful. |
| 63 // Returns true iff the captured frame should be delivered. |frame_timestamp| | 65 // Returns true iff the captured frame should be delivered. |frame_timestamp| |
| 64 // is set to the timestamp that should be provided to the consumer of the | 66 // is set to the timestamp that should be provided to the consumer of the |
| 65 // frame. | 67 // frame. |
| 66 bool CompleteCapture(int frame_number, | 68 bool CompleteCapture(int frame_number, |
| 67 bool capture_was_successful, | 69 bool capture_was_successful, |
| 68 base::TimeTicks* frame_timestamp); | 70 base::TimeTicks* frame_timestamp); |
| 69 | 71 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 198 |
| 197 // The timestamp of the frame where |content_sampler_| last detected | 199 // The timestamp of the frame where |content_sampler_| last detected |
| 198 // animation. This determines whether capture size increases will be | 200 // animation. This determines whether capture size increases will be |
| 199 // aggressive (because content is not animating). | 201 // aggressive (because content is not animating). |
| 200 base::TimeTicks last_time_animation_was_detected_; | 202 base::TimeTicks last_time_animation_was_detected_; |
| 201 }; | 203 }; |
| 202 | 204 |
| 203 } // namespace media | 205 } // namespace media |
| 204 | 206 |
| 205 #endif // MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_ORACLE_H_ | 207 #endif // MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_ORACLE_H_ |
| OLD | NEW |