Skip to content

Commit

Permalink
Bug 1528042 - Don't expose number of devices of a kind unless informa…
Browse files Browse the repository at this point in the history
…tion can be exposed for that kind per w3c/mediacapture-main#900. r=karlt

Differential Revision: https://phabricator.services.mozilla.com/D176925

UltraBlame original commit: 364f837033b89f56f75b4ec40d839fcdbd1693d8
  • Loading branch information
marco-c committed May 31, 2023
1 parent fa25379 commit 36604f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dom/media/MediaDevices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ RefPtr<MediaDeviceSetRefCnt> MediaDevices::FilterExposedDevices(
if (mCanExposeMicrophoneInfo) {
exposedMicrophoneGroupIds.Insert(device->mRawGroupID);
}
if (!DeviceInformationCanBeExposed() && !legacy) {
if (!mCanExposeMicrophoneInfo && !legacy) {
dropMics = true;
}
break;
case MediaDeviceKind::Videoinput:
if (dropCams) {
continue;
}
if (!DeviceInformationCanBeExposed() && !legacy) {
if (!mCanExposeCameraInfo && !legacy) {
dropCams = true;
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ <h1 class="instructions">Description</h1>
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
stream.getTracks()[0].stop();
const devices = await navigator.mediaDevices.enumerateDevices();
assert_equals(devices.filter(({kind}) => kind != "audiooutput").length,
devices1.filter(({kind}) => kind != "audiooutput").length,
"same number of input devices");
assert_equals(devices.filter(({kind}) => kind == "videoinput").length,
devices1.filter(({kind}) => kind == "videoinput").length,
"same number of (previously exposed) videoinput devices");
assert_greater_than_equal(devices.filter(d => d.kind == "audioinput").length,
devices1.filter(d => d.kind == "audioinput").length,
"same number or more audioinput devices");
const order = ["audioinput", "videoinput", "audiooutput"];
for (const {kind, deviceId} of devices) {
assert_in_array(kind, order, "expected kind");
Expand Down

0 comments on commit 36604f9

Please sign in to comment.