summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-26 11:02:24 +0100
committerTakashi Iwai <tiwai@suse.de>2007-11-26 11:02:24 +0100
commit327e169964b0a5bdcffb46eb49a305f3aabaeab4 (patch)
tree803025d5eecae816a724de0fadfff21d4536c645
parent2a3260e3b3baef76262b57caca396566e0cec964 (diff)
Use different buffer metrics in the PulseAudio plugin
It increases the "pre-buffering level" (i.e. start threshold) to the full buffer size minus one period. This makes PA work a little bit more like normal audio devices, and makes a few drop outs go away for software which uses very small period sizes. It also increases the initial maximum buffer size, which allows a small overcommit. That's not really an issue, but cleaner nonetheless so I smuggled it into this patch. Also reported in the ALSA BTS: https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3578 From: Lennart Poettering <mznyfn@0pointer.de>
-rw-r--r--pulse/pcm_pulse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index ae55bcb..da15792 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -57,7 +57,7 @@ static void update_ptr(snd_pcm_pulse_t *pcm)
if (size > pcm->last_size) {
pcm->ptr += size - pcm->last_size;
- pcm->ptr %= pcm->buffer_attr.maxlength;
+ pcm->ptr %= pcm->buffer_attr.tlength;
}
pcm->last_size = size;
@@ -544,9 +544,9 @@ static int pulse_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)
pcm->ss.rate = io->rate;
pcm->ss.channels = io->channels;
- pcm->buffer_attr.maxlength = io->buffer_size * pcm->frame_size;
+ pcm->buffer_attr.maxlength = (io->buffer_size*3)/2 * pcm->frame_size;
pcm->buffer_attr.tlength = io->buffer_size * pcm->frame_size;
- pcm->buffer_attr.prebuf = io->period_size * pcm->frame_size;
+ pcm->buffer_attr.prebuf = (io->buffer_size - io->period_size) * pcm->frame_size;
pcm->buffer_attr.minreq = io->period_size * pcm->frame_size;
pcm->buffer_attr.fragsize = io->period_size * pcm->frame_size;