Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JACK midi robustness #203

Merged
merged 1 commit into from
Aug 11, 2021
Merged

Improve JACK midi robustness #203

merged 1 commit into from
Aug 11, 2021

Conversation

jpcima
Copy link
Contributor

@jpcima jpcima commented May 9, 2019

In this work, I try to make buffered Jack output more robust, as I discovered a few annoyances.
It enables some recovery from failures.

  • When a message is written to the ring buffer by sendMessage, the outcome is not checked.
    If a message too big for the remaining buffer is written, and then passes a short message which succeeds, the validity of the message stream following is potentially broken.
    (because the size was communicated onto the size buffer, despite that message data did not go through, or just partial)

  • The call jack_midi_event_reserve can fail with NULL.
    This case should be checked to prevent crashing. In this case, I will discard the buffered event, also permitting the stream to get back on its feet.

- If the MIDI processor cannot reserve the event memory, handle the NULL case
to avoid crashing, and skip data.
- Before writing the ringbuffer, verify it has available size, waiting if needed.
- Implement as a single ringbuffer, to improve memory efficiency.

- If the MIDI processor cannot reserve the event memory, handle the NULL case
to avoid crashing, and skip data.
- Before writing the ringbuffer, verify it has available size, waiting if needed.
- Implement as a single ringbuffer, to improve memory efficiency.
@radarsat1
Copy link
Contributor

Tested with c/qmidiin and midiout

@radarsat1 radarsat1 merged commit a4c7e13 into thestk:master Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants