From d45abba9aa4090ebeaf09ec9ec324709e04a1bbf Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 21 Nov 2004 19:39:46 +0000 Subject: calculate buffer sizes from sample spec git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@306 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/polyplib-stream.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'polyp/polyplib-stream.c') diff --git a/polyp/polyplib-stream.c b/polyp/polyplib-stream.c index b3f1f8cd..440217e7 100644 --- a/polyp/polyplib-stream.c +++ b/polyp/polyplib-stream.c @@ -283,11 +283,12 @@ static void create_stream(struct pa_stream *s, const char *dev, const struct pa_ if (attr) s->buffer_attr = *attr; else { - s->buffer_attr.maxlength = DEFAULT_MAXLENGTH; - s->buffer_attr.tlength = DEFAULT_TLENGTH; - s->buffer_attr.prebuf = DEFAULT_PREBUF; - s->buffer_attr.minreq = DEFAULT_MINREQ; - s->buffer_attr.fragsize = DEFAULT_FRAGSIZE; + /* half a second */ + s->buffer_attr.tlength = pa_bytes_per_second(&s->sample_spec)/2; + s->buffer_attr.maxlength = (s->buffer_attr.tlength*3)/2; + s->buffer_attr.minreq = s->buffer_attr.tlength/100; + s->buffer_attr.prebuf = s->buffer_attr.tlength - s->buffer_attr.minreq; + s->buffer_attr.fragsize = s->buffer_attr.tlength/100; } pa_stream_set_state(s, PA_STREAM_CREATING); -- cgit