[FFmpeg-devel] [PATCH 277/281] ffmpeg: convert to new channel layout-API

James Almer jamrial at gmail.com
Thu Jan 13 21:44:55 EET 2022



On 1/13/2022 3:40 PM, James Almer wrote:
> On 1/13/2022 3:29 PM, Michael Niedermayer wrote:
>> On Wed, Jan 12, 2022 at 11:09:09PM -0300, James Almer wrote:
>>> Signed-off-by: James Almer <jamrial at gmail.com>
>>> ---
>>>   fftools/cmdutils.c            | 42 +++++++++++++++---------
>>>   fftools/cmdutils.h            |  8 -----
>>>   fftools/ffmpeg.c              | 47 ++++++++++++++++----------
>>>   fftools/ffmpeg.h              |  7 ++--
>>>   fftools/ffmpeg_filter.c       | 52 ++++++++++++++++++++++-------
>>>   fftools/ffmpeg_opt.c          | 62 ++++++++++++++++++++++++++++++-----
>>>   tests/fate/aac.mak            |  2 +-
>>>   tests/fate/lavf-container.mak |  2 +-
>>>   8 files changed, 155 insertions(+), 67 deletions(-)
>>
>> This or a prior patch introduces crashes (it bisected to this but this 
>> is my
>> 2nd testcase the first did not reproduce reliably at all)
>>
>> Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault.
>> 0x00005555566ed811 in av_vlog (avcl=0x5555577400c0, level=24, 
>> fmt=0x5555568249e8 "%d frames left in the queue on closing\n", 
>> vl=0x7fffffffda50) at libavutil/log.c:428
> 
> av_vlog() is where it crashes?
> 
>> 428        if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
>> (gdb) bt
>> #0  0x00005555566ed811 in av_vlog (avcl=0x5555577400c0, level=24, 
>> fmt=0x5555568249e8 "%d frames left in the queue on closing\n", 
>> vl=0x7fffffffda50) at libavutil/log.c:428
>> #1  0x00005555566ed6bd in av_log (avcl=0x5555577400c0, level=24, 
>> fmt=0x5555568249e8 "%d frames left in the queue on closing\n") at 
>> libavutil/log.c:411
>> #2  0x0000555555c320b9 in ff_af_queue_close (afq=0x5555576c47c8) at 
>> libavcodec/audio_frame_queue.c:39
>> #3  0x0000555555e84c06 in mp3lame_encode_close (avctx=0x5555576bf180) 
>> at libavcodec/libmp3lame.c:86
>> #4  0x0000555555c373f7 in avcodec_close (avctx=0x5555576bf180) at 
>> libavcodec/avcodec.c:489
>> #5  0x0000555555f7feab in avcodec_free_context (pavctx=0x5555576a8858) 
>> at libavcodec/options.c:163
>> #6  0x000055555569cfe3 in ffmpeg_cleanup (ret=1) at fftools/ffmpeg.c:608
>> #7  0x0000555555694817 in exit_program (ret=1) at fftools/cmdutils.c:131
>> #8  0x000055555569ef1f in do_audio_out (of=0x5555576ae2c0, 
>> ost=0x5555576a8800, frame=0x5555576bf580) at fftools/ffmpeg.c:1056
>> #9  0x00005555556a117a in reap_filters (flush=0) at fftools/ffmpeg.c:1546
>> #10 0x00005555556ad8e5 in transcode_step () at fftools/ffmpeg.c:4643
>> #11 0x00005555556ad9e7 in transcode () at fftools/ffmpeg.c:4687
>> #12 0x00005555556ae45c in main (argc=12, argv=0x7fffffffe1c8) at 
>> fftools/ffmpeg.c:4903
>> (gdb) print avc->version
>> Cannot access memory at address 0xc1528eb7c0ea0157
>>
>> make -j32 && gdb --args ./ffmpeg_g -ss 8 -i NeroRecodeSample.mp4 
>> -bitexact -t 3 -filter_complex '[0:2]scale=720:576[v];[v][0:5]overlay' 
>> -y file-whitesubs.avi
>>
>> it appears this file is at:
>> https://samples.ffmpeg.org/MPEG-4/NeroRecodeSample-MP4/
> 
> I can't reproduce this on mingw64.

Does the following fix it for you?

> diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
> index 36ae57eb83..728005b840 100644
> --- a/libavcodec/libmp3lame.c
> +++ b/libavcodec/libmp3lame.c
> @@ -344,9 +344,15 @@ const AVCodec ff_libmp3lame_encoder = {
>                                                               AV_SAMPLE_FMT_S16P,
>                                                               AV_SAMPLE_FMT_NONE },
>      .supported_samplerates = libmp3lame_sample_rates,
> +#if FF_API_OLD_CHANNEL_LAYOUT
>      .channel_layouts       = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
>                                                    AV_CH_LAYOUT_STEREO,
>                                                    0 },
> +#endif
> +    .ch_layouts            = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
> +                                                         AV_CHANNEL_LAYOUT_STEREO,
> +                                                         { 0 },
> +    },
>      .priv_class            = &libmp3lame_class,
>      .defaults              = libmp3lame_defaults,
>      .wrapper_name          = "libmp3lame",


More information about the ffmpeg-devel mailing list