Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc

Issue 2446733003: Update XServerPixelBuffer to handle errors returned from XGetImage(). (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc
diff --git a/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc b/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc
index b99763950ef77e52d6f6dd942947bce0e1b2bf6d..2ecac6b8b0321c87da9645770942fd9f827507c9 100644
--- a/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc
+++ b/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc
@@ -231,7 +231,7 @@ void XServerPixelBuffer::Synchronize() {
}
}
-void XServerPixelBuffer::CaptureRect(const DesktopRect& rect,
+bool XServerPixelBuffer::CaptureRect(const DesktopRect& rect,
DesktopFrame* frame) {
assert(rect.right() <= window_size_.width());
assert(rect.bottom() <= window_size_.height());
@@ -253,6 +253,9 @@ void XServerPixelBuffer::CaptureRect(const DesktopRect& rect,
XDestroyImage(x_image_);
x_image_ = XGetImage(display_, window_, rect.left(), rect.top(),
rect.width(), rect.height(), AllPlanes, ZPixmap);
+ if (!x_image_)
+ return false;
+
data = reinterpret_cast<uint8_t*>(x_image_->data);
}
@@ -261,6 +264,8 @@ void XServerPixelBuffer::CaptureRect(const DesktopRect& rect,
} else {
SlowBlit(data, rect, frame);
}
+
+ return true;
}
void XServerPixelBuffer::FastBlit(uint8_t* image,
« no previous file with comments | « webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698