Bug 1719578 use RefCountable for AudioDeviceInfo sets r=padenot
commit90e86b275d1f12574b17bccc78f341b9097f2f54
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 3 Jan 2022 22:38:01 +0000 (3 22:38 +0000)
committerKarl Tomlinson <karlt+@karlt.net>
Mon, 3 Jan 2022 22:38:01 +0000 (3 22:38 +0000)
tree1f03cce4157e55a9ae19c4257e2a34225a11db54
parent61d916e14a34f38b437555cff00e7e32bfe1c370
Bug 1719578 use RefCountable for AudioDeviceInfo sets r=padenot

This reduces some copying and fixes a race where AppendElements() could add
the set of devices to the end of mInputDevices and/or mOutputDevices multiple
times if multiple threads were in EnumerateAudioDevices() concurrently.

It will also facilitate passing a thread-safe reference to mInputDevices
and/or mOutputDevices for use within CubebDeviceEnumerator without the need to
hold the Mutex.

Differential Revision: https://phabricator.services.mozilla.com/D134808
dom/base/nsDOMWindowUtils.cpp
dom/media/gtest/TestAudioDeviceEnumerator.cpp
dom/media/webrtc/CubebDeviceEnumerator.cpp
dom/media/webrtc/CubebDeviceEnumerator.h
dom/media/webrtc/MediaEngineWebRTC.cpp