Changes between Initial Version and Version 1 of Ticket #527, comment 4


Ignore:
Timestamp:
Oct 21, 2011, 8:28:50 AM (8 years ago)
Author:
jjlee3
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #527, comment 4

    initial v1  
    1 I found the same problem.
    2 I modified the ffmpeg/doc/eamples/decoding_encoding.c function audio_decode_example to test it.
    3 
    4 {{{
    5 #define AUDIO_PACKET(x) { x, sizeof(x) }
    6 
    7 static uint8_t audioData01[] = {
    8 0x3A,0x0B,0x6D,0x29,0xCB,0x6B,0x5E,0x6B,0x10,0xFB,0x54,0x95,0xB5,0x65,0x94,0x66,
    9 0x12,0x6A,0xDE,0x30,0x60,0x6F,0xDD,0x71,0x31,0xCB,0xA5,0xBB,0x14,0x82,0xA7,0x22,
    10 0xE9,0x5C,0x55,0x89,0x9A,0x12,0x64,0x4D,0x3E,0x11,0xE1,0x2C,0x35,0x3A,0x8E,0xCA,
    11 0x4D,0x2B,0xC3,0xEE,0xC5,0x03,0x70,0xD8,0xDD,0x33,0x9B,0x8A,0x53,0x0D,0xD2,0x54,
    12 0xB9,0x0C,0x45,0xB6,0xD4,0xB7,0x3D,0xD0,0x88,0x1A,0x5F,0x93,0x76,0x69,0x64,0x2D,
    13 0x89,0x37,0xB9,0x54,0x48,0x74,0x6E,0x29,0xFE,0x50,0x64,0xD4,0x29,0x4C,0xDD,0xF2,
    14 0x21,0xBA,0xB9,0x59,0x59,0xEA,0xC0,0x9F,0x3B,0x11,0xDE,0x9E,0xA0,0xA5,0x3F,0x3B,
    15 0x33,0xE5,0x45,0xE9,0x8A,0x44,0x06,0x37,0x5A,0xED,0x36,0xA5,0x6A,0x53,0xD3,0xD4,
    16 0xFB,0x1A,0xC6,0xD4,0xD9,0xF1,0x5C,0x09,0x09,0xEB,0x9A,0x7C,0x58,0xE9,0x14,0x09,
    17 0x43,0x46,0xDE,0xC9,0xC6,0x3A,0x50,0x63,0x21,0xD3,0x51,0x6B,0x62,0x06,0xD8,0xE0,
    18 0x0F,0x80,0x52,0x55,0xA3,0xFC,0xDF,0xCF,0x22,0x34,0xC7,0x31,0xB2,0x46,0xCB,0xBC,
    19 0xCC,0x97,0xD0,0xC9,0xE5,0x32,0x94,0xB7,0xA8,0x5E,0xD2,0xCC,0x46,0x6D,0xA2,0x74,
    20 0x3C,0x13,0x67,0x49,0xC9,0xB5,0x44,0x2C,0x85,0xFB,0x9E,0x6C,0xB8,0xE1,0x06,0x25,
    21 0x31,0xD7,0x85,0xDD,0xE6,0xE4,0xF3,0x5E,0xB2,0x21,0xA7,0xAA,0x4C,0xD3,0xE4,0x02,
    22 0x60,0x02,0x35,0x55,0x03,0xC0,0xFF,0xD8,0x59,0x1F,0x66,0xAF,0xC7,0xB2,0x6A,0x15,
    23 0x3F,0xFE,0xC4,0x0D,0xCD,0xF9,0xBB,0xB6,0x76,0xA9,0x2A,0x33,0x3B,0x8B,0x9E,0x3A,
    24 0xB9,0x14,0xE6,0x35,0x7C,0x77,0x4D,0xAD,0x90,0xE9,0xE0,0x8B,0x76,0xE9,0x56,0x6C,
    25 0x7C,0xAA,0x68,0x56,0x23,0xCB,0x22,0xC4,0xBB,0xFE,0xD9,0xA2,0xBD,0x3B,0x48,0xFB,
    26 0x30,0x8F,0xA6,0x41,0x1A,0x7C,0x87,0xE1,0x26,0x5E,0xB1,0xD0,0x02,0x6D,0x9A,0x56,
    27 0xAC,0x33,0x5B,0x07,0x31,0x46,0x36,0x9E,0xC6,0xDE,0xA5,0x9A,0x65,0x26,0x53,0xE4,
    28 0xFB,0x22,0x06,0xBD,0x8D,0x35,0x4D,0xCD,0x14,0xF7,0xD4,0xA4,0xB5,0x65,0xC5,0xEC,
    29 0xBB,0x85,0x0A,0x4A,0xA3,0x8C,0x6E,0x17,0x46,0xED,0x5D,0xC2,0x0D,0xA8,0x97,0x63,
    30 0xD8,0x9C,0x69,0xBE,0x4A,0xDF,0x73,0xB9,0x22,0xD3,0xA5,0x77,0xA2,0xA0,0xBA,0x66,
    31 0xAE,0xB3,0xA5,0x49,0x75,0x81,0x6E,0x21,0x99,0xE4,0xAA,0xA6,0xAD,0xA6,0xAE,0xB2,
    32 0xFC,0x13,0x8C,0xCC,0xCB,0x69,0x4D,0xCE,0x88,0xFA,0xDA,0x8C,0x55,0xED,0x34,0xED,
    33 0x88,0x35,0xE7,0x27,0xB7,0x44,0xAF,0x3C,0xB2,0xC0,0xF0,0x2A,0x2F,0xF3,0x1A,0xD2,
    34 0xD8,0xB2,0x55,0xC5,0xB3,0x4E,0x36,0x91,0x0D,0xD2,0x8D,0x64,0xA1,0x2D,0xA7,0x25,
    35 0x55,0xE8,0x46,0x3A,0x47,0xFC,0x74,0x5B,0xB7,0xF7,0xC1,0x2A,0xED,0x4C,0x81,0xD1,
    36 0xFC,0x13,0x08,0xC5,0xD9,0x6B,0x35,0x91,0x8C,0xCB,0x9E,0x84,0x57,0x69,0xF6,0xCD,
    37 0xC4,0x89,0x27,0x68,0x2A,0x5A,0x25,0xB8,0xF5,0x6F,0xCB,0xAF,0x9B,0x7B,0x29,0xB5,
    38 0x3C,0x31,0x53,0xC3,0x64,0x28,0xED,0x5F,0xC3,0x73,0x25,0xDD,0x01,0x95,0x81,0x4F,
    39 0x88,0x69,0xA0,0x51,0xAF,0x5E,0x5B,0xCF,0xAD,0x07,0x40,0x35,0x3B,0xDD,0x3F,0xE0,
    40 };
    41 // you can defined audioData02, audioData03, ...
    42 
    43 struct AudioPacket {
    44     uint8_t* data;
    45     int      size;
    46 };
    47 
    48 AudioPacket audioPacket[] = {
    49     AUDIO_PACKET(audioData01),
    50 };
    51 
    52 static void audio_decode_example()
    53 {
    54     AVCodec*        codec;
    55     AVCodecContext* c;
    56     uint8_t         inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
    57     AVPacket        avpkt;
    58     int             outbuf_size, out_size, len;
    59     uint8_t*        outbuf;
    60 
    61     codec = avcodec_find_decoder(CODEC_ID_NELLYMOSER);
    62     assert(codec);
    63     c = avcodec_alloc_context3(codec);
    64     assert(c);
    65     if (avcodec_open2(c, codec, NULL) < 0) { assert(false); }
    66 
    67     outbuf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
    68     outbuf = (uint8_t*)av_malloc(outbuf_size);
    69 
    70     for (int i = 0; i < _countof(audioPacket); ++i) {
    71         av_init_packet(&avpkt);
    72         memcpy(inbuf, audioPacket[i].data, audioPacket[i].size);
    73         memset(&inbuf[audioPacket[i].size], 0, FF_INPUT_BUFFER_PADDING_SIZE);
    74         avpkt.data = inbuf;
    75         avpkt.size = audioPacket[i].size;
    76 
    77         out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
    78         len = avcodec_decode_audio3(c, reinterpret_cast<int16_t*>(outbuf),
    79             &out_size, &avpkt);
    80         assert (len >= 0);
    81         assert(len == avpkt.size); // only for nellymoser
    82         assert(c->frame_size);
    83     }
    84 
    85     av_free(outbuf);
    86     avcodec_close(c);
    87     av_free(c);
    88 }
    89 }}}
    90 
    91 I always got an assert for "assert(c->frame_size);".
     1Sorry!