limit the prebuf value by tlength
authorLennart Poettering <lennart@poettering.net>
Tue, 17 Jun 2008 20:07:51 +0000 (20:07 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 17 Jun 2008 20:07:51 +0000 (20:07 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2547 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulsecore/memblockq.c

index e058765..9156fc0 100644 (file)
@@ -786,6 +786,9 @@ void pa_memblockq_set_tlength(pa_memblockq *bq, size_t tlength) {
     if (bq->tlength > bq->maxlength)
         bq->tlength = bq->maxlength;
 
+    if (bq->prebuf > bq->tlength)
+        pa_memblockq_set_prebuf(bq, bq->tlength);
+
     if (bq->minreq > bq->tlength)
         pa_memblockq_set_minreq(bq, bq->tlength);
 
@@ -803,8 +806,8 @@ void pa_memblockq_set_prebuf(pa_memblockq *bq, size_t prebuf) {
     if (prebuf > 0 && bq->prebuf < bq->base)
         bq->prebuf = bq->base;
 
-    if (bq->prebuf > bq->maxlength)
-        bq->prebuf = bq->maxlength;
+    if (bq->prebuf > bq->tlength)
+        bq->prebuf = bq->tlength;
 
     if (bq->prebuf <= 0 || pa_memblockq_get_length(bq) >= bq->prebuf)
         bq->in_prebuf = FALSE;