Description: Do not report underruns to the ALSA layer. Reporting underruns to ALSA seems to do more bad than good, for these reasons: * If pulseaudio gets an underrun, the normal way to end that underrun is to feed it with more buffers. This is different from the ALSA way of dealing with underruns, which requires hardware buffer pointers to be reset. * In addition, underrun signals are delivered asynchronously from pulseaudio. This means that there might be more buffers on the way to pulseaudio when the underrun is reported, making the underrun obsolete. Unfortunately, there is currently no known way to determine whether this is the case or not. Forwarded: yes Bug-ubuntu: https://bugs.launchpad.net/bugs/464008 Author: David Henningsson Index: alsa-plugins-1.0.22/pulse/pcm_pulse.c =================================================================== --- alsa-plugins-1.0.22.orig/pulse/pcm_pulse.c 2010-02-28 17:11:29.000000000 -0500 +++ alsa-plugins-1.0.22/pulse/pcm_pulse.c 2010-02-28 17:11:56.000000000 -0500 @@ -38,7 +38,7 @@ /* Since ALSA expects a ring buffer we must do some voodoo. */ size_t last_size; size_t ptr; - int underrun; + /* int underrun; */ size_t offset; @@ -220,7 +220,7 @@ u = pa_stream_trigger(pcm->stream, stream_success_cb, pcm); - pcm->underrun = 0; + /* pcm->underrun = 0; */ err_o = pulse_wait_operation(pcm->p, o); if (u) err_u = pulse_wait_operation(pcm->p, u); @@ -347,10 +347,10 @@ if (ret < 0) goto finish; - if (pcm->underrun) { + /*if (pcm->underrun) { ret = -EPIPE; goto finish; - } + }*/ ret = update_ptr(pcm); if (ret < 0) { @@ -358,9 +358,9 @@ goto finish; } - if (pcm->underrun) + /*if (pcm->underrun) ret = -EPIPE; - else + else*/ ret = snd_pcm_bytes_to_frames(io->pcm, pcm->ptr); finish: @@ -408,8 +408,8 @@ finish: - if (pcm->underrun && pcm->io.state == SND_PCM_STATE_RUNNING) - snd_pcm_ioplug_set_state(io, SND_PCM_STATE_XRUN); + /*if (pcm->underrun && pcm->io.state == SND_PCM_STATE_RUNNING) + snd_pcm_ioplug_set_state(io, SND_PCM_STATE_XRUN);*/ pa_threaded_mainloop_unlock(pcm->p->mainloop); @@ -462,7 +462,7 @@ goto finish; ret = size; - pcm->underrun = 0; + /*pcm->underrun = 0;*/ finish: pa_threaded_mainloop_unlock(pcm->p->mainloop); @@ -575,7 +575,7 @@ update_active(pcm); } - +/* static void stream_underrun_cb(pa_stream * p, void *userdata) { snd_pcm_pulse_t *pcm = userdata; @@ -587,7 +587,7 @@ pcm->underrun = 1; } - +*/ static void stream_latency_cb(pa_stream *p, void *userdata) { snd_pcm_pulse_t *pcm = userdata; @@ -688,8 +688,8 @@ if (io->stream == SND_PCM_STREAM_PLAYBACK) { pa_stream_set_write_callback(pcm->stream, stream_request_cb, pcm); - pa_stream_set_underflow_callback(pcm->stream, - stream_underrun_cb, pcm); + /*pa_stream_set_underflow_callback(pcm->stream, + stream_underrun_cb, pcm);*/ r = pa_stream_connect_playback(pcm->stream, pcm->device, &pcm->buffer_attr, PA_STREAM_AUTO_TIMING_UPDATE | @@ -728,7 +728,7 @@ } pcm->offset = 0; - pcm->underrun = 0; + /*pcm->underrun = 0;*/ finish: pa_threaded_mainloop_unlock(pcm->p->mainloop);