]> code.delx.au - pulseaudio/commitdiff
make memblockq merge chunks
authorLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2004 19:23:45 +0000 (19:23 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2004 19:23:45 +0000 (19:23 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@58 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/memblockq.c
src/protocol-esound.c
src/todo

index fb4cbc7e14fff0910fb8017bb7f9c48a0fb0266a..6d4d712a4c0905cf902b298092d53861345a3a02 100644 (file)
@@ -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);
 
index e97ab34d0e09efc6acd6edf59b82b8aa6b7d185d..4d9ca546a464e5a9f57993e74c0406e3bdb0c878 100644 (file)
@@ -394,7 +394,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
             continue;
 
         assert(t >= s+k+k);
-        
+
         if (conn->sink_input) {
             rate = conn->sink_input->sample_spec.rate;
             volume = (conn->sink_input->volume*0xFF)/0x100;
index 1e1e02c504031a22b9d2a8840c9da87d103901e3..8c647a8d64ed3ae6702a2b9236b88240e1a0de45 100644 (file)
--- a/src/todo
+++ b/src/todo
@@ -9,8 +9,6 @@
 
 - move more stuff from module-oss[-dma] to liboss-util
 
-- merge memchunks in memblockq
-
 - create libstatustext, libsocketutil
 - prefix modules/libraries with pa_
 
@@ -29,6 +27,7 @@
 - autoloading/autounloading
 - slp/rendezvous
 - doxygen
+- make mcalign merge chunks
 
 drivers:
 - libao