[FFmpeg-devel] [PATCH] swresample fixes

Michael Niedermayer michael at niedermayer.cc
Thu Jan 5 22:21:50 EET 2023


On Wed, Jan 04, 2023 at 05:59:14PM +0100, Paul B Mahol wrote:
> Patches attached.

[...]
>  af_aresample.c |   10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> e517e6bf054deb40fe9ff16f6ce6585c6a1fb284  0001-avfilter-af_aresample-switch-to-convert-frame-API.patch
> From fe951a82dc6c75eced5b306a11ea5462a245c4c3 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda at gmail.com>
> Date: Wed, 4 Jan 2023 17:13:16 +0100
> Subject: [PATCH 1/3] avfilter/af_aresample: switch to convert frame API
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/af_aresample.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> 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);
> +    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;
> -- 
> 2.37.2

This breaks libswresample with soxr
exmple:
ffmpeg  -loglevel error -y -f s32le -acodec pcm_s32le -ar 96000 -ac 1 -i ref-96000.raw -af aresample=osr=44100:resampler=soxr:cutoff=.903:precision=24:cheby=1 -f s32le -acodec pcm_s32le 96000-44100.raw

before it shows no errors
after it shows:
...
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 285242 >= 285242
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 286690 >= 286690
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 288138 >= 288138
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 289586 >= 289586
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 291034 >= 291034
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 291758 >= 291758
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 293206 >= 293206
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 294654 >= 294654
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 296102 >= 296102
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 297550 >= 297550
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 298998 >= 298998
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 300446 >= 300446
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 301170 >= 301170
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 302617 >= 302617
[s32le @ 0x55b8463eb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 304065 >= 304065
...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230105/4a0ba81d/attachment.sig>


More information about the ffmpeg-devel mailing list