summaryrefslogtreecommitdiff
path: root/src/modules/rtp
diff options
context:
space:
mode:
authorColin Guthrie <pulse@colin.guthr.ie>2008-05-26 23:02:30 +0000
committerColin Guthrie <pulse@colin.guthr.ie>2008-10-08 20:32:08 +0100
commitb93e9e80ecbdc90c0bf6f90c5bd4aafcdb4d2488 (patch)
tree74fafe56f87af27318ed0335251b440e22f800c1 /src/modules/rtp
parent8108121fa76e51c36772a592f74b075dcaf7c4cb (diff)
downloadpulseaudio-b93e9e80ecbdc90c0bf6f90c5bd4aafcdb4d2488.tar.gz
Keep track of the memblock pointer internally and do not rely on subsequent calls to pass it back in for unref'ing
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/coling@2484 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/modules/rtp')
-rw-r--r--src/modules/rtp/raop_client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/rtp/raop_client.c b/src/modules/rtp/raop_client.c
index cdf9150df..7ba1be747 100644
--- a/src/modules/rtp/raop_client.c
+++ b/src/modules/rtp/raop_client.c
@@ -96,6 +96,7 @@ struct pa_raop_client {
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 @@ int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchun
/* 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);
+ if (c->memblock)
+ pa_memblock_unref(c->memblock);
+ c->memblock = pa_memblock_new_user(c->core->mempool, c->buffer, bufmax, noop, 0);
}
- encoded->index = 0;
- encoded->length = 0;
+ pa_memchunk_reset(encoded);
+ encoded->memblock = c->memblock;
b = pa_memblock_acquire(encoded->memblock);
memcpy(b, header, header_size);