Chromium Code Reviews| 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 bcfcb7e02792a86c940852aab545d1783f7b329d..0d1027962d6bfbd1d173369d9038ac7b8176c7a8 100644 |
| --- a/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc |
| +++ b/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc |
| @@ -60,10 +60,13 @@ bool IsXImageRGBFormat(XImage* image) { |
| namespace webrtc { |
| XServerPixelBuffer::XServerPixelBuffer() |
| - : display_(NULL), window_(0), |
| + : display_(NULL), |
| + window_(0), |
| x_image_(NULL), |
| - shm_segment_info_(NULL), shm_pixmap_(0), shm_gc_(NULL) { |
| -} |
| + shm_segment_info_(NULL), |
| + shm_pixmap_(0), |
| + shm_gc_(NULL), |
| + is_xshmgetimage_success_(false) {} |
|
Sergey Ulanov
2016/06/09 22:04:21
Move all initializers to the class definition in t
GeorgeZ
2016/06/10 20:10:37
Done.
|
| XServerPixelBuffer::~XServerPixelBuffer() { |
| Release(); |
| @@ -229,7 +232,10 @@ void XServerPixelBuffer::Synchronize() { |
| if (shm_segment_info_ && !shm_pixmap_) { |
| // XShmGetImage can fail if the display is being reconfigured. |
| XErrorTrap error_trap(display_); |
| - XShmGetImage(display_, window_, x_image_, 0, 0, AllPlanes); |
| + if (XShmGetImage(display_, window_, x_image_, 0, 0, AllPlanes)) |
|
Sergey Ulanov
2016/06/09 22:04:21
is_xshmgetimage_success_ = XShmGetImage(...);
Sergey Ulanov
2016/06/09 22:04:21
Add a comment that the call may also fail if the w
GeorgeZ
2016/06/10 20:10:37
Done.
GeorgeZ
2016/06/10 20:10:37
Done.
|
| + is_xshmgetimage_success_ = true; |
| + else |
| + is_xshmgetimage_success_ = false; |
| } |
| } |
| @@ -240,7 +246,7 @@ void XServerPixelBuffer::CaptureRect(const DesktopRect& rect, |
| uint8_t* data; |
| - if (shm_segment_info_) { |
| + if (shm_segment_info_ && is_xshmgetimage_success_) { |
|
Sergey Ulanov
2016/06/09 22:04:21
This code won't work correctly when using shm_pixm
GeorgeZ
2016/06/10 20:10:37
Done. Good to know.
|
| if (shm_pixmap_) { |
| XCopyArea(display_, window_, shm_pixmap_, shm_gc_, |
| rect.left(), rect.top(), rect.width(), rect.height(), |