| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 public SharedXDisplay::XEventHandler { | 47 public SharedXDisplay::XEventHandler { |
| 48 public: | 48 public: |
| 49 ScreenCapturerLinux(); | 49 ScreenCapturerLinux(); |
| 50 virtual ~ScreenCapturerLinux(); | 50 virtual ~ScreenCapturerLinux(); |
| 51 | 51 |
| 52 // TODO(ajwong): Do we really want this to be synchronous? | 52 // TODO(ajwong): Do we really want this to be synchronous? |
| 53 bool Init(const DesktopCaptureOptions& options); | 53 bool Init(const DesktopCaptureOptions& options); |
| 54 | 54 |
| 55 // DesktopCapturer interface. | 55 // DesktopCapturer interface. |
| 56 void Start(Callback* delegate) override; | 56 void Start(Callback* delegate) override; |
| 57 void Capture(const DesktopRegion& region) override; | 57 void CaptureFrame() override; |
| 58 | 58 |
| 59 // ScreenCapturer interface. | 59 // ScreenCapturer interface. |
| 60 bool GetScreenList(ScreenList* screens) override; | 60 bool GetScreenList(ScreenList* screens) override; |
| 61 bool SelectScreen(ScreenId id) override; | 61 bool SelectScreen(ScreenId id) override; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 Display* display() { return options_.x_display()->display(); } | 64 Display* display() { return options_.x_display()->display(); } |
| 65 | 65 |
| 66 // SharedXDisplay::XEventHandler interface. | 66 // SharedXDisplay::XEventHandler interface. |
| 67 bool HandleXEvent(const XEvent& event) override; | 67 bool HandleXEvent(const XEvent& event) override; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 LOG(LS_INFO) << "Using XDamage extension."; | 221 LOG(LS_INFO) << "Using XDamage extension."; |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ScreenCapturerLinux::Start(Callback* callback) { | 224 void ScreenCapturerLinux::Start(Callback* callback) { |
| 225 RTC_DCHECK(!callback_); | 225 RTC_DCHECK(!callback_); |
| 226 RTC_DCHECK(callback); | 226 RTC_DCHECK(callback); |
| 227 | 227 |
| 228 callback_ = callback; | 228 callback_ = callback; |
| 229 } | 229 } |
| 230 | 230 |
| 231 void ScreenCapturerLinux::Capture(const DesktopRegion& region) { | 231 void ScreenCapturerLinux::CaptureFrame() { |
| 232 int64_t capture_start_time_nanos = rtc::TimeNanos(); | 232 int64_t capture_start_time_nanos = rtc::TimeNanos(); |
| 233 | 233 |
| 234 queue_.MoveToNextFrame(); | 234 queue_.MoveToNextFrame(); |
| 235 RTC_DCHECK(!queue_.current_frame() || !queue_.current_frame()->IsShared()); | 235 RTC_DCHECK(!queue_.current_frame() || !queue_.current_frame()->IsShared()); |
| 236 | 236 |
| 237 // Process XEvents for XDamage and cursor shape tracking. | 237 // Process XEvents for XDamage and cursor shape tracking. |
| 238 options_.x_display()->ProcessPendingXEvents(); | 238 options_.x_display()->ProcessPendingXEvents(); |
| 239 | 239 |
| 240 // ProcessPendingXEvents() may call ScreenConfigurationChanged() which | 240 // ProcessPendingXEvents() may call ScreenConfigurationChanged() which |
| 241 // reinitializes |x_server_pixel_buffer_|. Check if the pixel buffer is still | 241 // reinitializes |x_server_pixel_buffer_|. Check if the pixel buffer is still |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 412 } |
| 413 | 413 |
| 414 if (options.detect_updated_region()) { | 414 if (options.detect_updated_region()) { |
| 415 capturer.reset(new ScreenCapturerDifferWrapper(std::move(capturer))); | 415 capturer.reset(new ScreenCapturerDifferWrapper(std::move(capturer))); |
| 416 } | 416 } |
| 417 | 417 |
| 418 return capturer.release(); | 418 return capturer.release(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 } // namespace webrtc | 421 } // namespace webrtc |
| OLD | NEW |