diff --git a/webrtc/modules/desktop_capture/mac/desktop_configuration.h b/webrtc/modules/desktop_capture/mac/desktop_configuration.h index 031d92de2..bb2339bb0 100644 --- a/webrtc/modules/desktop_capture/mac/desktop_configuration.h +++ b/webrtc/modules/desktop_capture/mac/desktop_configuration.h @@ -59,10 +59,11 @@ struct MacDesktopConfiguration { const MacDisplayConfiguration* FindDisplayConfigurationById( CGDirectDisplayID id); - // Bounds of the desktop in Density-Independent Pixels (DIPs). + // Bounds of the desktop excluding monitors with DPI settings different from + // the main monitor. In Density-Independent Pixels (DIPs). DesktopRect bounds; - // Bounds of the desktop in physical pixels. + // Same as bounds, but expressed in physical pixels. DesktopRect pixel_bounds; // Scale factor from DIPs to physical pixels. diff --git a/webrtc/modules/desktop_capture/mac/desktop_configuration.mm b/webrtc/modules/desktop_capture/mac/desktop_configuration.mm index 838973e42..35fa65be2 100644 --- a/webrtc/modules/desktop_capture/mac/desktop_configuration.mm +++ b/webrtc/modules/desktop_capture/mac/desktop_configuration.mm @@ -134,11 +134,15 @@ MacDesktopConfiguration MacDesktopConfiguration::GetCurrent(Origin origin) { // Add the display to the configuration. desktop_config.displays.push_back(display_config); - // Update the desktop bounds to account for this display. - desktop_config.bounds = - JoinRects(desktop_config.bounds, display_config.bounds); - desktop_config.pixel_bounds = - JoinRects(desktop_config.pixel_bounds, display_config.pixel_bounds); + // Update the desktop bounds to account for this display, unless the current + // display uses different DPI settings. + if (display_config.dip_to_pixel_scale == + desktop_config.dip_to_pixel_scale) { + desktop_config.bounds = + JoinRects(desktop_config.bounds, display_config.bounds); + desktop_config.pixel_bounds = + JoinRects(desktop_config.pixel_bounds, display_config.pixel_bounds); + } } return desktop_config;