mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-09 10:06:25 -05:00
netjack2: fix the large midi events offset
The midi events have their large data offsets relative to the start of the buffer and the large data is at the end of the buffer. Because we copied it down, right after the events, but we didn't adjust the offsets, calculate a correction offset when unpacking the events.
This commit is contained in:
parent
d375b374f7
commit
f97e131d96
1 changed files with 4 additions and 2 deletions
|
|
@ -317,6 +317,8 @@ static inline void netjack2_to_midi(float *dst, uint32_t size, struct nj2_midi_b
|
|||
struct spa_pod_builder b = { 0, };
|
||||
uint32_t i;
|
||||
struct spa_pod_frame f;
|
||||
size_t offset = size - buf->write_pos -
|
||||
sizeof(*buf) - (buf->event_count * sizeof(struct nj2_midi_event));
|
||||
|
||||
spa_pod_builder_init(&b, dst, size);
|
||||
spa_pod_builder_push_sequence(&b, &f, 0);
|
||||
|
|
@ -326,8 +328,8 @@ static inline void netjack2_to_midi(float *dst, uint32_t size, struct nj2_midi_b
|
|||
|
||||
if (ev->size <= MIDI_INLINE_MAX)
|
||||
data = ev->buffer;
|
||||
else if (ev->offset > buf->write_pos)
|
||||
data = SPA_PTROFF(buf, ev->offset - buf->write_pos, void);
|
||||
else if (ev->offset > offset)
|
||||
data = SPA_PTROFF(buf, ev->offset - offset, void);
|
||||
else
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue