GST_LOG ("need %d = %d + %d + %d, avail %d = %d + %d", (gint) need,
resampler->n_taps, resampler->samp_index, resampler->skip,
(gint) avail, (gint) resampler->samples_avail, (gint) in_frames);
- if (avail < need)
+ if (avail < need) {
+ GST_LOG ("avail %d < need %d", (int) avail, (int) need);
return 0;
+ }
out = (avail - need) * resampler->out_rate;
- if (out < resampler->samp_phase)
+ if (out < resampler->samp_phase) {
+ GST_LOG ("out %d < samp_phase %d", (int) out, (int) resampler->samp_phase);
return 0;
+ }
out = ((out - resampler->samp_phase) / resampler->in_rate) + 1;
GST_LOG ("out %d = ((%d * %d - %d) / %d) + 1", (gint) out,
resampler->samples_avail = samples_avail += in_frames;
need = resampler->n_taps + resampler->samp_index;
- if (G_UNLIKELY (samples_avail < need)) {
+ if (G_UNLIKELY (samples_avail < need || out_frames == 0)) {
+ GST_LOG ("not enough samples to start: need %" G_GSIZE_FORMAT ", avail %"
+ G_GSIZE_FORMAT ", out %" G_GSIZE_FORMAT, samples_avail, need,
+ out_frames);
/* not enough samples to start */
return;
}