Fix port-connection callbacks on engine restart

When the engine is restarted, ports are re-established,
and previously queued port-connections need to be cleared.

This caused a bug:
 * when the engine is stopped all ports are disconnected.
   _port_connection_queue contains all disconnections
 * engine is stopped so _port_connection_queue is not processed
 * engine-restart re-etablishes ports and appends those connections
   to _port_connection_queue
 * process-callback processes the list in **reverse** order
```
   while (!_port_connection_queue.empty ()) {
      _port_connection_queue.pop_back ();
   }
```
 * ARDOUR::PortManager::connect_callback() is first called
   with connected() and the disconnected()
 * All ports are assumed to not be connected
   Port::_externally_connected == 0 for all ports

Result:

 * vari-speed playback resampling does not work (only external
   I/O is reampled), split cycles processing (looping) fails
   since AudioPort::get_audio_buffer() does not apply the
   _global_port_buffer_offset
This commit is contained in:
Robin Gareus 2020-09-05 23:05:18 +02:00
parent a80064981e
commit b40826792a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -435,6 +435,10 @@ PortEngineSharedImpl::clear_ports ()
_ports.flush ();
_portmap.flush ();
pthread_mutex_lock (&_port_callback_mutex);
_port_change_flag = false;
_port_connection_queue.clear();
pthread_mutex_unlock (&_port_callback_mutex);
}
uint32_t