17.05.2009, в 4:23, Alexandr Kutuzov написал(а):
Hello,
i`m trying to replace avcodec_decode_audio2 with
avcodec_decode_audio3, and now have several issues with packet
decoding like this:
recoded(50664,0xa0421720) malloc: *** error for object 0x180c9a6:
Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
debugger tolds that it caused somewere inside of av_free_packet, but
i think it`s my mistake in usage of AVPacket or not?
code:
// somewere in class declaration
AVFormatContext *aFormatCtx;
AVCodecContext *aCodecCtx;
AVCodec *aCodec;
AVPacket packet;
// decoder class member
int decoder::doDecode()
{
int16_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2];
int audio_buf_size;
int len;
while(av_read_frame(aFormatCtx, &packet)>=0) {
if(packet.stream_index==audioStream) {
while (packet.size>0) {
audio_buf_size = sizeof(audio_buf);
av_init_packet(&packet); // have solved my problem. Is it
ugly hack?
len = avcodec_decode_audio3(aCodecCtx, audio_buf,
&audio_buf_size, &packet);
if(len < 0) break;
packet.data += len;
packet.size -= len;
o_buff->push(audio_buf, audio_buf_size);
}
}
av_free_packet(&packet);
}
avcodec_close(aCodecCtx);
av_close_input_file(aFormatCtx);
return 0;
}
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user