diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-07-10 19:23:45 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-07-10 19:23:45 +0000 |
commit | 025389693d292b7a1c5f2c6e0ce96efa14062274 (patch) | |
tree | 096da17a75658881598c7d0d9b77ed12bff74570 /src/memblockq.c | |
parent | 5ee3a59469f9c86659e6de21e70f96f1d7627347 (diff) |
make memblockq merge chunks
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@58 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/memblockq.c')
-rw-r--r-- | src/memblockq.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/memblockq.c b/src/memblockq.c index fb4cbc7e..6d4d712a 100644 --- a/src/memblockq.c +++ b/src/memblockq.c @@ -82,6 +82,18 @@ void pa_memblockq_push(struct pa_memblockq* bq, const struct pa_memchunk *chunk, struct memblock_list *q; assert(bq && chunk && chunk->memblock && chunk->length && (chunk->length % bq->base) == 0); + if (bq->blocks_tail && bq->blocks_tail->chunk.memblock == chunk->memblock) { + /* Try to merge memory chunks */ + + if (bq->blocks_tail->chunk.index+bq->blocks_tail->chunk.length == chunk->index) { + bq->blocks_tail->chunk.length += chunk->length; + bq->current_length += chunk->length; + + /* fprintf(stderr, __FILE__": merge succeeded: %u\n", chunk->length);*/ + return; + } + } + q = malloc(sizeof(struct memblock_list)); assert(q); |