drop chunk argument from various drop() functions, since it doesn't make any sense if we want to guarantee always monotonously increasing read pointers; a couple of other fixes

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1529 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2007-07-25 14:46:40 +00:00
parent 9cc20b46b7
commit 068f5d5eef
14 changed files with 341 additions and 217 deletions

View file

@ -26,6 +26,7 @@
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <signal.h>
#include <pulsecore/memblockq.h>
#include <pulsecore/log.h>
@ -48,22 +49,22 @@ int main(int argc, char *argv[]) {
bq = pa_memblockq_new(0, 40, 10, 2, 4, 4, silence);
assert(bq);
chunk1.memblock = pa_memblock_new_fixed(p, (char*) "AA", 2, 1);
chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);
chunk1.index = 0;
chunk1.length = 2;
assert(chunk1.memblock);
chunk2.memblock = pa_memblock_new_fixed(p, (char*) "TTBB", 4, 1);
chunk2.memblock = pa_memblock_new_fixed(p, (char*) "XX22", 4, 1);
chunk2.index = 2;
chunk2.length = 2;
assert(chunk2.memblock);
chunk3.memblock = pa_memblock_new_fixed(p, (char*) "ZZZZ", 4, 1);
chunk3.memblock = pa_memblock_new_fixed(p, (char*) "3333", 4, 1);
chunk3.index = 0;
chunk3.length = 4;
assert(chunk3.memblock);
chunk4.memblock = pa_memblock_new_fixed(p, (char*) "KKKKKKKK", 8, 1);
chunk4.memblock = pa_memblock_new_fixed(p, (char*) "44444444", 8, 1);
chunk4.index = 0;
chunk4.length = 8;
assert(chunk4.memblock);
@ -115,13 +116,12 @@ int main(int argc, char *argv[]) {
chunk3.index += 2;
chunk3.length -= 2;
ret = pa_memblockq_push(bq, &chunk3);
assert(ret == 0);
printf(">");
pa_memblockq_shorten(bq, pa_memblockq_get_length(bq)-2);
pa_memblockq_shorten(bq, 6);
printf(">");
for (;;) {
pa_memchunk out;
@ -137,7 +137,7 @@ int main(int argc, char *argv[]) {
pa_memblock_release(out.memblock);
pa_memblock_unref(out.memblock);
pa_memblockq_drop(bq, &out, out.length);
pa_memblockq_drop(bq, out.length);
}
printf("<\n");