mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
Small cleanups
Make macros without side effects Use SPA_MIN to calculate ringbuffer areas.
This commit is contained in:
parent
0966e703fe
commit
d040747d4b
5 changed files with 40 additions and 47 deletions
|
|
@ -335,21 +335,15 @@ static int make_buffer(struct impl *this)
|
|||
avail = maxsize - filled;
|
||||
n_bytes = SPA_MIN(avail, n_bytes);
|
||||
|
||||
n_samples = n_bytes / this->bpf;
|
||||
|
||||
offset = index % maxsize;
|
||||
|
||||
if (offset + n_bytes > maxsize) {
|
||||
l0 = (maxsize - offset) / this->bpf;
|
||||
l1 = n_samples - l0;
|
||||
}
|
||||
else {
|
||||
l0 = n_samples;
|
||||
l1 = 0;
|
||||
}
|
||||
n_samples = n_bytes / this->bpf;
|
||||
|
||||
l0 = SPA_MIN(n_bytes, maxsize - offset) / this->bpf;
|
||||
l1 = n_samples - l0;
|
||||
|
||||
this->render_func(this, SPA_MEMBER(data, offset, void), l0);
|
||||
if (l1)
|
||||
if (l1 > 0)
|
||||
this->render_func(this, data, l1);
|
||||
|
||||
spa_ringbuffer_write_update(rb, index + n_bytes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue