[pulseaudio-commits] r2484 - /branches/coling/airtunes/src/modules/rtp/raop_client.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon May 26 16:02:32 PDT 2008


Author: coling
Date: Tue May 27 01:02:30 2008
New Revision: 2484

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2484&root=pulseaudio&view=rev
Log:
Keep track of the memblock pointer internally and do not rely on subsequent calls to pass it back in for unref'ing

Modified:
    branches/coling/airtunes/src/modules/rtp/raop_client.c

Modified: branches/coling/airtunes/src/modules/rtp/raop_client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/airtunes/src/modules/rtp/raop_client.c?rev=2484&root=pulseaudio&r1=2483&r2=2484&view=diff
==============================================================================
--- branches/coling/airtunes/src/modules/rtp/raop_client.c (original)
+++ branches/coling/airtunes/src/modules/rtp/raop_client.c Tue May 27 01:02:30 2008
@@ -96,6 +96,7 @@
     void* closed_userdata;
 
     uint8_t *buffer;
+    pa_memblock *memblock;
     size_t buffer_length;
     uint8_t *buffer_index;
     uint16_t buffer_count;
@@ -443,15 +444,14 @@
     /* Leave 16 bytes extra to allow for the ALAC header which is about 55 bits */
     bufmax = length + header_size + 16;
     if (bufmax > c->buffer_length) {
-        if (encoded->memblock)
-            pa_memblock_unref(encoded->memblock);
-
         c->buffer = pa_xrealloc(c->buffer, bufmax);
         c->buffer_length = bufmax;
-        encoded->memblock = pa_memblock_new_user(c->core->mempool, c->buffer, bufmax, noop, 0);
-    }
-    encoded->index = 0;
-    encoded->length = 0;
+        if (c->memblock)
+            pa_memblock_unref(c->memblock);
+        c->memblock = pa_memblock_new_user(c->core->mempool, c->buffer, bufmax, noop, 0);
+    }
+    pa_memchunk_reset(encoded);
+    encoded->memblock = c->memblock;
     b = pa_memblock_acquire(encoded->memblock);
     memcpy(b, header, header_size);
 




More information about the pulseaudio-commits mailing list