From 91902cb6c0e1753c1bebb2848992092fb1e5d419 Mon Sep 17 00:00:00 2001 From: zijiehe Date: Thu, 13 Oct 2016 16:47:49 -0700 Subject: [PATCH] Remove DesktopRegion parameter from DesktopCapturer::Capture. To ensure this change won't break Chromium, this is the first change, to add a new CaptureFrame() function, and let Capture(DesktopRegion) and CaptureFrame() call each other. So both a legacy consumer or a legacy implementation won't be broken. BUG=https://bugs.chromium.org/p/webrtc/issues/detail?id=6513 Review-Url: https://codereview.webrtc.org/2409833002 Cr-Commit-Position: refs/heads/master@{#14635} --- .../desktop_capture/cropping_window_capturer.cc | 6 +++--- .../desktop_capture/cropping_window_capturer.h | 2 +- .../desktop_capture/desktop_and_cursor_composer.cc | 4 ++-- .../desktop_capture/desktop_and_cursor_composer.h | 2 +- .../desktop_and_cursor_composer_unittest.cc | 6 +++--- webrtc/modules/desktop_capture/desktop_capturer.h | 13 ++++++------- .../modules/desktop_capture/fake_desktop_capturer.h | 2 +- .../screen_capturer_differ_wrapper.cc | 4 ++-- .../screen_capturer_differ_wrapper.h | 2 +- .../screen_capturer_differ_wrapper_unittest.cc | 6 +++--- .../modules/desktop_capture/screen_capturer_mac.mm | 4 ++-- .../desktop_capture/screen_capturer_mock_objects.h | 7 ++++++- .../desktop_capture/screen_capturer_unittest.cc | 12 ++++++------ .../modules/desktop_capture/screen_capturer_x11.cc | 4 ++-- .../win/screen_capturer_win_directx.cc | 2 +- .../win/screen_capturer_win_directx.h | 2 +- .../desktop_capture/win/screen_capturer_win_gdi.cc | 2 +- .../desktop_capture/win/screen_capturer_win_gdi.h | 2 +- .../win/screen_capturer_win_magnifier.cc | 6 +++--- .../win/screen_capturer_win_magnifier.h | 2 +- .../modules/desktop_capture/window_capturer_mac.mm | 4 ++-- .../modules/desktop_capture/window_capturer_null.cc | 4 ++-- .../modules/desktop_capture/window_capturer_win.cc | 4 ++-- .../modules/desktop_capture/window_capturer_x11.cc | 4 ++-- 24 files changed, 55 insertions(+), 51 deletions(-) diff --git a/webrtc/modules/desktop_capture/cropping_window_capturer.cc b/webrtc/modules/desktop_capture/cropping_window_capturer.cc index 50aaeea030..63a62f559b 100644 --- a/webrtc/modules/desktop_capture/cropping_window_capturer.cc +++ b/webrtc/modules/desktop_capture/cropping_window_capturer.cc @@ -36,7 +36,7 @@ void CroppingWindowCapturer::SetSharedMemoryFactory( window_capturer_->SetSharedMemoryFactory(std::move(shared_memory_factory)); } -void CroppingWindowCapturer::Capture(const DesktopRegion& region) { +void CroppingWindowCapturer::CaptureFrame() { if (ShouldUseScreenCapturer()) { if (!screen_capturer_.get()) { screen_capturer_.reset(ScreenCapturer::Create(options_)); @@ -45,9 +45,9 @@ void CroppingWindowCapturer::Capture(const DesktopRegion& region) { } screen_capturer_->Start(this); } - screen_capturer_->Capture(region); + screen_capturer_->CaptureFrame(); } else { - window_capturer_->Capture(region); + window_capturer_->CaptureFrame(); } } diff --git a/webrtc/modules/desktop_capture/cropping_window_capturer.h b/webrtc/modules/desktop_capture/cropping_window_capturer.h index e2db7daf10..d24d770aed 100644 --- a/webrtc/modules/desktop_capture/cropping_window_capturer.h +++ b/webrtc/modules/desktop_capture/cropping_window_capturer.h @@ -32,7 +32,7 @@ class CroppingWindowCapturer : public WindowCapturer, void Start(DesktopCapturer::Callback* callback) override; void SetSharedMemoryFactory( std::unique_ptr shared_memory_factory) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; void SetExcludedWindow(WindowId window) override; // WindowCapturer implementation. diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc index a4deda6ae9..0ff3373e82 100644 --- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc +++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc @@ -145,10 +145,10 @@ void DesktopAndCursorComposer::SetSharedMemoryFactory( desktop_capturer_->SetSharedMemoryFactory(std::move(shared_memory_factory)); } -void DesktopAndCursorComposer::Capture(const DesktopRegion& region) { +void DesktopAndCursorComposer::CaptureFrame() { if (mouse_monitor_.get()) mouse_monitor_->Capture(); - desktop_capturer_->Capture(region); + desktop_capturer_->CaptureFrame(); } void DesktopAndCursorComposer::SetExcludedWindow(WindowId window) { diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h index ef6340211f..801d3e3c9d 100644 --- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h +++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h @@ -37,7 +37,7 @@ class DesktopAndCursorComposer : public DesktopCapturer, void Start(DesktopCapturer::Callback* callback) override; void SetSharedMemoryFactory( std::unique_ptr shared_memory_factory) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; void SetExcludedWindow(WindowId window) override; private: diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc b/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc index 5e7a02a9c8..77471b8efe 100644 --- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc +++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc @@ -77,7 +77,7 @@ class FakeScreenCapturer : public DesktopCapturer { void Start(Callback* callback) override { callback_ = callback; } - void Capture(const DesktopRegion& region) override { + void CaptureFrame() override { callback_->OnCaptureResult( next_frame_ ? Result::SUCCESS : Result::ERROR_TEMPORARY, std::move(next_frame_)); @@ -193,7 +193,7 @@ TEST_F(DesktopAndCursorComposerTest, Error) { fake_cursor_->SetState(MouseCursorMonitor::INSIDE, DesktopVector()); fake_screen_->SetNextFrame(nullptr); - blender_.Capture(DesktopRegion()); + blender_.CaptureFrame(); EXPECT_FALSE(frame_); } @@ -237,7 +237,7 @@ TEST_F(DesktopAndCursorComposerTest, Blend) { SharedDesktopFrame::Wrap(CreateTestFrame())); fake_screen_->SetNextFrame(frame->Share()); - blender_.Capture(DesktopRegion()); + blender_.CaptureFrame(); VerifyFrame(*frame_, state, pos); diff --git a/webrtc/modules/desktop_capture/desktop_capturer.h b/webrtc/modules/desktop_capture/desktop_capturer.h index 778c93c63a..0c7b68e85d 100644 --- a/webrtc/modules/desktop_capture/desktop_capturer.h +++ b/webrtc/modules/desktop_capture/desktop_capturer.h @@ -66,13 +66,12 @@ class DesktopCapturer { virtual void SetSharedMemoryFactory( std::unique_ptr shared_memory_factory) {} - // Captures next frame. |region| specifies region of the capture target that - // should be fresh in the resulting frame. The frame may also include fresh - // data for areas outside |region|. In that case capturer will include these - // areas in updated_region() of the frame. |region| is specified relative to - // the top left corner of the capture target. Pending capture operations are - // canceled when DesktopCapturer is deleted. - virtual void Capture(const DesktopRegion& region) = 0; + // This is a legacy interface, consumers should call CaptureFrame() function. + virtual void Capture(const DesktopRegion& region) { CaptureFrame(); } + + // Captures next frame, and involve callback provided by Start() function. + // Pending capture requests are canceled when DesktopCapturer is deleted. + virtual void CaptureFrame() { Capture(DesktopRegion()); } // Sets the window to be excluded from the captured image in the future // Capture calls. Used to exclude the screenshare notification window for diff --git a/webrtc/modules/desktop_capture/fake_desktop_capturer.h b/webrtc/modules/desktop_capture/fake_desktop_capturer.h index db53809ec5..fa5ccba7eb 100644 --- a/webrtc/modules/desktop_capture/fake_desktop_capturer.h +++ b/webrtc/modules/desktop_capture/fake_desktop_capturer.h @@ -62,7 +62,7 @@ class FakeDesktopCapturer : public T { callback_ = callback; } - void Capture(const DesktopRegion& region) override { + void CaptureFrame() override { if (generator_) { std::unique_ptr frame( generator_->GetNextFrame(shared_memory_factory_.get())); diff --git a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.cc b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.cc index dc76b67353..b0d2282e0d 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.cc +++ b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.cc @@ -161,8 +161,8 @@ void ScreenCapturerDifferWrapper::SetSharedMemoryFactory( base_capturer_->SetSharedMemoryFactory(std::move(shared_memory_factory)); } -void ScreenCapturerDifferWrapper::Capture(const DesktopRegion& region) { - base_capturer_->Capture(region); +void ScreenCapturerDifferWrapper::CaptureFrame() { + base_capturer_->CaptureFrame(); } bool ScreenCapturerDifferWrapper::GetScreenList(ScreenList* screens) { diff --git a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h index c7a20b3d07..6ae3a1bace 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h +++ b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h @@ -39,7 +39,7 @@ class ScreenCapturerDifferWrapper : public ScreenCapturer, void Start(DesktopCapturer::Callback* callback) override; void SetSharedMemoryFactory( std::unique_ptr shared_memory_factory) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; bool GetScreenList(ScreenList* screens) override; bool SelectScreen(ScreenId id) override; diff --git a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper_unittest.cc index f04d809b9f..ae7b7d9a85 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper_unittest.cc +++ b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper_unittest.cc @@ -136,7 +136,7 @@ void ExecuteDifferWrapperCase(BlackWhiteDesktopFramePainter* frame_painter, for (const auto& rect : updated_region) { frame_painter->updated_region()->AddRect(rect); } - capturer->Capture(DesktopRegion()); + capturer->CaptureFrame(); } // Executes a ScreenCapturerDifferWrapper::Capture(), if updated_region() is not @@ -147,7 +147,7 @@ void ExecuteCapturer(ScreenCapturerDifferWrapper* capturer, EXPECT_CALL(*callback, OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, testing::_)) .Times(1); - capturer->Capture(DesktopRegion()); + capturer->CaptureFrame(); } void ExecuteDifferWrapperTest(bool with_hints, @@ -178,7 +178,7 @@ void ExecuteDifferWrapperTest(bool with_hints, AssertUpdatedRegionIs(**frame, {DesktopRect::MakeSize((*frame)->size())}); })); - capturer.Capture(DesktopRegion()); + capturer.CaptureFrame(); ExecuteDifferWrapperCase(&frame_painter, &capturer, &callback, {DesktopRect::MakeLTRB(100, 100, 200, 200), diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac.mm b/webrtc/modules/desktop_capture/screen_capturer_mac.mm index eed59c8af8..47885ee9d9 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mac.mm +++ b/webrtc/modules/desktop_capture/screen_capturer_mac.mm @@ -285,7 +285,7 @@ class ScreenCapturerMac : public ScreenCapturer { // Overridden from ScreenCapturer: void Start(Callback* callback) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; void SetExcludedWindow(WindowId window) override; bool GetScreenList(ScreenList* screens) override; bool SelectScreen(ScreenId id) override; @@ -426,7 +426,7 @@ void ScreenCapturerMac::Start(Callback* callback) { callback_ = callback; } -void ScreenCapturerMac::Capture(const DesktopRegion& region_to_capture) { +void ScreenCapturerMac::CaptureFrame() { int64_t capture_start_time_nanos = rtc::TimeNanos(); queue_.MoveToNextFrame(); diff --git a/webrtc/modules/desktop_capture/screen_capturer_mock_objects.h b/webrtc/modules/desktop_capture/screen_capturer_mock_objects.h index f08dab5318..6baaa472bf 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mock_objects.h +++ b/webrtc/modules/desktop_capture/screen_capturer_mock_objects.h @@ -19,11 +19,16 @@ namespace webrtc { class MockScreenCapturer : public ScreenCapturer { public: - MockScreenCapturer() {} + MockScreenCapturer() { + ON_CALL(*this, Capture(testing::_)) + .WillByDefault(testing::WithoutArgs(testing::Invoke( + this, &MockScreenCapturer::CaptureFrame))); + } virtual ~MockScreenCapturer() {} MOCK_METHOD1(Start, void(Callback* callback)); MOCK_METHOD1(Capture, void(const DesktopRegion& region)); + MOCK_METHOD0(CaptureFrame, void(void)); MOCK_METHOD1(GetScreenList, bool(ScreenList* screens)); MOCK_METHOD1(SelectScreen, bool(ScreenId id)); diff --git a/webrtc/modules/desktop_capture/screen_capturer_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_unittest.cc index fa666a929b..ce0cab1fd3 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_unittest.cc +++ b/webrtc/modules/desktop_capture/screen_capturer_unittest.cc @@ -204,7 +204,7 @@ class ScreenCapturerTest : public testing::Test { EXPECT_CALL(callback_, OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _)) .WillOnce(SaveUniquePtrArg(&frame)); - capturer->Capture(DesktopRegion()); + capturer->CaptureFrame(); EXPECT_TRUE(frame); return frame; } @@ -259,7 +259,7 @@ TEST_F(ScreenCapturerTest, Capture) { .WillOnce(SaveUniquePtrArg(&frame)); capturer_->Start(&callback_); - capturer_->Capture(DesktopRegion()); + capturer_->CaptureFrame(); ASSERT_TRUE(frame); EXPECT_GT(frame->size().width(), 0); @@ -302,7 +302,7 @@ TEST_F(ScreenCapturerTest, UseSharedBuffers) { capturer_->Start(&callback_); capturer_->SetSharedMemoryFactory( std::unique_ptr(new FakeSharedMemoryFactory())); - capturer_->Capture(DesktopRegion()); + capturer_->CaptureFrame(); ASSERT_TRUE(frame); ASSERT_TRUE(frame->shared_memory()); @@ -318,7 +318,7 @@ TEST_F(ScreenCapturerTest, UseMagnifier) { .WillOnce(SaveUniquePtrArg(&frame)); capturer_->Start(&callback_); - capturer_->Capture(DesktopRegion()); + capturer_->CaptureFrame(); ASSERT_TRUE(frame); } @@ -333,7 +333,7 @@ TEST_F(ScreenCapturerTest, UseDirectxCapturer) { .WillOnce(SaveUniquePtrArg(&frame)); capturer_->Start(&callback_); - capturer_->Capture(DesktopRegion()); + capturer_->CaptureFrame(); ASSERT_TRUE(frame); } @@ -350,7 +350,7 @@ TEST_F(ScreenCapturerTest, UseDirectxCapturerWithSharedBuffers) { capturer_->Start(&callback_); capturer_->SetSharedMemoryFactory( std::unique_ptr(new FakeSharedMemoryFactory())); - capturer_->Capture(DesktopRegion()); + capturer_->CaptureFrame(); ASSERT_TRUE(frame); ASSERT_TRUE(frame->shared_memory()); EXPECT_EQ(frame->shared_memory()->id(), kTestSharedMemoryId); diff --git a/webrtc/modules/desktop_capture/screen_capturer_x11.cc b/webrtc/modules/desktop_capture/screen_capturer_x11.cc index 6f5e520e6e..ff3ee1197f 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_x11.cc +++ b/webrtc/modules/desktop_capture/screen_capturer_x11.cc @@ -54,7 +54,7 @@ class ScreenCapturerLinux : public ScreenCapturer, // DesktopCapturer interface. void Start(Callback* delegate) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; // ScreenCapturer interface. bool GetScreenList(ScreenList* screens) override; @@ -228,7 +228,7 @@ void ScreenCapturerLinux::Start(Callback* callback) { callback_ = callback; } -void ScreenCapturerLinux::Capture(const DesktopRegion& region) { +void ScreenCapturerLinux::CaptureFrame() { int64_t capture_start_time_nanos = rtc::TimeNanos(); queue_.MoveToNextFrame(); diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc index 9e3f58b11e..38a39991ea 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc @@ -54,7 +54,7 @@ DesktopSize ScreenCapturerWinDirectx::SelectedDesktopSize() const { .size(); } -void ScreenCapturerWinDirectx::Capture(const DesktopRegion& region) { +void ScreenCapturerWinDirectx::CaptureFrame() { RTC_DCHECK(callback_); int64_t capture_start_time_nanos = rtc::TimeNanos(); diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h index 86232c74ff..2427ec4c5f 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h @@ -38,7 +38,7 @@ class ScreenCapturerWinDirectx : public ScreenCapturer { void Start(Callback* callback) override; void SetSharedMemoryFactory( std::unique_ptr shared_memory_factory) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; bool GetScreenList(ScreenList* screens) override; bool SelectScreen(ScreenId id) override; diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc index 2c2178d292..4bf8b14b33 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc @@ -71,7 +71,7 @@ void ScreenCapturerWinGdi::SetSharedMemoryFactory( shared_memory_factory_ = std::move(shared_memory_factory); } -void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) { +void ScreenCapturerWinGdi::CaptureFrame() { int64_t capture_start_time_nanos = rtc::TimeNanos(); queue_.MoveToNextFrame(); diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h index 01a59919ef..a9e184596d 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h @@ -39,7 +39,7 @@ class ScreenCapturerWinGdi : public ScreenCapturer { void Start(Callback* callback) override; void SetSharedMemoryFactory( std::unique_ptr shared_memory_factory) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; bool GetScreenList(ScreenList* screens) override; bool SelectScreen(ScreenId id) override; diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc index e5a37c97d5..5ffd1f996a 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc @@ -72,7 +72,7 @@ void ScreenCapturerWinMagnifier::SetSharedMemoryFactory( shared_memory_factory_ = std::move(shared_memory_factory); } -void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) { +void ScreenCapturerWinMagnifier::CaptureFrame() { if (!magnifier_initialized_ || !magnifier_capture_succeeded_ || GetSystemMetrics(SM_CMONITORS) != 1) { @@ -82,7 +82,7 @@ void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) { "initialization or last capture attempt failed, or " "execute on multi-screen system."; StartFallbackCapturer(); - fallback_capturer_->Capture(region); + fallback_capturer_->CaptureFrame(); return; } @@ -111,7 +111,7 @@ void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) { LOG_F(LS_WARNING) << "Switching to the fallback screen capturer because " "last capture attempt failed."; StartFallbackCapturer(); - fallback_capturer_->Capture(region); + fallback_capturer_->CaptureFrame(); return; } diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h index 080a57cdaa..6c72138173 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h @@ -51,7 +51,7 @@ class ScreenCapturerWinMagnifier : public ScreenCapturer { void Start(Callback* callback) override; void SetSharedMemoryFactory( std::unique_ptr shared_memory_factory) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; bool GetScreenList(ScreenList* screens) override; bool SelectScreen(ScreenId id) override; void SetExcludedWindow(WindowId window) override; diff --git a/webrtc/modules/desktop_capture/window_capturer_mac.mm b/webrtc/modules/desktop_capture/window_capturer_mac.mm index cbdf14be6f..1e706fa47d 100644 --- a/webrtc/modules/desktop_capture/window_capturer_mac.mm +++ b/webrtc/modules/desktop_capture/window_capturer_mac.mm @@ -55,7 +55,7 @@ class WindowCapturerMac : public WindowCapturer { // DesktopCapturer interface. void Start(Callback* callback) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; private: Callback* callback_ = nullptr; @@ -176,7 +176,7 @@ void WindowCapturerMac::Start(Callback* callback) { callback_ = callback; } -void WindowCapturerMac::Capture(const DesktopRegion& region) { +void WindowCapturerMac::CaptureFrame() { if (!IsWindowValid(window_id_)) { callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); return; diff --git a/webrtc/modules/desktop_capture/window_capturer_null.cc b/webrtc/modules/desktop_capture/window_capturer_null.cc index 3fe21cf718..802d74f8a1 100755 --- a/webrtc/modules/desktop_capture/window_capturer_null.cc +++ b/webrtc/modules/desktop_capture/window_capturer_null.cc @@ -31,7 +31,7 @@ class WindowCapturerNull : public WindowCapturer { // DesktopCapturer interface. void Start(Callback* callback) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; private: Callback* callback_ = nullptr; @@ -64,7 +64,7 @@ void WindowCapturerNull::Start(Callback* callback) { callback_ = callback; } -void WindowCapturerNull::Capture(const DesktopRegion& region) { +void WindowCapturerNull::CaptureFrame() { // Not implemented yet. callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); } diff --git a/webrtc/modules/desktop_capture/window_capturer_win.cc b/webrtc/modules/desktop_capture/window_capturer_win.cc index c7c312a17e..61de06cc93 100644 --- a/webrtc/modules/desktop_capture/window_capturer_win.cc +++ b/webrtc/modules/desktop_capture/window_capturer_win.cc @@ -92,7 +92,7 @@ class WindowCapturerWin : public WindowCapturer { // DesktopCapturer interface. void Start(Callback* callback) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; private: Callback* callback_ = nullptr; @@ -160,7 +160,7 @@ void WindowCapturerWin::Start(Callback* callback) { callback_ = callback; } -void WindowCapturerWin::Capture(const DesktopRegion& region) { +void WindowCapturerWin::CaptureFrame() { if (!window_) { LOG(LS_ERROR) << "Window hasn't been selected: " << GetLastError(); callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); diff --git a/webrtc/modules/desktop_capture/window_capturer_x11.cc b/webrtc/modules/desktop_capture/window_capturer_x11.cc index d88585bfa8..e4a0917b90 100644 --- a/webrtc/modules/desktop_capture/window_capturer_x11.cc +++ b/webrtc/modules/desktop_capture/window_capturer_x11.cc @@ -95,7 +95,7 @@ class WindowCapturerLinux : public WindowCapturer, // DesktopCapturer interface. void Start(Callback* callback) override; - void Capture(const DesktopRegion& region) override; + void CaptureFrame() override; // SharedXDisplay::XEventHandler interface. bool HandleXEvent(const XEvent& event) override; @@ -271,7 +271,7 @@ void WindowCapturerLinux::Start(Callback* callback) { callback_ = callback; } -void WindowCapturerLinux::Capture(const DesktopRegion& region) { +void WindowCapturerLinux::CaptureFrame() { if (!x_server_pixel_buffer_.IsWindowValid()) { LOG(LS_INFO) << "The window is no longer valid."; callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr);