On Wed, Jan 4, 2023 at 6:18 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote:
> Paul B Mahol: > > diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c > > index 971c861d0e..7923377c8c 100644 > > --- a/libavfilter/af_aresample.c > > +++ b/libavfilter/af_aresample.c > > @@ -209,18 +209,16 @@ FF_ENABLE_DEPRECATION_WARNINGS > > } else { > > outsamplesref->pts = AV_NOPTS_VALUE; > > } > > - n_out = swr_convert(aresample->swr, outsamplesref->extended_data, > n_out, > > - (void *)insamplesref->extended_data, > n_in); > > - if (n_out <= 0) { > > + ret = swr_convert_frame(aresample->swr, outsamplesref, > > + (void *)insamplesref); > > Don't know whether the actual change has advantages, but you should not > It adds better support for runtime change of input/output sample rates. Instead of re-initializing whole filter graph. > cast here. The cast above exists because there is no automatic cast > T**->const T** (it is actually unsafe; we should change swr_convert() to > accept const uint8_t *const * for in and uint8_t *const * for out at the > next major version bump, but even then C requires the cast). There is no > reason for a cast with the new code. > > > + if (ret < 0) { > > av_frame_free(&outsamplesref); > > av_frame_free(&insamplesref); > > - return 0; > > + return ret; > > } > > > > aresample->more_data = outsamplesref->nb_samples == n_out; // > Indicate that there is probably more data in our buffers > > > > - outsamplesref->nb_samples = n_out; > > - > > ret = ff_filter_frame(outlink, outsamplesref); > > av_frame_free(&insamplesref); > > return ret; > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".