plasma: do not call snd_pcm_recover() on EAGAIN in mixer applet

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-22 16:50:24 +03:00
parent 3645e1c382
commit 8c05205586

View file

@ -781,9 +781,13 @@ void MixerTabWidget::slotVisualizerTimeout()
::memset(m_alsapcmbuffer, 0, sizeof(m_alsapcmbuffer));
const int alsaresult = snd_pcm_readi(m_alsapcm, m_alsapcmbuffer, s_alsapcmbuffersize);
if (alsaresult < 1) {
if (errno == EAGAIN) {
// no data? snd_pcm_recover() does not handle it anyway
break;
}
// NOTE: this happens when the data is drained which is quite often because
// the visualization timer is 50ms
// kDebug() << "Could not read PCM data" << snd_strerror(alsaresult);
kWarning() << "Could not read PCM data" << snd_strerror(alsaresult);
snd_pcm_recover(m_alsapcm, alsaresult, 1);
break;
}