mozilla / cubeb-coreaudio-rs

The audio backend of Firefox on Mac OS X.
ISC License
25 stars 10 forks source link

Watching the alive status for all the running devices #170

Open ChunMinChang opened 2 years ago

ChunMinChang commented 2 years ago

We should monitor the alive status of both input and output devices in use. We used to watch input device only. With the code in this PR, we are able to watch the alive status of all the running devices when user doesn't follow the system default devices. If any user-selected device is unplugged before it's destroyed, we should fire an error callback.

padenot commented 2 years ago

Does this solve a problem in practice?

ChunMinChang commented 2 years ago

Does this solve a problem in practice?

I believe this relates to setSinkId. Now if the user-selected/non-default output device is unplugged while it's playing, the underlying stream will stop playing behind the scenes without notifying gecko to tear down the related variables or settings.

In addition, cubeb already does this job in WASAPI and PulseAudio backends so this makes cubeb behaves the same way on CoreAudio backend.

padenot commented 2 years ago

Sure, ok, I really wasn't sure what this was about, let me know when it's ready!