我正在尝试编译并运行ffmpeg 1.2中的resampling_audio.c。好像有一个bug和代码段错误。我调试了代码,它似乎崩溃了
/* convert to destination format */
ret = swr_convert(swr_ctx, dst_data, dst_nb_samples, (const uint8_t **)src_data, src_nb_samples);
if (ret < 0) {
fprintf(stderr, "Error while converting\n");
goto end;
}
dst_bufsize = av_samples_get_buffer_size(&dst_linesize, dst_nb_channels,
ret, dst_sample_fmt, 1);
堆栈跟踪
#0 malloc_consolidate (av=0xb7f6f440) at malloc.c:4251
#1 malloc_consolidate (av=0xb7f6f440) at malloc.c:4203
#2 0xb7e4122f in _int_malloc (av=0xb7f6f440, bytes=8248) at malloc.c:3543
#3 0xb7e42418 in _int_memalign (av=0xb7f6f440, alignment=32, bytes=8192) at malloc.c:4503
#4 0xb7e446a0 in __GI___libc_memalign (alignment=32, bytes=8192) at malloc.c:3104
#5 0xb7e45714 in __posix_memalign (memptr=memptr@entry=0xbfffed7c, alignment=alignment@entry=32, size=size@entry=8192) at malloc.c:5049
#6 0x0805c0d8 in av_malloc (size=8192) at libavutil/mem.c:93
#7 av_mallocz (size=size@entry=8192) at libavutil/mem.c:207
#8 0x0804c35a in swri_realloc_audio (a=a@entry=0x807b860, count=2048, count@entry=1024) at libswresample/swresample.c:462
#9 0x0804cc65 in swr_convert_internal (s=s@entry=0x807a180, out=out@entry=0x807ba28, out_count=out_count@entry=941, in=in@entry=0x807b7c8, in_count=in_count@entry=1024) at libswresample/swresample.c:624
#10 0x0804da18 in memset (__len=<optimized out>, __dest=<optimized out>, __ch=<optimized out>) at /usr/include/i386-linux-gnu/bits/string3.h:85
#11 fill_audiodata (out=<optimized out>, in_arg=<optimized out>) at libswresample/swresample.c:492
#12 fill_audiodata (in_arg=0x8093360, out=0x807ba28) at libswresample/swresample.c:735
#13 swr_convert (s=0x807a180, out_arg=0x8093360, out_count=941, in_arg=0x8092300, in_count=1024) at libswresample/swresample.c:773
#14 0x0804bd5d in main (argc=2, argv=0xbffff2e4) at resampling_audio.c:194