Small cleanups

Make macros without side effects
Use SPA_MIN to calculate ringbuffer areas.
This commit is contained in:
Wim Taymans 2017-11-16 16:31:03 +01:00
parent 0966e703fe
commit d040747d4b
5 changed files with 40 additions and 47 deletions

View file

@ -711,11 +711,8 @@ static void do_volume(struct impl *this, struct spa_buffer *dbuf, struct spa_buf
src = SPA_MEMBER(sd[0].data, soffset, int16_t);
dst = SPA_MEMBER(dd[0].data, doffset, int16_t);
n_bytes = towrite;
if (soffset + n_bytes > sd[0].maxsize)
n_bytes = sd[0].maxsize - soffset;
if (doffset + n_bytes > dd[0].maxsize)
n_bytes = dd[0].maxsize - doffset;
n_bytes = SPA_MIN(towrite, sd[0].maxsize - soffset);
n_bytes = SPA_MIN(n_bytes, dd[0].maxsize - doffset);
n_samples = n_bytes / sizeof(int16_t);
for (i = 0; i < n_samples; i++)