OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BASE_VIDEO_CAPTURER_SOURCE_H_ | 5 #ifndef MEDIA_BASE_VIDEO_CAPTURER_SOURCE_H_ |
6 #define MEDIA_BASE_VIDEO_CAPTURER_SOURCE_H_ | 6 #define MEDIA_BASE_VIDEO_CAPTURER_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual void StartCapture( | 74 virtual void StartCapture( |
75 const media::VideoCaptureParams& params, | 75 const media::VideoCaptureParams& params, |
76 const VideoCaptureDeliverFrameCB& new_frame_callback, | 76 const VideoCaptureDeliverFrameCB& new_frame_callback, |
77 const RunningCallback& running_callback) = 0; | 77 const RunningCallback& running_callback) = 0; |
78 | 78 |
79 // Asks source to send a refresh frame. In cases where source does not provide | 79 // Asks source to send a refresh frame. In cases where source does not provide |
80 // a continuous rate of new frames (e.g. canvas capture, screen capture where | 80 // a continuous rate of new frames (e.g. canvas capture, screen capture where |
81 // the screen's content has not changed in a while), consumers may request a | 81 // the screen's content has not changed in a while), consumers may request a |
82 // "refresh frame" to be delivered. For instance, this would be needed when | 82 // "refresh frame" to be delivered. For instance, this would be needed when |
83 // a new sink is added to a MediaStreamTrack. | 83 // a new sink is added to a MediaStreamTrack. |
| 84 // |
84 // The default implementation is a no-op and implementations are not required | 85 // The default implementation is a no-op and implementations are not required |
85 // to honor this request. If they decide to and capturing is started | 86 // to honor this request. If they decide to and capturing is started |
86 // successfully, then |new_frame_callback| should be called with a frame. | 87 // successfully, then |new_frame_callback| should be called with a frame. |
| 88 // |
| 89 // Note: This should only be called after StartCapture() and before |
| 90 // StopCapture(). Otherwise, its behavior is undefined. |
87 virtual void RequestRefreshFrame() {} | 91 virtual void RequestRefreshFrame() {} |
88 | 92 |
| 93 // Optionally suspends frame delivery. The source may or may not honor this |
| 94 // request. Thus, the caller cannot assume frame delivery will actually |
| 95 // stop. Even if frame delivery is suspended, this might not take effect |
| 96 // immediately. |
| 97 // |
| 98 // The purpose of this is to allow minimizing resource usage while |
| 99 // there are no frame consumers present. |
| 100 // |
| 101 // Note: This should only be called after StartCapture() and before |
| 102 // StopCapture(). Otherwise, its behavior is undefined. |
| 103 virtual void MaybeSuspend() {} |
| 104 |
| 105 // Resumes frame delivery, if it was suspended. If frame delivery was not |
| 106 // suspended, this is a no-op, and frame delivery will continue. |
| 107 // |
| 108 // Note: This should only be called after StartCapture() and before |
| 109 // StopCapture(). Otherwise, its behavior is undefined. |
| 110 virtual void Resume() {} |
| 111 |
89 // Stops capturing frames and clears all callbacks including the | 112 // Stops capturing frames and clears all callbacks including the |
90 // SupportedFormatsCallback callback. Note that queued frame callbacks | 113 // SupportedFormatsCallback callback. Note that queued frame callbacks |
91 // may still occur after this call, so the caller must take care to | 114 // may still occur after this call, so the caller must take care to |
92 // use refcounted or weak references in |new_frame_callback|. | 115 // use refcounted or weak references in |new_frame_callback|. |
93 virtual void StopCapture() = 0; | 116 virtual void StopCapture() = 0; |
94 }; | 117 }; |
95 | 118 |
96 } // namespace media | 119 } // namespace media |
97 | 120 |
98 #endif // MEDIA_BASE_VIDEO_CAPTURER_SOURCE_H_ | 121 #endif // MEDIA_BASE_VIDEO_CAPTURER_SOURCE_H_ |
OLD | NEW |