return;
}
+ assert(duration<double>(ts.time_since_epoch()).count() >= 0.0);
+
bool good_sample = (rate_adjustment_policy == ADJUST_RATE);
if (good_sample && a1.good_sample) {
a0 = a1;
// good point. Note that we could be extrapolating backward or
// forward, depending on the timing of the calls.
const InputPoint &base_point = a1.good_sample ? a1 : a0;
+ assert(duration<double>(base_point.ts.time_since_epoch()).count() >= 0.0);
+
+ // NOTE: Due to extrapolation, input_samples_received can
+ // actually go negative here the few first calls (ie., we asked
+ // about a timestamp where we hadn't actually started producing
+ // samples yet), but that is harmless.
const double input_samples_received = base_point.input_samples_received +
current_estimated_freq_in * duration<double>(ts - base_point.ts).count();
if (rcorr < 0.95) rcorr = 0.95;
assert(!isnan(rcorr));
vresampler.set_rratio(rcorr);
- } else {
- assert(rate_adjustment_policy == DO_NOT_ADJUST_RATE);
}
// Finally actually resample, producing exactly <num_samples> output samples.
fprintf(stderr, "Card %u: PANIC: Out of input samples to resample, still need %d output samples! (correction factor is %f)\n",
card_num, int(vresampler.out_count), rcorr);
memset(vresampler.out_data, 0, vresampler.out_count * num_channels * sizeof(float));
+
+ // Reset the loop filter.
+ z1 = z2 = z3 = 0.0;
+
return false;
}