-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
win-capture: Fix display capture for identical monitors #12248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I tested #5502 in recording mode, I selected the monitor then plugged off then plugged in, it selected the same one, but I will test it after connecting more monitors, I will try to recreate #5502. I checked and found that in my case the value returned for field |
That does not answer my question. Do you have any disabled displays? If the Windows API is returning bad data, I would prefer that Microsoft fixes that than just working around it. |
Ooh, my bad, I checked this and I do have some grayed out monitors, I have removed it, but I am away from identical monitors, I will check this once with those and see if this resolves this. |
@RytoEX, I tested this after removing all the grayed-out monitors from Scenario 1: Scenario 2: To provide more context, here are the Scenario 1: Second screen only: Scenario 2: Extend: As you can see, the id assigned to both the monitor is same in first scenario, resulting in failure to capture correct monitor. |
I will check the windows API why it is giving same id in above case. |
44dfa64
to
388d177
Compare
388d177
to
10144db
Compare
@RytoEX, can you check the change now. In existing code:
Issue 2: No State Flag Validation
Solution: I have tested above changes with variety of monitor on my windows machince and it works without any issue. I have reverted the change where I proposed the use of Let me know if you have any query, please review the final changes. |
Description
Fixed an issue where OBS Studio is unable to properly select between identical monitors in Display Capture source.
In
win-capture
plugin, we useEnumDisplayDevicesA
Windows API fn that enumerates display devices in the system.Currently, we are using
DeviceID
to uniquely identify the monitor, it fails to work when the connected monitor are fromsame manufacturer and same model, as
DeviceID
returned is same for both monitor, resulting in failure to select between multiple monitor.This fix uses
DeviceName
instead ofDeviceID
,DeviceName
is unique and works fine as identifier. I have passed the value ofDeviceName
for fieldmonitor_id
inobs_get_source_properties
instead ofDeviceID
. Later, we register the source using theDeviceName
.For reference, these are the available fields on device returned by

EnumDisplayDevicesA
:Motivation and Context
Fixes #12244
How Has This Been Tested?
Windows 11
Tested locally using both WGC and DXGI capture method on the set of
BenQ GW2790 68.58 cm (27 inch)
and set ofBenQ GW2786TC 68.58 cm (27 inch)
monitors, also normally tested the working on other monitors along with connecting and disconnecting these monitors.Types of changes
Checklist: