rem: if (realtime_outputs_rep[n]->prefill_space() > 0) out_latency = (prefill_threshold_rep * buffersize()) + realtime_outputs_rep[n]->latency();
add: if (realtime_outputs_rep[n]->prefill_space() > 0) { long int max_prefill = prefill_threshold_rep * buffersize(); if (max_prefill > realtime_outputs_rep[n]->prefill_space()) { max_prefill = realtime_outputs_rep[n]->prefill_space(); } out_latency = max_prefill + realtime_outputs_rep[n]->latency(); }
context: void ECA_ENGINE::update_cache_latency_values(void){  if (csetup_repp->multitrack_mode() == true) {    long int in_latency = -1;    for(unsigned int n = 0; n < realtime_inputs_rep.size(); n++) {      if (in_latency == -1) {	in_latency = realtime_inputs_rep[n]->latency();      }      else {	if (in_latency != realtime_inputs_rep[n]->latency()) {	  ECA_LOG_MSG(ECA_LOGGER::info, 			"(eca-engine) Warning! Latency mismatch between input objects!");	}      }      ECA_LOG_MSG(ECA_LOGGER::user_objects,		  "(eca-engine) Input latency for '" +		  realtime_inputs_rep[n]->name() + 		  "' is " + kvu_numtostr(in_latency) + ".");    }        long int out_latency = -1;    for(unsigned int n = 0; n < realtime_outputs_rep.size(); n++) {      if (out_latency == -1) {	if (realtime_outputs_rep[n]->prefill_space() > 0)	  out_latency = (prefill_threshold_rep * buffersize()) + realtime_outputs_rep[n]->latency();	else	  out_latency = realtime_outputs_rep[n]->latency();      }      else {	if (realtime_outputs_rep[n]->prefill_space() > 0 && 	    out_latency != (prefill_threshold_rep * buffersize()) + realtime_outputs_rep[n]->latency() || 	    realtime_outputs_rep[n]->prefill_space() == 0 &&	    out_latency != realtime_outputs_rep[n]->latency()) {	  ECA_LOG_MSG(ECA_LOGGER::info, 			"(eca-engine) Warning! Latency mismatch between output objects!");	}      }      ECA_LOG_MSG(ECA_LOGGER::user_objects,		  "(eca-engine) Output latency for '" +		  realtime_outputs_rep[n]->name() + 		  "' is " + kvu_numtostr(out_latency) + ".");    }    recording_offset_rep = (out_latency > in_latency ? 			    out_latency : in_latency);        if (recording_offset_rep % buffersize()) {      ECA_LOG_MSG(ECA_LOGGER::info, 		    "(eca-engine) Warning! Recording offset not divisible with chainsetup buffersize.");    }        ECA_LOG_MSG(ECA_LOGGER::user_objects,		  "(eca-engine) recording offset is " +		  kvu_numtostr(recording_offset_rep) +		  	" samples.");  }  else {    recording_offset_rep = 0;  }}