| 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. |
| 45 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, | 54 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, |
| 46 const gfx::Rect& damage_rect, | 55 const gfx::Rect& damage_rect, |
| 47 base::TimeTicks event_time, | 56 base::TimeTicks event_time, |
| 48 scoped_refptr<VideoFrame>* storage, | 57 scoped_refptr<VideoFrame>* storage, |
| 49 CaptureFrameCallback* callback); | 58 CaptureFrameCallback* callback); |
| 50 | 59 |
| 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 |
| 51 base::TimeDelta min_capture_period() const { | 66 base::TimeDelta min_capture_period() const { |
| 52 return oracle_.min_capture_period(); | 67 return oracle_.min_capture_period(); |
| 53 } | 68 } |
| 54 | 69 |
| 55 base::TimeTicks last_time_animation_was_detected() const { | 70 base::TimeTicks last_time_animation_was_detected() const { |
| 56 return oracle_.last_time_animation_was_detected(); | 71 return oracle_.last_time_animation_was_detected(); |
| 57 } | 72 } |
| 58 | 73 |
| 59 gfx::Size max_frame_size() const { | 74 gfx::Size max_frame_size() const { |
| 60 return params_.requested_format.frame_size; | 75 return params_.requested_format.frame_size; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Makes the decision to capture a frame. | 116 // Makes the decision to capture a frame. |
| 102 VideoCaptureOracle oracle_; | 117 VideoCaptureOracle oracle_; |
| 103 | 118 |
| 104 // The video capture parameters used to construct the oracle proxy. | 119 // The video capture parameters used to construct the oracle proxy. |
| 105 const VideoCaptureParams params_; | 120 const VideoCaptureParams params_; |
| 106 }; | 121 }; |
| 107 | 122 |
| 108 } // namespace media | 123 } // namespace media |
| 109 | 124 |
| 110 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ | 125 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
| OLD | NEW |