Address race between device notifications and enumerations in AudioDeviceListenerMac
Originally AudioDeviceListenerMac assumed that once CoreAudio reports that a device does not exist, it was no longer possible to get notifications related to that device, so it was safe to remove the listener for that device. However, since notifications can come from multiple threads and the corresponding callbacks make a thread jump, we have observed that it is indeed possible to get notifications about removed devices which can lead to a crash if the listener for that notification has been removed. To address this issue, this CL does not remove listeners when the device is removed, but instead marks the listener as deleted and posts a task to remove listeners that have been marked as deleted for several seconds, at a time when we can confidently no longer expect notifications from the removed device. Bug: 911311 Change-Id: I07cc9c8e24a0cfdfadcc04d0e8bd33e14ab61422 Reviewed-on: https://chromium-review.googlesource.com/c/1363187 Commit-Queue: Guido Urdaneta <guidou@chromium.org> Reviewed-by:Oskar Sundbom <ossu@chromium.org> Reviewed-by:
Olga Sharonova <olka@chromium.org> Cr-Commit-Position: refs/heads/master@{#614391}
Showing
Please register or sign in to comment