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

Side by Side Diff: webrtc/modules/desktop_capture/screen_capturer_x11.cc

Issue 2479553006: Remove GetWindowList / GetScreenList and SelectWindow / SelectScreen from WebRTC (Closed)
Patch Set: Resolve review comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 public: 48 public:
49 ScreenCapturerLinux(); 49 ScreenCapturerLinux();
50 ~ScreenCapturerLinux() override; 50 ~ScreenCapturerLinux() override;
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 CaptureFrame() override; 57 void CaptureFrame() override;
58 58 bool GetSourceList(SourceList* sources) override;
59 // ScreenCapturer interface. 59 bool SelectSource(SourceId id) override;
60 bool GetScreenList(ScreenList* screens) override;
61 bool SelectScreen(ScreenId id) override;
62 60
63 private: 61 private:
64 Display* display() { return options_.x_display()->display(); } 62 Display* display() { return options_.x_display()->display(); }
65 63
66 // SharedXDisplay::XEventHandler interface. 64 // SharedXDisplay::XEventHandler interface.
67 bool HandleXEvent(const XEvent& event) override; 65 bool HandleXEvent(const XEvent& event) override;
68 66
69 void InitXDamage(); 67 void InitXDamage();
70 68
71 // Capture screen pixels to the current buffer in the queue. In the DAMAGE 69 // Capture screen pixels to the current buffer in the queue. In the DAMAGE
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); 258 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
261 return; 259 return;
262 } 260 }
263 261
264 last_invalid_region_ = result->updated_region(); 262 last_invalid_region_ = result->updated_region();
265 result->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) / 263 result->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) /
266 rtc::kNumNanosecsPerMillisec); 264 rtc::kNumNanosecsPerMillisec);
267 callback_->OnCaptureResult(Result::SUCCESS, std::move(result)); 265 callback_->OnCaptureResult(Result::SUCCESS, std::move(result));
268 } 266 }
269 267
270 bool ScreenCapturerLinux::GetScreenList(ScreenList* screens) { 268 bool ScreenCapturerLinux::GetSourceList(SourceList* sources) {
271 RTC_DCHECK(screens->size() == 0); 269 RTC_DCHECK(sources->size() == 0);
272 // TODO(jiayl): implement screen enumeration. 270 // TODO(jiayl): implement screen enumeration.
273 Screen default_screen; 271 sources->push_back({0});
274 default_screen.id = 0;
275 screens->push_back(default_screen);
276 return true; 272 return true;
277 } 273 }
278 274
279 bool ScreenCapturerLinux::SelectScreen(ScreenId id) { 275 bool ScreenCapturerLinux::SelectSource(SourceId id) {
280 // TODO(jiayl): implement screen selection. 276 // TODO(jiayl): implement screen selection.
281 return true; 277 return true;
282 } 278 }
283 279
284 bool ScreenCapturerLinux::HandleXEvent(const XEvent& event) { 280 bool ScreenCapturerLinux::HandleXEvent(const XEvent& event) {
285 if (use_damage_ && (event.type == damage_event_base_ + XDamageNotify)) { 281 if (use_damage_ && (event.type == damage_event_base_ + XDamageNotify)) {
286 const XDamageNotifyEvent* damage_event = 282 const XDamageNotifyEvent* damage_event =
287 reinterpret_cast<const XDamageNotifyEvent*>(&event); 283 reinterpret_cast<const XDamageNotifyEvent*>(&event);
288 if (damage_event->damage != damage_handle_) 284 if (damage_event->damage != damage_handle_)
289 return false; 285 return false;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 428
433 std::unique_ptr<ScreenCapturer> capturer(new ScreenCapturerLinux()); 429 std::unique_ptr<ScreenCapturer> capturer(new ScreenCapturerLinux());
434 if (!static_cast<ScreenCapturerLinux*>(capturer.get())->Init(options)) { 430 if (!static_cast<ScreenCapturerLinux*>(capturer.get())->Init(options)) {
435 return nullptr; 431 return nullptr;
436 } 432 }
437 433
438 return capturer; 434 return capturer;
439 } 435 }
440 436
441 } // namespace webrtc 437 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698