summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-02-23 01:17:54 +0000
committerLennart Poettering <lennart@poettering.net>2006-02-23 01:17:54 +0000
commit57713350d7fc3c39c44aecd02c2eda6ff2041cb4 (patch)
tree5a8c7a270bda648bb926db4d9d9a10192d0c7f3d
parent708c650ad1366a0686d4c2b1932762205097081c (diff)
fix source volume adjustment: copy memchunk before changing the volume of it
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@572 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/polypcore/source.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/polypcore/source.c b/src/polypcore/source.c
index 47325a1b..8bca8a1d 100644
--- a/src/polypcore/source.c
+++ b/src/polypcore/source.c
@@ -33,6 +33,7 @@
#include <polypcore/xmalloc.h>
#include <polypcore/core-subscribe.h>
#include <polypcore/log.h>
+#include <polypcore/sample-util.h>
#include "source.h"
@@ -182,11 +183,15 @@ void pa_source_post(pa_source*s, const pa_memchunk *chunk) {
pa_source_ref(s);
if (!pa_cvolume_is_norm(&s->sw_volume)) {
- pa_memchunk_make_writable(chunk, s->core->memblock_stat, 0);
- pa_volume_memchunk(chunk, &s->sample_spec, &s->sw_volume);
- }
-
- pa_idxset_foreach(s->outputs, do_post, (void*) chunk);
+ pa_memchunk vchunk = *chunk;
+
+ pa_memblock_ref(vchunk.memblock);
+ pa_memchunk_make_writable(&vchunk, s->core->memblock_stat, 0);
+ pa_volume_memchunk(&vchunk, &s->sample_spec, &s->sw_volume);
+ pa_idxset_foreach(s->outputs, do_post, &vchunk);
+ pa_memblock_unref(vchunk.memblock);
+ } else
+ pa_idxset_foreach(s->outputs, do_post, (void*) chunk);
pa_source_unref(s);
}