mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
Rework memory management to allow shared memory data transfer. The central idea
is to allocate all audio memory blocks from a per-process memory pool which is available as read-only SHM segment to other local processes. Then, instead of writing the actual audio data to the socket just write references to this shared memory pool. To work optimally all memory blocks should now be of type PA_MEMBLOCK_POOL or PA_MEMBLOCK_POOL_EXTERNAL. The function pa_memblock_new() now generates memory blocks of this type by default. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1266 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
ff48681aae
commit
0e436a6926
45 changed files with 1235 additions and 312 deletions
|
|
@ -35,10 +35,9 @@
|
|||
struct pa_mcalign {
|
||||
size_t base;
|
||||
pa_memchunk leftover, current;
|
||||
pa_memblock_stat *memblock_stat;
|
||||
};
|
||||
|
||||
pa_mcalign *pa_mcalign_new(size_t base, pa_memblock_stat *s) {
|
||||
pa_mcalign *pa_mcalign_new(size_t base) {
|
||||
pa_mcalign *m;
|
||||
assert(base);
|
||||
|
||||
|
|
@ -47,7 +46,6 @@ pa_mcalign *pa_mcalign_new(size_t base, pa_memblock_stat *s) {
|
|||
m->base = base;
|
||||
pa_memchunk_reset(&m->leftover);
|
||||
pa_memchunk_reset(&m->current);
|
||||
m->memblock_stat = s;
|
||||
|
||||
return m;
|
||||
}
|
||||
|
|
@ -100,7 +98,7 @@ void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
|
|||
l = c->length;
|
||||
|
||||
/* Can we use the current block? */
|
||||
pa_memchunk_make_writable(&m->leftover, m->memblock_stat, m->base);
|
||||
pa_memchunk_make_writable(&m->leftover, m->base);
|
||||
|
||||
memcpy((uint8_t*) m->leftover.memblock->data + m->leftover.index + m->leftover.length, (uint8_t*) c->memblock->data + c->index, l);
|
||||
m->leftover.length += l;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue