diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac.mm b/webrtc/modules/desktop_capture/screen_capturer_mac.mm index b846b7571c..7cb1720ed9 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mac.mm +++ b/webrtc/modules/desktop_capture/screen_capturer_mac.mm @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -262,12 +261,6 @@ class ScreenCapturerMac : public ScreenCapturer { // Monitoring display reconfiguration. rtc::scoped_refptr 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. void* app_services_library_ = nullptr; CGDisplayBaseAddressFunc cg_display_base_address_ = nullptr; @@ -309,15 +302,6 @@ ScreenCapturerMac::ScreenCapturerMac( : desktop_config_monitor_(desktop_config_monitor) {} 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(); UnregisterRefreshAndMoveHandlers(); dlclose(app_services_library_); @@ -352,21 +336,6 @@ void ScreenCapturerMac::Start(Callback* callback) { assert(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) { 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 47d0134d4e..159e5a9195 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc @@ -452,7 +452,7 @@ bool ScreenCapturerWinDirectx::ForceDuplicateOutput() { ScreenCapturerWinDirectx::ScreenCapturerWinDirectx( const DesktopCaptureOptions& options) - : callback_(nullptr), set_thread_execution_state_failed_(false) { + : callback_(nullptr) { RTC_DCHECK(g_container && g_container->initialize_result); // Texture instance won't change forever. @@ -629,14 +629,6 @@ void ScreenCapturerWinDirectx::Capture(const DesktopRegion& region) { RTC_DCHECK(g_container->duplication); 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; memset(&frame_info, 0, sizeof(DXGI_OUTDUPL_FRAME_INFO)); ComPtr resource; 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 d477991e73..169151975e 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h @@ -95,8 +95,6 @@ class ScreenCapturerWinDirectx : public ScreenCapturer { std::unique_ptr shared_memory_factory_; Callback* callback_ = nullptr; - bool set_thread_execution_state_failed_ = false; - RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); }; 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 31fbf4b897..80d2da55de 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc @@ -78,15 +78,6 @@ void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) { queue_.MoveToNextFrame(); 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. PrepareCaptureResources(); 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 3c855e4a4f..d1b6395eac 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h @@ -84,9 +84,6 @@ class ScreenCapturerWinGdi : public ScreenCapturer { HMODULE dwmapi_library_ = NULL; 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); };