| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_THREAD_SAFE_CAPTURE_ORACLE_H_ | 5 #ifndef MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
| 6 #define MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ | 6 #define MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 bool enable_auto_throttling); | 35 bool enable_auto_throttling); |
| 36 | 36 |
| 37 // Called when a captured frame is available or an error has occurred. | 37 // Called when a captured frame is available or an error has occurred. |
| 38 // If |success| is true then |frame| is valid and |timestamp| indicates when | 38 // If |success| is true then |frame| is valid and |timestamp| indicates when |
| 39 // the frame was painted. | 39 // the frame was painted. |
| 40 // If |success| is false, all other parameters are invalid. | 40 // If |success| is false, all other parameters are invalid. |
| 41 typedef base::Callback<void(const scoped_refptr<VideoFrame>& frame, | 41 typedef base::Callback<void(const scoped_refptr<VideoFrame>& frame, |
| 42 base::TimeTicks timestamp, | 42 base::TimeTicks timestamp, |
| 43 bool success)> CaptureFrameCallback; | 43 bool success)> CaptureFrameCallback; |
| 44 | 44 |
| 45 // Record a change |event| along with its |damage_rect| and |event_time|, and | |
| 46 // then make a decision whether to proceed with capture. The decision is based | |
| 47 // on recent event history, capture activity, and the availability of | |
| 48 // resources. | |
| 49 // | |
| 50 // If this method returns false, the caller should take no further action. | |
| 51 // Otherwise, |storage| is set to the destination for the video frame capture; | |
| 52 // and, the caller should initiate capture, and then run |callback| once the | |
| 53 // video frame has been populated with its content. | |
| 54 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, | 45 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, |
| 55 const gfx::Rect& damage_rect, | 46 const gfx::Rect& damage_rect, |
| 56 base::TimeTicks event_time, | 47 base::TimeTicks event_time, |
| 57 scoped_refptr<VideoFrame>* storage, | 48 scoped_refptr<VideoFrame>* storage, |
| 58 CaptureFrameCallback* callback); | 49 CaptureFrameCallback* callback); |
| 59 | 50 |
| 60 // Attempt to re-send the last frame to the VideoCaptureDevice::Client. | |
| 61 // Returns true if successful. This can fail if the last frame is no longer | |
| 62 // available in the buffer pool, or if the VideoCaptureOracle decides to | |
| 63 // reject the "passive" refresh. | |
| 64 bool AttemptPassiveRefresh(); | |
| 65 | |
| 66 base::TimeDelta min_capture_period() const { | 51 base::TimeDelta min_capture_period() const { |
| 67 return oracle_.min_capture_period(); | 52 return oracle_.min_capture_period(); |
| 68 } | 53 } |
| 69 | 54 |
| 70 base::TimeTicks last_time_animation_was_detected() const { | 55 base::TimeTicks last_time_animation_was_detected() const { |
| 71 return oracle_.last_time_animation_was_detected(); | 56 return oracle_.last_time_animation_was_detected(); |
| 72 } | 57 } |
| 73 | 58 |
| 74 gfx::Size max_frame_size() const { | 59 gfx::Size max_frame_size() const { |
| 75 return params_.requested_format.frame_size; | 60 return params_.requested_format.frame_size; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Makes the decision to capture a frame. | 101 // Makes the decision to capture a frame. |
| 117 VideoCaptureOracle oracle_; | 102 VideoCaptureOracle oracle_; |
| 118 | 103 |
| 119 // The video capture parameters used to construct the oracle proxy. | 104 // The video capture parameters used to construct the oracle proxy. |
| 120 const VideoCaptureParams params_; | 105 const VideoCaptureParams params_; |
| 121 }; | 106 }; |
| 122 | 107 |
| 123 } // namespace media | 108 } // namespace media |
| 124 | 109 |
| 125 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ | 110 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
| OLD | NEW |