From 95b27217f204e9985e2c070abddc4aff4c8d7d35 Mon Sep 17 00:00:00 2001 From: braveyao Date: Fri, 10 Mar 2017 09:46:49 -0800 Subject: [PATCH] Mac: fix screen capture freezes when context menu popup in Chrome. Previously we grab a run loop source and add a source with mode kCFRunLoopDefaultMode. With this mode, it won't callback when context menu popup (which needs the NSEventTrackingRunLoopMode), then screen capture can't get refreshed frame with context menu until the context menu is gone. The fix is to use kCFRunLoopComonModes, which includes default,modal and event tracking modes by default. BUG=chromium:697780 Review-Url: https://codereview.webrtc.org/2732393003 Cr-Commit-Position: refs/heads/master@{#17171} --- webrtc/modules/desktop_capture/screen_capturer_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac.mm b/webrtc/modules/desktop_capture/screen_capturer_mac.mm index aed7e25e8d..78c2cf20b7 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mac.mm +++ b/webrtc/modules/desktop_capture/screen_capturer_mac.mm @@ -98,7 +98,7 @@ class DisplayStreamManager { CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(wrapper.stream); CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, - kCFRunLoopDefaultMode); + kCFRunLoopCommonModes); CGDisplayStreamStop(wrapper.stream); } } @@ -976,7 +976,7 @@ bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() { CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(display_stream); - CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode); + CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes); display_stream_manager_->SaveStream(unique_id, display_stream); } }