mozilla / cubeb

Cross platform audio library
ISC License
439 stars 124 forks source link

wasapi: Avoid reconfiguring default output stream spuriously. #731

Closed kinetiknz closed 1 year ago

kinetiknz commented 1 year ago

Default output devices changes may call OnDefaultDeviceChanged multiple times during a single real device change event. Ignoring changes that don't match eRender or the notification client's configured role reduces this somewhat, but it seem useful to debounce device changes even when they do match the flow and role of the stream if they arrive closely together and the new device_id is the same as the previously seen one. Chromium does something similar, so I've taken inspiration from that code and used the same debounce timer (250ms).