summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/protocol-native.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-06-11 12:08:37 +0000
committerLennart Poettering <lennart@poettering.net>2007-06-11 12:08:37 +0000
commit00da37f2c448096cdd54481b072db47b2f253141 (patch)
treecb6c51231fa498831b3e63660105ec00ea98d8f5 /src/pulsecore/protocol-native.c
parent6aeec56708f4af2da0b83fdd65a0d153b9bed272 (diff)
Merge HUGE set of changes temporarily into a branch, to allow me to move them from one machine to another (lock-free and stuff)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1469 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/protocol-native.c')
-rw-r--r--src/pulsecore/protocol-native.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index dd41b3d5..86455693 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -2278,6 +2278,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
} else {
struct upload_stream *u = (struct upload_stream*) stream;
size_t l;
+
assert(u->type == UPLOAD_STREAM);
if (!u->memchunk.memblock) {
@@ -2297,9 +2298,18 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
if (l > chunk->length)
l = chunk->length;
+
if (l > 0) {
- memcpy((uint8_t*) u->memchunk.memblock->data + u->memchunk.index + u->memchunk.length,
- (uint8_t*) chunk->memblock->data+chunk->index, l);
+ void *src, *dst;
+ dst = pa_memblock_acquire(u->memchunk.memblock);
+ src = pa_memblock_acquire(chunk->memblock);
+
+ memcpy((uint8_t*) dst + u->memchunk.index + u->memchunk.length,
+ (uint8_t*) src+chunk->index, l);
+
+ pa_memblock_release(u->memchunk.memblock);
+ pa_memblock_release(chunk->memblock);
+
u->memchunk.length += l;
u->length -= l;
}