Re: [mediacapture-main] Premature optimization in enumerateDevices steps

It's not an optimization, it's an invariant.

The guarantee you get from keeping oldList around is this:

enumerateDevices().then(list => list1 = list);
.... time passes ....
enumerateDevices().then(list => list2 = list);

Guarantee:
If <device> is present in both list1 and list2, it has the same 
deviceId and groupId.

There's even a weird case where it matters more:
If at time 1, a headset was present with no microphone, and at time 2,
 the headset has grown a microphone (pluggable microphone detectable 
from browser? Weirder things can happen), you need the oldList to 
guarantee that the headset and the microphone has the same groupId.


-- 
GitHub Notif of comment by alvestrand
See 
https://github.com/w3c/mediacapture-main/issues/155#issuecomment-90964335

Received on Wednesday, 8 April 2015 16:19:46 UTC