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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
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 | 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 | 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 | 47 // on recent event history, capture activity, and the availability of |
48 // resources. | 48 // resources. |
49 // | 49 // |
50 // If this method returns false, the caller should take no further action. | 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; | 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 | 52 // and the caller should initiate capture. Then, once the video frame has |
53 // video frame has been populated with its content. | 53 // been populated with its content, or if capture failed, the |callback| |
| 54 // should be run. |
54 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, | 55 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, |
55 const gfx::Rect& damage_rect, | 56 const gfx::Rect& damage_rect, |
56 base::TimeTicks event_time, | 57 base::TimeTicks event_time, |
57 scoped_refptr<VideoFrame>* storage, | 58 scoped_refptr<VideoFrame>* storage, |
58 CaptureFrameCallback* callback); | 59 CaptureFrameCallback* callback); |
59 | 60 |
60 // Attempt to re-send the last frame to the VideoCaptureDevice::Client. | 61 // 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 // 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 // available in the buffer pool, or if the VideoCaptureOracle decides to |
63 // reject the "passive" refresh. | 64 // reject the "passive" refresh. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Makes the decision to capture a frame. | 118 // Makes the decision to capture a frame. |
118 VideoCaptureOracle oracle_; | 119 VideoCaptureOracle oracle_; |
119 | 120 |
120 // The video capture parameters used to construct the oracle proxy. | 121 // The video capture parameters used to construct the oracle proxy. |
121 const VideoCaptureParams params_; | 122 const VideoCaptureParams params_; |
122 }; | 123 }; |
123 | 124 |
124 } // namespace media | 125 } // namespace media |
125 | 126 |
126 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ | 127 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
OLD | NEW |