alsa-project / alsa-lib

The Advanced Linux Sound Architecture (ALSA) - library
GNU Lesser General Public License v2.1
366 stars 177 forks source link

Dmix plugin does not update state when sound card is removed. #137

Closed MHoyer12345678 closed 3 years ago

MHoyer12345678 commented 3 years ago

Playing sound using snd_pcm_writei in a dmix setup might result in an infinite loop when sound card is removed.

Setup:

Trigger:

Observation:

Expected:

Root Cause:

Potential Fix:

//disconnected HW is reported via a failed IOCTL return -ENODEV
if (err == -ENODEV)
    return SND_PCM_STATE_DISCONNECTED;

Hope this helps ...

perexg commented 3 years ago

Thank you for the analysis. Fix is in the above commit.