[FFmpeg-trac] #3355(documentation:open): mp2 decoding of decoding_encoding.c API example is broken

FFmpeg trac at avcodec.org
Tue Jan 28 16:56:44 CET 2014


#3355: mp2 decoding of decoding_encoding.c API example is broken
-------------------------------------+-------------------------------------
             Reporter:  sdem         |                    Owner:
                 Type:  defect       |                   Status:  open
             Priority:  minor        |                Component:
              Version:  git-master   |  documentation
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  1
-------------------------------------+-------------------------------------

Comment (by sdem):

 The fix is to replace "c->channels" with "1" on line 304 of
 decoding_encoding.c.

 That's because decoded_frame->data[0] only contains data for 1 channel,
 not for both.
 After the fix, the output (test.sw) is as expected, and valgrind doesn't
 mention any more memory addressing error.
 Also, the output is now stable, as expected.

 ==27570== Memcheck, a memory error detector
 ==27570== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
 ==27570== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for
 copyright info
 ==27570== Command: ./decoding_encoding mp2
 ==27570==
 Encode audio file test.mp2
 Decode audio file test.mp2 to test.sw
 ==27570==
 ==27570== HEAP SUMMARY:
 ==27570==     in use at exit: 40 bytes in 1 blocks
 ==27570==   total heap usage: 1,429 allocs, 1,428 frees, 165,246 bytes
 allocated
 ==27570==
 ==27570== LEAK SUMMARY:
 ==27570==    definitely lost: 0 bytes in 0 blocks
 ==27570==    indirectly lost: 0 bytes in 0 blocks
 ==27570==      possibly lost: 0 bytes in 0 blocks
 ==27570==    still reachable: 40 bytes in 1 blocks
 ==27570==         suppressed: 0 bytes in 0 blocks
 ==27570== Rerun with --leak-check=full to see details of leaked memory
 ==27570==
 ==27570== For counts of detected and suppressed errors, rerun with: -v
 ==27570== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)

 $ ./decoding_encoding mp2
 Encode audio file test.mp2
 Decode audio file test.mp2 to test.sw
 $ md5sum test.*
 ca203ada0aa42372edead60fd4dd928b  test.mp2
 359318db3ed158e6d6b2f55ebd3f15a3  test.sw
 $ ./decoding_encoding mp2
 Encode audio file test.mp2
 Decode audio file test.mp2 to test.sw
 $ md5sum test.*
 ca203ada0aa42372edead60fd4dd928b  test.mp2
 359318db3ed158e6d6b2f55ebd3f15a3  test.sw

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3355#comment:7>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list