Opened 11 years ago

Closed 11 years ago

#2095 closed defect (fixed)

memleak in aac decoder

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: aac leak
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I can reproduce a memleak in the AAC decoder with the sample and command line from ticket #2088:

$ valgrind --leak-check=full ./ffmpeg_g -acodec aac -i dvdsub.vob -vn -f null -
==7301== Memcheck, a memory error detector
==7301== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==7301== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==7301== Command: ffmpeg_g -acodec aac -i dvdsub.vob -vn -f null -
==7301==
ffmpeg version N-48385-g5ed5e90 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  1 2013 21:30:44 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 59.100 / 54. 59.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[aac @ 0x69b9700] get_buffer() failed
[aac @ 0x69b9700] More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x69b9700] get_buffer() failed
    Last message repeated 1 times
[aac @ 0x69b9700] channel element 2.0 is not allocated
[aac @ 0x69b9700] Number of bands (60) exceeds limit (40).
[aac @ 0x69b9700] channel element 2.15 is not allocated
[aac @ 0x69b9700] channel element 1.12 is not allocated
[aac @ 0x69b9700] channel element 3.14 is not allocated
[aac @ 0x69b9700] skip_data_stream_element: Input buffer exhausted before END element found
[aac @ 0x69b9700] channel element 1.7 is not allocated
[aac @ 0x69b9700] channel element 2.1 is not allocated
[aac @ 0x69b9700] channel element 1.6 is not allocated
[aac @ 0x69b9700] channel element 1.3 is not allocated
[aac @ 0x69b9700] channel element 2.7 is not allocated
[aac @ 0x69b9700] channel element 3.9 is not allocated
[aac @ 0x69b9700] Reserved bit set.
    Last message repeated 1 times
[aac @ 0x69b9700] Sample rate index in program config element does not match the sample rate index configured by the container.
    Last message repeated 1 times
[aac @ 0x69b9700] Not evaluating a further program_config_element as this construct is dubious at best.
[aac @ 0x69b9700] Prediction is not allowed in AAC-LC.
[aac @ 0x69b9700] channel element 3.12 is not allocated
[aac @ 0x69b9700] channel element 2.6 is not allocated
[aac @ 0x69b9700] channel element 1.8 is not allocated
[mpeg @ 0x66c6e40] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from 'dvdsub.vob':
  Duration: 00:00:07.97, start: 1556.319267, bitrate: 5263 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x80]: Audio: aac, 24000 Hz, mono, fltp, 360 kb/s
    Stream #0:2[0x20]: Subtitle: dvd_subtitle
    Stream #0:3[0x22]: Subtitle: dvd_subtitle
    Stream #0:4[0x24]: Subtitle: dvd_subtitle
    Stream #0:5[0x25]: Subtitle: dvd_subtitle
    Stream #0:6[0x26]: Subtitle: dvd_subtitle
    Stream #0:7[0x28]: Subtitle: dvd_subtitle
    Stream #0:8[0x29]: Subtitle: dvd_subtitle
    Stream #0:9[0x21]: Subtitle: dvd_subtitle
    Stream #0:10[0x23]: Subtitle: dvd_subtitle
    Stream #0:11[0x27]: Subtitle: dvd_subtitle
    Stream #0:12[0x2a]: Subtitle: dvd_subtitle
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf54.59.100
    Stream #0:0: Audio: pcm_s16le, 24000 Hz, mono, s16, 384 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
[aac @ 0x69b9700] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x69b9700] channel element 3.4 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x69b9700] channel element 3.11 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Dependent coupling is not supported together with LTP
    Last message repeated 11 times
Multiple frames in a packet from stream 1
[aac @ 0x69b9700] channel element 0.5 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 2.0 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Number of bands (60) exceeds limit (40).
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 2.15 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 1.12 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 3.14 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] skip_data_stream_element: Input buffer exhausted before END element found
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 1.7 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 2.1 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Prediction is not allowed in AAC-LC.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x69b9700] Number of bands (46) exceeds limit (44).
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 2.7 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 3.9 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Reserved bit set.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x69b9700] Reserved bit set.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x69b9700] Sample rate index in program config element does not match the sample rate index configured by the container.
    Last message repeated 1 times
[aac @ 0x69b9700] Not evaluating a further program_config_element as this construct is dubious at best.
[aac @ 0x69b9700] Prediction is not allowed in AAC-LC.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x69b9700] channel element 3.12 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 2.6 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 1.8 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Dependent coupling is not supported together with LTP
    Last message repeated 35 times
[aac @ 0x69b9700] channel element 2.14 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Dependent coupling is not supported together with LTP
    Last message repeated 11 times
[aac @ 0x69b9700] Number of bands (61) exceeds limit (45).
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 3.2 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Reserved bit set.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x69b9700] channel element 3.6 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Reserved bit set.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x69b9700] channel element 2.9 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 2.4 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 1.10 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 2.2 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 1.8 is not allocated
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x69b9700] Number of bands (4) exceeds limit (3).
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] Number of bands (43) exceeds limit (23).
Error while decoding stream #0:1: Operation not permitted
[aac @ 0x69b9700] channel element 3.13 is not allocated
Error while decoding stream #0:1: Operation not permitted
size=N/A time=00:00:04.07 bitrate=N/A
video:0kB audio:2kB subtitle:0 global headers:0kB muxing overhead -101.074219%
==7301==
==7301== HEAP SUMMARY:
==7301==     in use at exit: 4,008 bytes in 16 blocks
==7301==   total heap usage: 4,168 allocs, 4,152 frees, 45,004,678 bytes allocated
==7301==
==7301== 168 bytes in 1 blocks are definitely lost in loss record 1 of 4
==7301==    at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0xBB8031: av_mallocz (mem.c:92)
==7301==    by 0x99AB05: avcodec_fill_audio_frame (utils.c:322)
==7301==    by 0x99AE64: avcodec_default_get_buffer (utils.c:360)
==7301==    by 0xA84A7E: output_configure (aacdec.c:189)
==7301==    by 0xA86F40: aac_decode_frame_int (aacdec.c:2548)
==7301==    by 0xA884A2: aac_decode_frame (aacdec.c:2670)
==7301==    by 0x99DD4E: avcodec_decode_audio4 (utils.c:1743)
==7301==    by 0x595173: try_decode_frame (utils.c:2482)
==7301==    by 0x59C755: avformat_find_stream_info (utils.c:2889)
==7301==    by 0x454C80: open_input_file (ffmpeg_opt.c:794)
==7301==
==7301== 504 bytes in 3 blocks are definitely lost in loss record 2 of 4
==7301==    at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0xBB8031: av_mallocz (mem.c:92)
==7301==    by 0x99AB05: avcodec_fill_audio_frame (utils.c:322)
==7301==    by 0x99AE64: avcodec_default_get_buffer (utils.c:360)
==7301==    by 0xA85EF3: aac_decode_frame_int (aacdec.c:189)
==7301==    by 0xA884A2: aac_decode_frame (aacdec.c:2670)
==7301==    by 0x99DD4E: avcodec_decode_audio4 (utils.c:1743)
==7301==    by 0x595173: try_decode_frame (utils.c:2482)
==7301==    by 0x59C755: avformat_find_stream_info (utils.c:2889)
==7301==    by 0x454C80: open_input_file (ffmpeg_opt.c:794)
==7301==    by 0x45349F: open_files.isra.6 (ffmpeg_opt.c:2295)
==7301==
==7301== 1,128 bytes in 4 blocks are definitely lost in loss record 3 of 4
==7301==    at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0xBB8031: av_mallocz (mem.c:92)
==7301==    by 0x99AB05: avcodec_fill_audio_frame (utils.c:322)
==7301==    by 0x99AE64: avcodec_default_get_buffer (utils.c:360)
==7301==    by 0xA84A7E: output_configure (aacdec.c:189)
==7301==    by 0xA86F40: aac_decode_frame_int (aacdec.c:2548)
==7301==    by 0xA884A2: aac_decode_frame (aacdec.c:2670)
==7301==    by 0x99DD4E: avcodec_decode_audio4 (utils.c:1743)
==7301==    by 0x45F8EC: decode_audio (ffmpeg.c:1467)
==7301==    by 0x4622B5: process_input (ffmpeg.c:1787)
==7301==    by 0x45194F: main (ffmpeg.c:2980)
==7301==
==7301== 2,208 bytes in 8 blocks are definitely lost in loss record 4 of 4
==7301==    at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7301==    by 0xBB8031: av_mallocz (mem.c:92)
==7301==    by 0x99AB05: avcodec_fill_audio_frame (utils.c:322)
==7301==    by 0x99AE64: avcodec_default_get_buffer (utils.c:360)
==7301==    by 0xA85EF3: aac_decode_frame_int (aacdec.c:189)
==7301==    by 0xA884A2: aac_decode_frame (aacdec.c:2670)
==7301==    by 0x99DD4E: avcodec_decode_audio4 (utils.c:1743)
==7301==    by 0x45F8EC: decode_audio (ffmpeg.c:1467)
==7301==    by 0x4622B5: process_input (ffmpeg.c:1787)
==7301==    by 0x45194F: main (ffmpeg.c:2980)
==7301==
==7301== LEAK SUMMARY:
==7301==    definitely lost: 4,008 bytes in 16 blocks
==7301==    indirectly lost: 0 bytes in 0 blocks
==7301==      possibly lost: 0 bytes in 0 blocks
==7301==    still reachable: 0 bytes in 0 blocks
==7301==         suppressed: 0 bytes in 0 blocks
==7301==
==7301== For counts of detected and suppressed errors, rerun with: -v
==7301== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 2 from 2)

Change History (6)

comment:1 by Carl Eugen Hoyos, 11 years ago

Another sample is attached to ticket #2529.

comment:2 by Hendrik, 11 years ago

I submitted a patch to the ML which at least fixes part of the leak on the sample from #2529, the sample referenced here seems to no longer be available in its original place for checking.

Sadly the patch does not fix it completely, and i'm at a loss right now to understand where the other memory goes.

Last edited 11 years ago by Hendrik (previous) (diff)

comment:4 by Hendrik, 11 years ago

That sample doesn't seem to leak anything anymore with git master, no patches needed.

comment:5 by Hendrik, 11 years ago

Nevermind, i was wrong, i accidentally tested against my patched version.

The patch i posted completely fixes this sample. Just the one from #2529 left.

comment:6 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: newclosed

Fixed by nevcairiel.

Note: See TracTickets for help on using tickets.