X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=alsa_write.c;h=c856ef4a2d23d256015028a89131fb19824f9a26;hp=fab886cacf777caaa51358970f5b43f081e62585;hb=9ae0041ae0dd073657862c4abdf3886a66035ee9;hpb=7a0852896a75d852dbd2ac848ec5c0be3b5dea71;ds=sidebyside diff --git a/alsa_write.c b/alsa_write.c index fab886ca..c856ef4a 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -176,7 +176,7 @@ static int alsa_write_post_select(__a_unused struct sched *s, // PARA_INFO_LOG("%zd frames\n", frames); if (!frames) { - if (*wng->input_eof) + if (*wng->input_error) wn->written = *wng->loaded; return 1; } @@ -188,15 +188,19 @@ static int alsa_write_post_select(__a_unused struct sched *s, snd_pcm_prepare(pad->handle); return 1; } - if (ret < 0) { + if (ret < 0 && ret != -EAGAIN) { PARA_WARNING_LOG("alsa error (%zu frames, ret = %d\n", frames, (int)ret); return -E_ALSA_WRITE; } - ms2tv(pad->buffer_time / 4000, &tv); -// ms2tv(1, &tv); + if (ret == -EAGAIN) { /* try again in 5ms */ + PARA_WARNING_LOG("EAGAIN\n"); + ms2tv(5, &tv); + } else { + wn->written += ret * pad->bytes_per_frame; + ms2tv(pad->buffer_time / 4000, &tv); + } tv_add(now, &tv, &pad->next_chunk); - wn->written += ret * pad->bytes_per_frame; return 1; }