MediaDevices::refreshDevices should take device type into account
<rdar://problem/60521332>
Created attachment 394251 [details] Patch
Comment on attachment 394251 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394251&action=review > Source/WebCore/Modules/mediastream/MediaDevices.cpp:186 > + auto deviceKind = newDevice.type() == CaptureDevice::DeviceType::Microphone ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput; > + auto index = m_devices.findMatching([deviceKind, &newDevice](auto& oldDevice) { > + return oldDevice->deviceId() == newDevice.persistentId() && oldDevice->kind() == deviceKind; How does this help the case where there is more than one device of a given type? Or is that not an issue because we have device IDs if `newDevices` has more than one device of any type?
(In reply to Eric Carlson from comment #3) > Comment on attachment 394251 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394251&action=review > > > Source/WebCore/Modules/mediastream/MediaDevices.cpp:186 > > + auto deviceKind = newDevice.type() == CaptureDevice::DeviceType::Microphone ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput; > > + auto index = m_devices.findMatching([deviceKind, &newDevice](auto& oldDevice) { > > + return oldDevice->deviceId() == newDevice.persistentId() && oldDevice->kind() == deviceKind; > > How does this help the case where there is more than one device of a given > type? Or is that not an issue because we have device IDs if `newDevices` has > more than one device of any type? UIProcess is filtering if needed to only expose 1 device of each type. The issue is that we will have two devices of two different type but with the same ID (the empty string). In that case, when calling enumerateDevices again, we will confuse the audioinput device with the videoinput device, which will lead to expose two audio input devices instead of 1 audio input and 1 video input.
Committed r258837: <https://trac.webkit.org/changeset/258837> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394251 [details].
*** Bug 209580 has been marked as a duplicate of this bug. ***
*** Bug 209739 has been marked as a duplicate of this bug. ***
*** Bug 209708 has been marked as a duplicate of this bug. ***