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..80d910908b4fe213bb1f139795b329f2446de61f 100644 |
--- a/webrtc/modules/desktop_capture/desktop_capturer.h |
+++ b/webrtc/modules/desktop_capture/desktop_capturer.h |
@@ -15,24 +15,45 @@ |
#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 continue calling |
+ // Capture(), in the expectation that it will eventually recover. |
+ 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 if and |
+ // only if |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() {} |