Index: webrtc/modules/desktop_capture/window_capturer_mac.mm |
diff --git a/webrtc/modules/desktop_capture/window_capturer_mac.mm b/webrtc/modules/desktop_capture/window_capturer_mac.mm |
index cbdf14be6fce24671d5518094cfd45320158823e..ac5fdb6bc1abd003873b6cee4579816f5e55ff5f 100644 |
--- a/webrtc/modules/desktop_capture/window_capturer_mac.mm |
+++ b/webrtc/modules/desktop_capture/window_capturer_mac.mm |
@@ -32,7 +32,7 @@ |
// Returns true if the window exists. |
bool IsWindowValid(CGWindowID id) { |
CFArrayRef window_id_array = |
- CFArrayCreate(nullptr, reinterpret_cast<const void**>(&id), 1, nullptr); |
+ CFArrayCreate(NULL, reinterpret_cast<const void **>(&id), 1, NULL); |
CFArrayRef window_array = |
CGWindowListCreateDescriptionFromArray(window_id_array); |
bool valid = window_array && CFArrayGetCount(window_array); |
@@ -58,10 +58,10 @@ |
void Capture(const DesktopRegion& region) override; |
private: |
- Callback* callback_ = nullptr; |
+ Callback* callback_; |
// The window being captured. |
- CGWindowID window_id_ = 0; |
+ CGWindowID window_id_; |
rtc::scoped_refptr<FullScreenChromeWindowDetector> |
full_screen_chrome_window_detector_; |
@@ -69,12 +69,15 @@ |
RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerMac); |
}; |
-WindowCapturerMac::WindowCapturerMac( |
- rtc::scoped_refptr<FullScreenChromeWindowDetector> |
- full_screen_chrome_window_detector) |
- : full_screen_chrome_window_detector_(full_screen_chrome_window_detector) {} |
- |
-WindowCapturerMac::~WindowCapturerMac() {} |
+WindowCapturerMac::WindowCapturerMac(rtc::scoped_refptr< |
+ FullScreenChromeWindowDetector> full_screen_chrome_window_detector) |
+ : callback_(NULL), |
+ window_id_(0), |
+ full_screen_chrome_window_detector_(full_screen_chrome_window_detector) { |
+} |
+ |
+WindowCapturerMac::~WindowCapturerMac() { |
+} |
bool WindowCapturerMac::GetWindowList(WindowList* windows) { |
// Only get on screen, non-desktop windows. |
@@ -139,11 +142,11 @@ |
CGWindowID ids[1]; |
ids[0] = window_id_; |
CFArrayRef window_id_array = |
- CFArrayCreate(nullptr, reinterpret_cast<const void**>(&ids), 1, nullptr); |
+ CFArrayCreate(NULL, reinterpret_cast<const void **>(&ids), 1, NULL); |
CFArrayRef window_array = |
CGWindowListCreateDescriptionFromArray(window_id_array); |
- if (!window_array || 0 == CFArrayGetCount(window_array)) { |
+ if (window_array == NULL || 0 == CFArrayGetCount(window_array)) { |
// Could not find the window. It might have been closed. |
LOG(LS_INFO) << "Window not found"; |
CFRelease(window_id_array); |
@@ -178,7 +181,7 @@ |
void WindowCapturerMac::Capture(const DesktopRegion& region) { |
if (!IsWindowValid(window_id_)) { |
- callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); |
+ callback_->OnCaptureCompleted(NULL); |
return; |
} |
@@ -196,7 +199,7 @@ |
on_screen_window, kCGWindowImageBoundsIgnoreFraming); |
if (!window_image) { |
- callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); |
+ callback_->OnCaptureCompleted(NULL); |
return; |
} |
@@ -204,7 +207,7 @@ |
if (bits_per_pixel != 32) { |
LOG(LS_ERROR) << "Unsupported window image depth: " << bits_per_pixel; |
CFRelease(window_image); |
- callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); |
+ callback_->OnCaptureCompleted(NULL); |
return; |
} |
@@ -212,8 +215,8 @@ |
int height = CGImageGetHeight(window_image); |
CGDataProviderRef provider = CGImageGetDataProvider(window_image); |
CFDataRef cf_data = CGDataProviderCopyData(provider); |
- std::unique_ptr<DesktopFrame> frame( |
- new BasicDesktopFrame(DesktopSize(width, height))); |
+ DesktopFrame* frame = new BasicDesktopFrame( |
+ DesktopSize(width, height)); |
int src_stride = CGImageGetBytesPerRow(window_image); |
const uint8_t* src_data = CFDataGetBytePtr(cf_data); |
@@ -228,7 +231,7 @@ |
frame->mutable_updated_region()->SetRect( |
DesktopRect::MakeSize(frame->size())); |
- callback_->OnCaptureResult(Result::SUCCESS, std::move(frame)); |
+ callback_->OnCaptureCompleted(frame); |
if (full_screen_chrome_window_detector_) |
full_screen_chrome_window_detector_->UpdateWindowListIfNeeded(window_id_); |