[Chromoting] Remove screen saver logic out of ScreenCapturer implementations
After change https://codereview.chromium.org/2080723008/, chromoting hosts are using device::PowerSaveBlocker to block screen saver and suspend. So similar logic in ScreenCapturer are not useful, and should be removed. BUG=626839 Review-Url: https://codereview.webrtc.org/2155813003 Cr-Commit-Position: refs/heads/master@{#13491}
This commit is contained in:
@ -18,7 +18,6 @@
|
|||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
|
||||||
#include <OpenGL/CGLMacro.h>
|
#include <OpenGL/CGLMacro.h>
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
|
|
||||||
@ -262,12 +261,6 @@ class ScreenCapturerMac : public ScreenCapturer {
|
|||||||
// Monitoring display reconfiguration.
|
// Monitoring display reconfiguration.
|
||||||
rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor_;
|
rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor_;
|
||||||
|
|
||||||
// Power management assertion to prevent the screen from sleeping.
|
|
||||||
IOPMAssertionID power_assertion_id_display_ = kIOPMNullAssertionID;
|
|
||||||
|
|
||||||
// Power management assertion to indicate that the user is active.
|
|
||||||
IOPMAssertionID power_assertion_id_user_ = kIOPMNullAssertionID;
|
|
||||||
|
|
||||||
// Dynamically link to deprecated APIs for Mac OS X 10.6 support.
|
// Dynamically link to deprecated APIs for Mac OS X 10.6 support.
|
||||||
void* app_services_library_ = nullptr;
|
void* app_services_library_ = nullptr;
|
||||||
CGDisplayBaseAddressFunc cg_display_base_address_ = nullptr;
|
CGDisplayBaseAddressFunc cg_display_base_address_ = nullptr;
|
||||||
@ -309,15 +302,6 @@ ScreenCapturerMac::ScreenCapturerMac(
|
|||||||
: desktop_config_monitor_(desktop_config_monitor) {}
|
: desktop_config_monitor_(desktop_config_monitor) {}
|
||||||
|
|
||||||
ScreenCapturerMac::~ScreenCapturerMac() {
|
ScreenCapturerMac::~ScreenCapturerMac() {
|
||||||
if (power_assertion_id_display_ != kIOPMNullAssertionID) {
|
|
||||||
IOPMAssertionRelease(power_assertion_id_display_);
|
|
||||||
power_assertion_id_display_ = kIOPMNullAssertionID;
|
|
||||||
}
|
|
||||||
if (power_assertion_id_user_ != kIOPMNullAssertionID) {
|
|
||||||
IOPMAssertionRelease(power_assertion_id_user_);
|
|
||||||
power_assertion_id_user_ = kIOPMNullAssertionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReleaseBuffers();
|
ReleaseBuffers();
|
||||||
UnregisterRefreshAndMoveHandlers();
|
UnregisterRefreshAndMoveHandlers();
|
||||||
dlclose(app_services_library_);
|
dlclose(app_services_library_);
|
||||||
@ -352,21 +336,6 @@ void ScreenCapturerMac::Start(Callback* callback) {
|
|||||||
assert(callback);
|
assert(callback);
|
||||||
|
|
||||||
callback_ = callback;
|
callback_ = callback;
|
||||||
|
|
||||||
// Create power management assertions to wake the display and prevent it from
|
|
||||||
// going to sleep on user idle.
|
|
||||||
// TODO(jamiewalch): Use IOPMAssertionDeclareUserActivity on 10.7.3 and above
|
|
||||||
// instead of the following two assertions.
|
|
||||||
IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
|
|
||||||
kIOPMAssertionLevelOn,
|
|
||||||
CFSTR("Chrome Remote Desktop connection active"),
|
|
||||||
&power_assertion_id_display_);
|
|
||||||
// This assertion ensures that the display is woken up if it already asleep
|
|
||||||
// (as used by Apple Remote Desktop).
|
|
||||||
IOPMAssertionCreateWithName(CFSTR("UserIsActive"),
|
|
||||||
kIOPMAssertionLevelOn,
|
|
||||||
CFSTR("Chrome Remote Desktop connection active"),
|
|
||||||
&power_assertion_id_user_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenCapturerMac::Capture(const DesktopRegion& region_to_capture) {
|
void ScreenCapturerMac::Capture(const DesktopRegion& region_to_capture) {
|
||||||
|
|||||||
@ -452,7 +452,7 @@ bool ScreenCapturerWinDirectx::ForceDuplicateOutput() {
|
|||||||
|
|
||||||
ScreenCapturerWinDirectx::ScreenCapturerWinDirectx(
|
ScreenCapturerWinDirectx::ScreenCapturerWinDirectx(
|
||||||
const DesktopCaptureOptions& options)
|
const DesktopCaptureOptions& options)
|
||||||
: callback_(nullptr), set_thread_execution_state_failed_(false) {
|
: callback_(nullptr) {
|
||||||
RTC_DCHECK(g_container && g_container->initialize_result);
|
RTC_DCHECK(g_container && g_container->initialize_result);
|
||||||
|
|
||||||
// Texture instance won't change forever.
|
// Texture instance won't change forever.
|
||||||
@ -629,14 +629,6 @@ void ScreenCapturerWinDirectx::Capture(const DesktopRegion& region) {
|
|||||||
RTC_DCHECK(g_container->duplication);
|
RTC_DCHECK(g_container->duplication);
|
||||||
int64_t capture_start_time_nanos = rtc::TimeNanos();
|
int64_t capture_start_time_nanos = rtc::TimeNanos();
|
||||||
|
|
||||||
if (!SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED)) {
|
|
||||||
if (!set_thread_execution_state_failed_) {
|
|
||||||
set_thread_execution_state_failed_ = true;
|
|
||||||
LOG(LS_WARNING) << "Failed to make system & display power assertion: "
|
|
||||||
<< GetLastError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DXGI_OUTDUPL_FRAME_INFO frame_info;
|
DXGI_OUTDUPL_FRAME_INFO frame_info;
|
||||||
memset(&frame_info, 0, sizeof(DXGI_OUTDUPL_FRAME_INFO));
|
memset(&frame_info, 0, sizeof(DXGI_OUTDUPL_FRAME_INFO));
|
||||||
ComPtr<IDXGIResource> resource;
|
ComPtr<IDXGIResource> resource;
|
||||||
|
|||||||
@ -95,8 +95,6 @@ class ScreenCapturerWinDirectx : public ScreenCapturer {
|
|||||||
std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
|
std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
|
||||||
Callback* callback_ = nullptr;
|
Callback* callback_ = nullptr;
|
||||||
|
|
||||||
bool set_thread_execution_state_failed_ = false;
|
|
||||||
|
|
||||||
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx);
|
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -78,15 +78,6 @@ void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
|
|||||||
queue_.MoveToNextFrame();
|
queue_.MoveToNextFrame();
|
||||||
RTC_DCHECK(!queue_.current_frame() || !queue_.current_frame()->IsShared());
|
RTC_DCHECK(!queue_.current_frame() || !queue_.current_frame()->IsShared());
|
||||||
|
|
||||||
// Request that the system not power-down the system, or the display hardware.
|
|
||||||
if (!SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED)) {
|
|
||||||
if (!set_thread_execution_state_failed_) {
|
|
||||||
set_thread_execution_state_failed_ = true;
|
|
||||||
LOG_F(LS_WARNING) << "Failed to make system & display power assertion: "
|
|
||||||
<< GetLastError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure the GDI capture resources are up-to-date.
|
// Make sure the GDI capture resources are up-to-date.
|
||||||
PrepareCaptureResources();
|
PrepareCaptureResources();
|
||||||
|
|
||||||
|
|||||||
@ -84,9 +84,6 @@ class ScreenCapturerWinGdi : public ScreenCapturer {
|
|||||||
HMODULE dwmapi_library_ = NULL;
|
HMODULE dwmapi_library_ = NULL;
|
||||||
DwmEnableCompositionFunc composition_func_ = nullptr;
|
DwmEnableCompositionFunc composition_func_ = nullptr;
|
||||||
|
|
||||||
// Used to suppress duplicate logging of SetThreadExecutionState errors.
|
|
||||||
bool set_thread_execution_state_failed_ = false;
|
|
||||||
|
|
||||||
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinGdi);
|
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinGdi);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user