fix: guard against NULL audio ports and defer channel activation until port registration succeeds
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
@@ -35,6 +35,12 @@ int process_callback(jack_nframes_t nframes, void *arg)
|
||||
for (int c = 0; c < MAX_CHANNELS; c++) {
|
||||
if (!channels[c].active) continue;
|
||||
|
||||
/* Guard against NULL ports (e.g. if port registration failed) */
|
||||
if (!channels[c].audio_in || !channels[c].audio_out) {
|
||||
fprintf(stderr, "WARN: channel %d has NULL audio port(s), skipping\n", c);
|
||||
continue;
|
||||
}
|
||||
|
||||
jack_default_audio_sample_t *in = (jack_default_audio_sample_t *)
|
||||
jack_port_get_buffer(channels[c].audio_in, nframes);
|
||||
jack_default_audio_sample_t *out = (jack_default_audio_sample_t *)
|
||||
|
||||
Reference in New Issue
Block a user