summaryrefslogtreecommitdiffstats
path: root/src/modules/module-raop-sink.c
diff options
context:
space:
mode:
authorColin Guthrie <pulse@colin.guthr.ie>2008-05-11 13:35:01 +0000
committerColin Guthrie <pulse@colin.guthr.ie>2008-10-08 20:32:07 +0100
commit5eecfa2e3f3abcacc9df2776cba798598e5fb6ee (patch)
tree8b5f536a15be31bc4eab7dc4db1569a55b3f9347 /src/modules/module-raop-sink.c
parent4dd318519fbec1811a16dca05aca859da74b60c2 (diff)
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
Diffstat (limited to 'src/modules/module-raop-sink.c')
-rw-r--r--src/modules/module-raop-sink.c17
1 files changed, 5 insertions, 12 deletions
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);