From 7755f759aae60b279b9a18e3856ff89720105914 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 27 Jun 2008 00:34:17 +0200 Subject: use (uint32_t) -1 to signify default buffer_attr values instead of 0, to allow prebuf=0 --- src/pulse/stream.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/pulse/stream.c') diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 89838c50..585518f0 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -122,7 +122,12 @@ pa_stream *pa_stream_new_with_proplist( /* We initialize der target length here, so that if the user * passes no explicit buffering metrics the default is similar to * what older PA versions provided. */ + + s->buffer_attr.maxlength = (uint32_t) -1; s->buffer_attr.tlength = pa_usec_to_bytes(250*PA_USEC_PER_MSEC, ss); /* 250ms of buffering */ + s->buffer_attr.minreq = (uint32_t) -1; + s->buffer_attr.prebuf = (uint32_t) -1; + s->buffer_attr.fragsize = (uint32_t) -1; s->device_index = PA_INVALID_INDEX; s->device_name = NULL; @@ -713,20 +718,20 @@ static void automatic_buffer_attr(pa_stream *s, pa_buffer_attr *attr, const pa_s /* We choose fairly conservative values here, to not confuse * old clients with extremely large playback buffers */ - if (!attr->maxlength <= 0) + if (attr->maxlength == (uint32_t) -1) attr->maxlength = 4*1024*1024; /* 4MB is the maximum queue length PulseAudio <= 0.9.9 supported. */ - if (!attr->tlength <= 0) + if (attr->tlength == (uint32_t) -1) attr->tlength = pa_usec_to_bytes(250*PA_USEC_PER_MSEC, ss); /* 250ms of buffering */ - if (!attr->minreq <= 0) + if (attr->minreq == (uint32_t) -1) attr->minreq = (attr->tlength)/5; /* Ask for more data when there are only 200ms left in the playback buffer */ - if (!attr->prebuf) + if (attr->prebuf == (uint32_t) -1) attr->prebuf = attr->tlength; /* Start to play only when the playback is fully filled up once */ - if (!attr->fragsize) - attr->fragsize = attr->tlength; /* Pass data to the app only when the buffer is filled up once */ + if (attr->fragsize == (uint32_t) -1) + attr->fragsize = attr->tlength; /* Pass data to the app only when the buffer is filled up once */ } void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) { -- cgit