Created attachment 371432 [details] Output of mediaDevices.enumerateDevices() on Safari mediaDevices.enumerateDevices() on Safari 12.1 and Safari TP does not list the system default audio devices with deviceId as "default". Chrome enumerates the system default audio devices twice, once with the deviceId as "default" so that the WebRTC applications can identify them as such. Without this mechanism, the WebRTC application cannot identify the default mics and can run into issues with echo since microphones (like thunderbolt display and Logitech cameras) other than the built-in mics would still need AEC.
Created attachment 371433 [details] Output of mediaDevices.enumerateDevices() on Chrome
<rdar://problem/51454067>
Thanks for the report. One option is to go like Chrome is doing but it duplicates the default entry which is not great. Another option might be to use the order of the MediaDeviceInfo sequence. The first microphone and first camera could always be the default devices.
> default mics and can run into issues with echo since microphones (like > thunderbolt display and Logitech cameras) other than the built-in mics would > still need AEC. I just tried with a Logitech Camera and did not experience the echo cancellation issue. I tried to test with a Thunderbolt Display and ended up with some issues. In that case, the microphone was the built-in one and the output was the display.
Created attachment 371596 [details] Patch
Created attachment 371602 [details] Patch
@Jaya, the patch will make sure that the first mic device is system default when calling enumerateDevices. Similarly, if calling getUserMedia without any constraint, the system mic will be used.
Comment on attachment 371602 [details] Patch Clearing flags on attachment: 371602 Committed r246215: <https://trac.webkit.org/changeset/246215>
All reviewed patches have been landed. Closing bug.
Thank you Youenn for the quick fix. This will fix all our device selection and AEC issues with Safari.