I am wondering how is the value of MediaDeviceInfo.deviceId
calculated in Webrtc
?
MediaDeviceInfo.deviceId
is a property used in web APIs of Webrtc
.
I have found a document MediaDeviceInfo, but still cannot get the answer.
Is it directly from the uuid
of the connected Media Devices?
I guess there may be some calculations in native codes, but I am not familiar with its native codes.
You can find the Chrome implementation here: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/media/media_stream_manager.cc;l=1653;drc=917850e016efe08e27c61eaa03e6fc27200e5be1
It is a hmac of the device id with a per-origin salt that has the same lifetime as cookies (for privacy reasons). This hides any device uuid.