From 5eecfa2e3f3abcacc9df2776cba798598e5fb6ee Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 11 May 2008 13:35:01 +0000 Subject: Move the ownership of the encoded data memchunk into the raop_client. This does not seem to fix the pool full messages so I'll have to try and suss that out. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/coling@2400 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-raop-sink.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/modules/module-raop-sink.c') diff --git a/src/modules/module-raop-sink.c b/src/modules/module-raop-sink.c index 3d08cb86..f6f93a46 100644 --- a/src/modules/module-raop-sink.c +++ b/src/modules/module-raop-sink.c @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: module-esound-sink.c 2043 2007-11-09 18:25:40Z lennart $ */ /*** This file is part of PulseAudio. @@ -109,6 +109,7 @@ struct userdata { int64_t offset; int64_t encoding_overhead; + int32_t next_encoding_overhead; double encoding_ratio; pa_raop_client *raop; @@ -224,10 +225,9 @@ static void thread_func(void *userdata) { if (u->encoded_memchunk.length <= 0) { /* Encode it */ size_t rl = u->raw_memchunk.length; - if (u->encoded_memchunk.memblock) - pa_memblock_unref(u->encoded_memchunk.memblock); + u->encoding_overhead += u->next_encoding_overhead; u->encoded_memchunk = pa_raop_client_encode_sample(u->raop, u->core->mempool, &u->raw_memchunk); - u->encoding_overhead += (u->encoded_memchunk.length - (rl - u->raw_memchunk.length)); + u->next_encoding_overhead = (u->encoded_memchunk.length - (rl - u->raw_memchunk.length)); u->encoding_ratio = u->encoded_memchunk.length / (rl - u->raw_memchunk.length); } pa_assert(u->encoded_memchunk.length > 0); @@ -259,11 +259,6 @@ static void thread_func(void *userdata) { u->encoded_memchunk.index += l; u->encoded_memchunk.length -= l; - if (u->encoded_memchunk.length <= 0) { - pa_memblock_unref(u->encoded_memchunk.memblock); - pa_memchunk_reset(&u->encoded_memchunk); - } - pollfd->revents = 0; if (u->encoded_memchunk.length > 0) @@ -381,6 +376,7 @@ int pa__init(pa_module*m) { pa_memchunk_reset(&u->encoded_memchunk); u->offset = 0; u->encoding_overhead = 0; + u->next_encoding_overhead = 0; u->encoding_ratio = 1.0; pa_thread_mq_init(&u->thread_mq, m->core->mainloop); @@ -477,9 +473,6 @@ void pa__done(pa_module*m) { if (u->raw_memchunk.memblock) pa_memblock_unref(u->raw_memchunk.memblock); - if (u->encoded_memchunk.memblock) - pa_memblock_unref(u->encoded_memchunk.memblock); - if (u->raop) pa_raop_client_free(u->raop); -- cgit