Disable coregraphics built-in mouse capture in ScreenCapturerMac

When calling CGDisplayStreamCreate(properties = nullptr) this
causes kCGDisplayStreamShowCursor to default to kCFBooleanTrue.

This CL set it to false always as it was assumed. Also if true
this causes some lags when moving the mouse pointer on the capture
side and in any case webrtc::MouseCursorMonitorMac already implements
a custom way to capture the mouse. Which appears to be more efficient
in this usecase.

Bug: webrtc:8625
Change-Id: Id0fae38fa47503d87d1890213706149762fa67fb
Reviewed-on: https://webrtc-review.googlesource.com/30902
Commit-Queue: Julien Isorce <julien.isorce@chromium.org>
Reviewed-by: Zijie He <zijiehe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#21231}
This commit is contained in:
Julien Isorce 2017-12-12 10:31:19 +00:00 committed by Commit Bot
parent db3d1c611e
commit 199942f3e6
3 changed files with 19 additions and 2 deletions

View File

@ -176,6 +176,7 @@ if (is_mac) {
":primitives",
"../../rtc_base:rtc_base",
"../../rtc_base:rtc_base_approved",
"../../sdk:common_objc",
]
libs = [
"AppKit.framework",

View File

@ -2,3 +2,9 @@ include_rules = [
"+system_wrappers",
"+third_party/libyuv",
]
specific_include_rules = {
"screen_capturer_mac\.mm": [
"+sdk/objc",
],
}

View File

@ -35,6 +35,7 @@
#include "rtc_base/logging.h"
#include "rtc_base/macutils.h"
#include "rtc_base/timeutils.h"
#include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h"
namespace webrtc {
@ -445,7 +446,7 @@ bool ScreenCapturerMac::GetSourceList(SourceList* screens) {
for (MacDisplayConfigurations::iterator it = desktop_config_.displays.begin();
it != desktop_config_.displays.end(); ++it) {
screens->push_back({it->id});
screens->push_back({it->id, std::string()});
}
return true;
}
@ -674,8 +675,17 @@ bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() {
ScreenRefresh(count, rects, display_origin);
}
};
rtc::ScopedCFTypeRef<CFDictionaryRef> properties_dict(
CFDictionaryCreate(kCFAllocatorDefault,
(const void* []){kCGDisplayStreamShowCursor},
(const void* []){kCFBooleanFalse},
1,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
CGDisplayStreamRef display_stream = CGDisplayStreamCreate(
display_id, pixel_width, pixel_height, 'BGRA', nullptr, handler);
display_id, pixel_width, pixel_height, 'BGRA', properties_dict.get(), handler);
if (display_stream) {
CGError error = CGDisplayStreamStart(display_stream);