netjack2: copy large midi events to the end of the buffer

There is no need to keep an extra free byte at the end and it will cause
us to lose a byte when we copy the large midi events down.
This commit is contained in:
Wim Taymans 2025-03-19 13:06:15 +01:00
parent 795e917716
commit 3be88eacb8

View file

@ -263,7 +263,7 @@ static inline void *n2j_midi_buffer_reserve(struct nj2_midi_buffer *buf,
if (used_size + size > buf->buffer_size) if (used_size + size > buf->buffer_size)
return NULL; return NULL;
buf->write_pos += size; buf->write_pos += size;
ev->offset = buf->buffer_size - 1 - buf->write_pos; ev->offset = buf->buffer_size - buf->write_pos;
ptr = SPA_PTROFF(buf, ev->offset, void); ptr = SPA_PTROFF(buf, ev->offset, void);
} }
buf->event_count++; buf->event_count++;