1
Fork 0
pipewire/pipewire-jack
Wim Taymans 3376b96f2a jack: handle concurrent jack_port_get_buffer()
Ardour calls jack_port_get_buffer() from multiple threads. For audio
buffers this will result in mixing the input samples into the target
buffer and there is no window for having a corrupt buffer.

For MIDI, there is a problem because we need to convert from and to
PipeWire MIDI and while we do that from multiple threads, the midi
buffer can be incomplete or corrupt.

Fix this by building the intermediate POD to a thread-local scratch area
and then copy it to the target buffer. If this is done from multiple
threads there is no moment where incomplete data can be seen in the
target buffer.

Make the complete midi-scratch buffer thread_local so that we also avoid
a race when converting midi data from a foreign port.

When we write into the scratch buffer when mixing and converting input
midi data, we also avoid a race there.

Fixes #3632
2023-11-22 16:16:30 +01:00
..
examples treewide: use SPDX tags to specify copyright information 2023-02-16 10:54:48 +00:00
jack Update FSF address 2023-08-07 09:36:59 +00:00
src jack: handle concurrent jack_port_get_buffer() 2023-11-22 16:16:30 +01:00
meson.build