[NEED]Try recover from snd_pcm_avail() -EPIPE
Submitted by IvanXie
Assigned to pul..@..op.org
Description
ALSA sink has been unloaded due to process_rewind() return -1.
"alsa-sink.c: process_rewind(1754) > [alsa-sink-Multimedia1 (*)] snd_pcm_avail() failed: Broken pipe" "sink.c: sink_free(843) > [pulseaudio] Freeing sink 2 "alsa_output.0.analog-stereo"" "module.c pa_module_free(183) > [pulseaudio] unloaded "module-alsa-sink" (index: #15 (closed))"
Actually, sometimes we may meet snd_pcm_avail() -EPIPE from process_rewind, pa_alsa_safe_avail. But how about do recover for this error case instead of return error and unload sink?
I've tried make a patch for this issue. But I'm not sure about this is a proper solution. Please give me your opinion. Thank you.
if (PA_UNLIKELY((unused = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) { pa_log("snd_pcm_avail() failed: %s", pa_alsa_strerror((int) unused)); #ifdef RECOVER_FROM_EPIPE /* try recover if we got -EPIPE from snd_pcm_avail */ if (unsed == -EPIPE) { pa_log("snd_pcm_avail() failed of -EPIPE. Try recover!!!"); if (try_recover(u, "process_rewind", unused) < 0) return -1; else { pa_log_info("Tried rewind, but was apparently not possible."); pa_sink_process_rewind(u->sink, 0); return 0; } } #endif return -1; }