13
0

fix port-unregister (on failed latency measurement)

This commit is contained in:
Robin Gareus 2014-06-18 20:53:43 +02:00
parent a0392a2349
commit 157161e482

View File

@ -1110,11 +1110,13 @@ AudioEngine::start_latency_detection (bool for_midi)
const string portname ("latency_in"); const string portname ("latency_in");
if ((_latency_input_port = pe.register_port (portname, DataType::MIDI, IsInput)) == 0) { if ((_latency_input_port = pe.register_port (portname, DataType::MIDI, IsInput)) == 0) {
pe.unregister_port (_latency_input_port);
pe.unregister_port (_latency_output_port); pe.unregister_port (_latency_output_port);
stop (true); stop (true);
return -1; return -1;
} }
if (pe.connect (_latency_input_name, make_port_name_non_relative (portname))) { if (pe.connect (_latency_input_name, make_port_name_non_relative (portname))) {
pe.unregister_port (_latency_input_port);
pe.unregister_port (_latency_output_port); pe.unregister_port (_latency_output_port);
stop (true); stop (true);
return -1; return -1;
@ -1136,11 +1138,13 @@ AudioEngine::start_latency_detection (bool for_midi)
const string portname ("latency_in"); const string portname ("latency_in");
if ((_latency_input_port = pe.register_port (portname, DataType::AUDIO, IsInput)) == 0) { if ((_latency_input_port = pe.register_port (portname, DataType::AUDIO, IsInput)) == 0) {
pe.unregister_port (_latency_input_port);
pe.unregister_port (_latency_output_port); pe.unregister_port (_latency_output_port);
stop (true); stop (true);
return -1; return -1;
} }
if (pe.connect (_latency_input_name, make_port_name_non_relative (portname))) { if (pe.connect (_latency_input_name, make_port_name_non_relative (portname))) {
pe.unregister_port (_latency_input_port);
pe.unregister_port (_latency_output_port); pe.unregister_port (_latency_output_port);
stop (true); stop (true);
return -1; return -1;