OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 for (DesktopRegion::Iterator it(*updated_region); | 334 for (DesktopRegion::Iterator it(*updated_region); |
335 !it.IsAtEnd(); it.Advance()) { | 335 !it.IsAtEnd(); it.Advance()) { |
336 if (!x_server_pixel_buffer_.CaptureRect(it.rect(), frame.get())) | 336 if (!x_server_pixel_buffer_.CaptureRect(it.rect(), frame.get())) |
337 return nullptr; | 337 return nullptr; |
338 } | 338 } |
339 } else { | 339 } else { |
340 // Doing full-screen polling, or this is the first capture after a | 340 // Doing full-screen polling, or this is the first capture after a |
341 // screen-resolution change. In either case, need a full-screen capture. | 341 // screen-resolution change. In either case, need a full-screen capture. |
342 DesktopRect screen_rect = DesktopRect::MakeSize(frame->size()); | 342 DesktopRect screen_rect = DesktopRect::MakeSize(frame->size()); |
343 x_server_pixel_buffer_.CaptureRect(screen_rect, frame.get()); | 343 if (!x_server_pixel_buffer_.CaptureRect(screen_rect, frame.get())) |
| 344 return nullptr; |
344 updated_region->SetRect(screen_rect); | 345 updated_region->SetRect(screen_rect); |
345 } | 346 } |
346 | 347 |
347 return std::move(frame); | 348 return std::move(frame); |
348 } | 349 } |
349 | 350 |
350 void ScreenCapturerLinux::ScreenConfigurationChanged() { | 351 void ScreenCapturerLinux::ScreenConfigurationChanged() { |
351 // Make sure the frame buffers will be reallocated. | 352 // Make sure the frame buffers will be reallocated. |
352 queue_.Reset(); | 353 queue_.Reset(); |
353 | 354 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 410 |
410 std::unique_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux()); | 411 std::unique_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux()); |
411 if (!capturer.get()->Init(options)) { | 412 if (!capturer.get()->Init(options)) { |
412 return nullptr; | 413 return nullptr; |
413 } | 414 } |
414 | 415 |
415 return std::move(capturer); | 416 return std::move(capturer); |
416 } | 417 } |
417 | 418 |
418 } // namespace webrtc | 419 } // namespace webrtc |
OLD | NEW |