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}
This commit is contained in:
braveyao 2017-03-10 09:46:49 -08:00 committed by Commit bot
parent 0b942150d3
commit 95b27217f2

View File

@ -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);
}
}