[pulseaudio-discuss] [PATCH] alsa-sink: Avoid unloading alsa-sink module before calling try_recover()

Arun Raghavan arun at accosted.net
Fri Nov 13 20:22:49 PST 2015


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


More information about the pulseaudio-discuss mailing list