Fix "Default" mic display

This commit is contained in:
Miriam Zimmerman
2025-02-09 17:29:27 -05:00
committed by GitHub
parent 4b8c85eec1
commit 0d87e3e6c9

View File

@@ -28,18 +28,22 @@ export function findBestMatchingAudioDeviceIndex(
return preferred.index; return preferred.index;
} }
// Number of default devices at start of list to ignore.
const offset = isWindows ? 2 : 1;
const searchArr = available.slice(offset);
if (preferred.uniqueId) { if (preferred.uniqueId) {
const idMatchIndex = available.findIndex( const idMatchIndex = searchArr.findIndex(
d => d.uniqueId === preferred.uniqueId d => d.uniqueId === preferred.uniqueId
); );
if (idMatchIndex !== -1) { if (idMatchIndex !== -1) {
return idMatchIndex; return idMatchIndex + offset;
} }
} }
const nameMatchIndex = available.findIndex(d => d.name === preferred.name); const nameMatchIndex = searchArr.findIndex(d => d.name === preferred.name);
if (nameMatchIndex !== -1) { if (nameMatchIndex !== -1) {
return nameMatchIndex; return nameMatchIndex + offset;
} }
return available.length > 0 ? 0 : undefined; return available.length > 0 ? 0 : undefined;