[alsa] Don't query snd_pcm_delay() during an underrun

This commit is contained in:
ejurgensen 2016-03-17 12:54:17 +01:00
parent d2d52c7d68
commit e65361ba17
1 changed files with 4 additions and 2 deletions

View File

@ -89,8 +89,6 @@ laudio_alsa_xrun_recover(int err)
{ {
DPRINTF(E_WARN, L_LAUDIO, "PCM buffer underrun\n"); DPRINTF(E_WARN, L_LAUDIO, "PCM buffer underrun\n");
pcm_last_error = 0;
ret = snd_pcm_prepare(hdl); ret = snd_pcm_prepare(hdl);
if (ret < 0) if (ret < 0)
{ {
@ -263,6 +261,7 @@ laudio_alsa_write(uint8_t *buf, uint64_t rtptime)
return; return;
} }
pcm_last_error = 0;
pcm_pos += nsamp; pcm_pos += nsamp;
pkt->offset += STOB(nsamp); pkt->offset += STOB(nsamp);
@ -293,6 +292,9 @@ laudio_alsa_get_pos(void)
if (pcm_pos == 0) if (pcm_pos == 0)
return 0; return 0;
if (pcm_last_error != 0)
return pcm_pos;
ret = snd_pcm_delay(hdl, &delay); ret = snd_pcm_delay(hdl, &delay);
if (ret < 0) if (ret < 0)
{ {