On Tue, 2015-11-10 at 07:51 +0100, Zbigniew KempczyÅ?ski wrote: > This fixes rare condition when pulseaudio client tries to rewind, > but a device previously reached underrun and was changed to XRUN > state. > --- > Â src/modules/alsa/alsa-sink.c | 8 +++++++- > Â 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa- > sink.c > index b6c7d09..a912259 100644 > --- a/src/modules/alsa/alsa-sink.c > +++ b/src/modules/alsa/alsa-sink.c > @@ -1628,8 +1628,14 @@ static int process_rewind(struct userdata *u) > { > Â Â Â Â Â pa_log_debug("Requested to rewind %lu bytes.", (unsigned long) > rewind_nbytes); > Â > Â Â Â Â Â if (PA_UNLIKELY((unused = pa_alsa_safe_avail(u->pcm_handle, u- > >hwbuf_size, &u->sink->sample_spec)) < 0)) { > +Â Â Â Â Â Â Â Â int ret; > Â Â Â Â Â Â Â Â Â pa_log("snd_pcm_avail() failed: %s", pa_alsa_strerror((int) > unused)); > -Â Â Â Â Â Â Â Â return -1; > +Â Â Â Â Â Â Â Â if ((ret = try_recover(u, "snd_pcm_avail", (int) unused)) == > 0) { > +Â Â Â Â Â Â Â Â Â Â Â Â pa_log("try recover in process_rewind() succeed (ret = > %d)", ret); > +Â Â Â Â Â Â Â Â } else { > +Â Â Â Â Â Â Â Â Â Â Â Â pa_log("try recover in process_rewind() failed! (ret = > %d)", ret); > +Â Â Â Â Â Â Â Â Â Â Â Â return -1; > +Â Â Â Â Â Â Â Â } Thanks -- I've made the code a bit less verbose and merged this. Regards, Arun