aresample->out_rate = outlink->sample_rate;
else
outlink->sample_rate = aresample->out_rate;
+ outlink->time_base = (AVRational) {1, aresample->out_rate};
//TODO: make the resampling parameters configurable
aresample->resample = av_resample_init(aresample->out_rate, inlink->sample_rate,
aresample->outsamplesref =
avfilter_get_audio_buffer(outlink, AV_PERM_WRITE, requested_out_nb_samples);
- avfilter_copy_buffer_ref_props(aresample->outsamplesref, insamplesref);
- aresample->outsamplesref->pts =
- insamplesref->pts / inlink->sample_rate * outlink->sample_rate;
- aresample->outsamplesref->audio->sample_rate = outlink->sample_rate;
outlink->out_buf = aresample->outsamplesref;
}
+ avfilter_copy_buffer_ref_props(aresample->outsamplesref, insamplesref);
+ aresample->outsamplesref->audio->sample_rate = outlink->sample_rate;
+ aresample->outsamplesref->pts =
+ av_rescale(outlink->sample_rate, insamplesref->pts, inlink->sample_rate);
+
/* av_resample() works with planar audio buffers */
if (!inlink->planar && nb_channels > 1) {
int16_t *out[8];