Index: webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper.cc |
diff --git a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.cc b/webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper.cc |
similarity index 76% |
copy from webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.cc |
copy to webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper.cc |
index 6306d0290c0b18236e9ffb8839d0833cd231419a..1ad9ce47056f24de307155c47795a89410dee358 100644 |
--- a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.cc |
+++ b/webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper.cc |
@@ -8,7 +8,7 @@ |
* be found in the AUTHORS file in the root of the source tree. |
*/ |
-#include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h" |
+#include "webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper.h" |
#include <string.h> |
@@ -77,9 +77,9 @@ void CompareRow(const uint8_t* old_buffer, |
} else if (first_dirty_x_block != -1) { |
// The block on the left is the last dirty block in a continuous |
// dirty area. |
- output->AddRect(DesktopRect::MakeLTRB( |
- first_dirty_x_block * kBlockSize + left, top, |
- x * kBlockSize + left, bottom)); |
+ output->AddRect( |
+ DesktopRect::MakeLTRB(first_dirty_x_block * kBlockSize + left, top, |
+ x * kBlockSize + left, bottom)); |
first_dirty_x_block = -1; |
} |
old_buffer += block_x_offset; |
@@ -89,23 +89,21 @@ void CompareRow(const uint8_t* old_buffer, |
bool last_block_diff; |
if (last_block_width < kBlockSize) { |
// The last one is a partial vector. |
- last_block_diff = PartialBlockDifference( |
- old_buffer, new_buffer, last_block_width, height, stride); |
+ last_block_diff = PartialBlockDifference(old_buffer, new_buffer, |
+ last_block_width, height, stride); |
} else { |
- last_block_diff = |
- BlockDifference(old_buffer, new_buffer, height, stride); |
+ last_block_diff = BlockDifference(old_buffer, new_buffer, height, stride); |
} |
if (last_block_diff) { |
if (first_dirty_x_block == -1) { |
first_dirty_x_block = block_count; |
} |
- output->AddRect( |
- DesktopRect::MakeLTRB(first_dirty_x_block * kBlockSize + left, |
- top, right, bottom)); |
- } else if (first_dirty_x_block != -1) { |
output->AddRect(DesktopRect::MakeLTRB( |
- first_dirty_x_block * kBlockSize + left, top, |
- block_count * kBlockSize + left, bottom)); |
+ first_dirty_x_block * kBlockSize + left, top, right, bottom)); |
+ } else if (first_dirty_x_block != -1) { |
+ output->AddRect( |
+ DesktopRect::MakeLTRB(first_dirty_x_block * kBlockSize + left, top, |
+ block_count * kBlockSize + left, bottom)); |
} |
} |
@@ -132,50 +130,57 @@ void CompareFrames(const DesktopFrame& old_frame, |
// The last row may have a different height, so we handle it separately. |
for (int y = 0; y < y_block_count; y++) { |
CompareRow(prev_block_row_start, curr_block_row_start, rect.left(), |
- rect.right(), top, top + kBlockSize, |
- old_frame.stride(), output); |
+ rect.right(), top, top + kBlockSize, old_frame.stride(), output); |
top += kBlockSize; |
prev_block_row_start += block_y_stride; |
curr_block_row_start += block_y_stride; |
} |
CompareRow(prev_block_row_start, curr_block_row_start, rect.left(), |
- rect.right(), top, top + last_y_block_height, |
- old_frame.stride(), output); |
+ rect.right(), top, top + last_y_block_height, old_frame.stride(), |
+ output); |
} |
} // namespace |
-ScreenCapturerDifferWrapper::ScreenCapturerDifferWrapper( |
- std::unique_ptr<ScreenCapturer> base_capturer) |
+DesktopCapturerDifferWrapper::DesktopCapturerDifferWrapper( |
+ std::unique_ptr<DesktopCapturer> base_capturer) |
: base_capturer_(std::move(base_capturer)) { |
RTC_DCHECK(base_capturer_); |
} |
-ScreenCapturerDifferWrapper::~ScreenCapturerDifferWrapper() {} |
+DesktopCapturerDifferWrapper::~DesktopCapturerDifferWrapper() {} |
-void ScreenCapturerDifferWrapper::Start(DesktopCapturer::Callback* callback) { |
+void DesktopCapturerDifferWrapper::Start(DesktopCapturer::Callback* callback) { |
callback_ = callback; |
base_capturer_->Start(this); |
} |
-void ScreenCapturerDifferWrapper::SetSharedMemoryFactory( |
+void DesktopCapturerDifferWrapper::SetSharedMemoryFactory( |
std::unique_ptr<SharedMemoryFactory> shared_memory_factory) { |
base_capturer_->SetSharedMemoryFactory(std::move(shared_memory_factory)); |
} |
-void ScreenCapturerDifferWrapper::CaptureFrame() { |
+void DesktopCapturerDifferWrapper::CaptureFrame() { |
base_capturer_->CaptureFrame(); |
} |
-bool ScreenCapturerDifferWrapper::GetScreenList(ScreenList* screens) { |
- return base_capturer_->GetScreenList(screens); |
+void DesktopCapturerDifferWrapper::SetExcludedWindow(WindowId window) { |
+ base_capturer_->SetExcludedWindow(window); |
+} |
+ |
+bool DesktopCapturerDifferWrapper::GetSourceList(SourceList* sources) { |
+ return base_capturer_->GetSourceList(sources); |
+} |
+ |
+bool DesktopCapturerDifferWrapper::SelectSource(SourceId id) { |
+ return base_capturer_->SelectSource(id); |
} |
-bool ScreenCapturerDifferWrapper::SelectScreen(ScreenId id) { |
- return base_capturer_->SelectScreen(id); |
+bool DesktopCapturerDifferWrapper::FocusOnSelectedSource() { |
+ return base_capturer_->FocusOnSelectedSource(); |
} |
-void ScreenCapturerDifferWrapper::OnCaptureResult( |
+void DesktopCapturerDifferWrapper::OnCaptureResult( |
Result result, |
std::unique_ptr<DesktopFrame> input_frame) { |
int64_t start_time_nanos = rtc::TimeNanos(); |
@@ -187,10 +192,9 @@ void ScreenCapturerDifferWrapper::OnCaptureResult( |
std::unique_ptr<SharedDesktopFrame> frame = |
SharedDesktopFrame::Wrap(std::move(input_frame)); |
- if (last_frame_ && |
- (last_frame_->size().width() != frame->size().width() || |
- last_frame_->size().height() != frame->size().height() || |
- last_frame_->stride() != frame->stride())) { |
+ if (last_frame_ && (last_frame_->size().width() != frame->size().width() || |
+ last_frame_->size().height() != frame->size().height() || |
+ last_frame_->stride() != frame->stride())) { |
last_frame_.reset(); |
} |