From: Pierre-Louis Bossart Date: Tue, 13 Jul 2010 20:27:40 +0000 (-0500) Subject: alsa: disable rewinds when using ALSA plugins X-Git-Tag: v0.98-dev~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb55b00ccd25d965b1222e74375aee05427a449b;p=platform%2Fupstream%2Fpulseaudio.git alsa: disable rewinds when using ALSA plugins This is required to when playing on a52: device, rewind is broken in those plugins. Credits to Michael Rans for finding this workaround, and Tanu Kaskinen for providing valuable feedback. Signed-off-by: Pierre-Louis Bossart --- diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 2995c3c..2e54dbe 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -953,7 +953,12 @@ static int update_sw_params(struct userdata *u) { } pa_sink_set_max_request_within_thread(u->sink, u->hwbuf_size - u->hwbuf_unused); - pa_sink_set_max_rewind_within_thread(u->sink, u->hwbuf_size); + if (pa_alsa_pcm_is_hw(u->pcm_handle)) + pa_sink_set_max_rewind_within_thread(u->sink, u->hwbuf_size); + else { + pa_log_info("Disabling rewind_within_thread for device %s", u->device_name); + pa_sink_set_max_rewind_within_thread(u->sink, 0); + } return 0; } @@ -1906,7 +1911,12 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca (double) pa_bytes_to_usec(u->hwbuf_size, &ss) / PA_USEC_PER_MSEC); pa_sink_set_max_request(u->sink, u->hwbuf_size); - pa_sink_set_max_rewind(u->sink, u->hwbuf_size); + if (pa_alsa_pcm_is_hw(u->pcm_handle)) + pa_sink_set_max_rewind(u->sink, u->hwbuf_size); + else { + pa_log_info("Disabling rewind for device %s", u->device_name); + pa_sink_set_max_rewind(u->sink, 0); + } if (u->use_tsched) { u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, &requested_ss), &u->sink->sample_spec);