Browse Source

Fix rtaudio crash when there are no system input ports

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
0df641fe9f
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 14 additions and 14 deletions
  1. +14
    -14
      source/modules/rtaudio/RtAudio.cpp

+ 14
- 14
source/modules/rtaudio/RtAudio.cpp View File

@@ -2079,20 +2079,20 @@ bool RtApiJack :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
stream_.sampleRate = jackbridge_get_sample_rate( client );

// Get the latency of the JACK port.
const char **ports;
ports = jackbridge_get_ports( client, "system:", NULL, JackPortIsInput );
if ( ports[ firstChannel ] ) {
// Added by Ge Wang
jack_latency_callback_mode_t cbmode = (mode == INPUT ? JackCaptureLatency : JackPlaybackLatency);
// the range (usually the min and max are equal)
jack_latency_range_t latrange; latrange.min = latrange.max = 0;
// get the latency range
jackbridge_port_get_latency_range( jackbridge_port_by_name( client, ports[firstChannel] ), cbmode, &latrange );
// be optimistic, use the min!
stream_.latency[mode] = latrange.min;
//stream_.latency[mode] = jack_port_get_latency( jackbridge_port_by_name( client, ports[ firstChannel ] ) );
}
jackbridge_free( ports );
if (const char **ports = jackbridge_get_ports( client, "system:", NULL, JackPortIsInput )) {
if ( ports[ firstChannel ] ) {
// Added by Ge Wang
jack_latency_callback_mode_t cbmode = (mode == INPUT ? JackCaptureLatency : JackPlaybackLatency);
// the range (usually the min and max are equal)
jack_latency_range_t latrange; latrange.min = latrange.max = 0;
// get the latency range
jackbridge_port_get_latency_range( jackbridge_port_by_name( client, ports[firstChannel] ), cbmode, &latrange );
// be optimistic, use the min!
stream_.latency[mode] = latrange.min;
//stream_.latency[mode] = jack_port_get_latency( jackbridge_port_by_name( client, ports[ firstChannel ] ) );
}
jackbridge_free( ports );
}

// The jack server always uses 32-bit floating-point data.
stream_.deviceFormat[mode] = RTAUDIO_FLOAT32;


Loading…
Cancel
Save