| Index: webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
|
| 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 d3035a15ca52d4c3f79aa2082c0dc4610e97f9ea..1171388333edf947b857fc31c035e1be00bc6490 100644
|
| --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
|
| +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
|
| @@ -14,6 +14,7 @@
|
|
|
| #include <utility>
|
|
|
| +#include "webrtc/base/checks.h"
|
| #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
| #include "webrtc/modules/desktop_capture/desktop_frame.h"
|
| #include "webrtc/modules/desktop_capture/desktop_frame_win.h"
|
| @@ -97,7 +98,8 @@ void ScreenCapturerWinGdi::SetSharedMemoryFactory(
|
| void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
|
| TickTime capture_start_time = TickTime::Now();
|
|
|
| - queue_.MoveToNextFrame();
|
| + queue_.MoveToNext();
|
| + RTC_DCHECK(!queue_.current() || !queue_.current()->IsShared());
|
|
|
| // Request that the system not power-down the system, or the display hardware.
|
| if (!SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED)) {
|
| @@ -116,8 +118,8 @@ void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
|
| return;
|
| }
|
|
|
| - const DesktopFrame* current_frame = queue_.current_frame();
|
| - const DesktopFrame* last_frame = queue_.previous_frame();
|
| + const DesktopFrame* current_frame = queue_.current();
|
| + const DesktopFrame* last_frame = queue_.previous();
|
| if (last_frame && last_frame->size().equals(current_frame->size())) {
|
| // Make sure the differencer is set up correctly for these previous and
|
| // current screens.
|
| @@ -145,7 +147,7 @@ void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
|
| helper_.set_size_most_recent(current_frame->size());
|
|
|
| // Emit the current frame.
|
| - DesktopFrame* frame = queue_.current_frame()->Share();
|
| + DesktopFrame* frame = queue_.current()->Share();
|
| frame->set_dpi(DesktopVector(
|
| GetDeviceCaps(desktop_dc_, LOGPIXELSX),
|
| GetDeviceCaps(desktop_dc_, LOGPIXELSY)));
|
| @@ -258,22 +260,22 @@ bool ScreenCapturerWinGdi::CaptureImage() {
|
| // If the current buffer is from an older generation then allocate a new one.
|
| // Note that we can't reallocate other buffers at this point, since the caller
|
| // may still be reading from them.
|
| - if (!queue_.current_frame() ||
|
| - !queue_.current_frame()->size().equals(screen_rect.size())) {
|
| + if (!queue_.current() ||
|
| + !queue_.current()->size().equals(screen_rect.size())) {
|
| assert(desktop_dc_ != NULL);
|
| assert(memory_dc_ != NULL);
|
|
|
| std::unique_ptr<DesktopFrame> buffer(DesktopFrameWin::Create(
|
| size, shared_memory_factory_.get(), desktop_dc_));
|
| - if (!buffer.get())
|
| + if (!buffer)
|
| return false;
|
| - queue_.ReplaceCurrentFrame(buffer.release());
|
| + queue_.ReplaceCurrent(SharedDesktopFrame::Wrap(std::move(buffer)));
|
| }
|
|
|
| // Select the target bitmap into the memory dc and copy the rect from desktop
|
| // to memory.
|
| DesktopFrameWin* current = static_cast<DesktopFrameWin*>(
|
| - queue_.current_frame()->GetUnderlyingFrame());
|
| + queue_.current()->GetUnderlyingFrame());
|
| HGDIOBJ previous_object = SelectObject(memory_dc_, current->bitmap());
|
| if (previous_object != NULL) {
|
| BitBlt(memory_dc_,
|
|
|