Index: webrtc/modules/desktop_capture/desktop_capturer.h |
diff --git a/webrtc/modules/desktop_capture/desktop_capturer.h b/webrtc/modules/desktop_capture/desktop_capturer.h |
index ba70e0155373410475cff8b27a8362bae453b265..23821280999f3dfaed6f3d8ae9d400a91f3bdc76 100644 |
--- a/webrtc/modules/desktop_capture/desktop_capturer.h |
+++ b/webrtc/modules/desktop_capture/desktop_capturer.h |
@@ -15,24 +15,44 @@ |
#include <memory> |
+#include "webrtc/modules/desktop_capture/desktop_frame.h" |
#include "webrtc/modules/desktop_capture/desktop_capture_types.h" |
#include "webrtc/modules/desktop_capture/shared_memory.h" |
namespace webrtc { |
class DesktopFrame; |
-class DesktopRegion; |
// Abstract interface for screen and window capturers. |
class DesktopCapturer { |
public: |
+ enum class Result { |
+ // The frame was captured successfully. |
+ SUCCESS, |
+ |
+ // There was a temporary error. The caller should retry capting again. |
Wez
2016/06/01 21:29:05
typo: capting
nit: IIUC what you mean here is tha
Sergey Ulanov
2016/06/03 08:14:31
Good point. Reworded the comment a bit.
|
+ ERROR_TEMPORARY, |
+ |
+ // Capture has failed and will keep failing if the caller tries calling |
+ // Capture() again. |
+ ERROR_PERMANENT, |
+ }; |
+ |
// Interface that must be implemented by the DesktopCapturer consumers. |
class Callback { |
public: |
- // Called after a frame has been captured. Handler must take ownership of |
- // |frame|. If capture has failed for any reason |frame| is set to NULL |
- // (e.g. the window has been closed). |
- virtual void OnCaptureCompleted(DesktopFrame* frame) = 0; |
+ // Called after a frame has been captured. |frame| is not nullptr iff |
Wez
2016/06/01 21:29:05
nit: I've been told off before for using "iff". ;)
Sergey Ulanov
2016/06/03 08:14:31
Done.
|
+ // |result| is SUCCESS. |
+ virtual void OnCaptureResult(Result result, |
+ std::unique_ptr<DesktopFrame> frame) { |
+ OnCaptureCompleted(frame.release()); |
+ } |
+ |
+ // Deprecated version of the method above that uses raw pointer instead of |
+ // std::unique_ptr<>. |
+ // TODO(sergeyu): Remove this method and make OnCaptureResult() pure |
+ // virtual. crbug.com/webrtc/5950 |
+ virtual void OnCaptureCompleted(DesktopFrame* frame) { delete frame; }; |
protected: |
virtual ~Callback() {} |