mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
Revert r1404 and keep it on a development branch until it is fully tested.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1409 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
6ca819354c
commit
8dc6214276
36 changed files with 499 additions and 990 deletions
|
|
@ -35,25 +35,22 @@
|
|||
void pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
|
||||
pa_memblock *n;
|
||||
size_t l;
|
||||
void *tdata, *sdata;
|
||||
|
||||
assert(c);
|
||||
assert(c->memblock);
|
||||
assert(PA_REFCNT_VALUE(c->memblock) > 0);
|
||||
|
||||
if (pa_memblock_is_read_only(c->memblock) &&
|
||||
pa_memblock_get_length(c->memblock) >= c->index+min)
|
||||
if (PA_REFCNT_VALUE(c->memblock) == 1 &&
|
||||
!c->memblock->read_only &&
|
||||
c->memblock->length >= c->index+min)
|
||||
return;
|
||||
|
||||
l = c->length;
|
||||
if (l < min)
|
||||
l = min;
|
||||
|
||||
n = pa_memblock_new(pa_memblock_get_pool(c->memblock), l);
|
||||
tdata = pa_memblock_acquire(n);
|
||||
sdata = pa_memblock_acquire(c->memblock);
|
||||
memcpy(tdata, (uint8_t*) sdata + c->index, c->length);
|
||||
pa_memblock_release(n);
|
||||
pa_memblock_release(c->memblock);
|
||||
n = pa_memblock_new(c->memblock->pool, l);
|
||||
memcpy(n->data, (uint8_t*) c->memblock->data + c->index, c->length);
|
||||
pa_memblock_unref(c->memblock);
|
||||
c->memblock = n;
|
||||
c->index = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue