[FFmpeg-trac] #441(avcodec:new): MPEG audio decoder prints "incorrect frame size" error for valid code
FFmpeg
trac at avcodec.org
Wed Sep 7 01:30:36 CEST 2011
#441: MPEG audio decoder prints "incorrect frame size" error for valid code
---------------------------------+----------------------------------
Reporter: chrisr | Type: defect
Status: new | Priority: normal
Component: avcodec | Version: 0.7.3
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
---------------------------------+----------------------------------
Decoding an MP3 audio stream (CODEC_ID_MP3) using libavcodec and libavutil
is creating lots of messages like these:
[mp3 @ 0xad218660] incorrect frame size
[mp3 @ 0xad218660] incorrect frame size
[mp3 @ 0xad218660] incorrect frame size
[mp3 @ 0xad218660] incorrect frame size
[mp3 @ 0xad218660] incorrect frame size
However, the audio is playing fine, so there can't really be an error
here. The application is funnelling an audio stream into
avcodec_decode_audio3(), and is just expecting the function to consume as
many bytes as it needs each time:
In simplified form:
{{{
uint8_t *buffer_offset = buffer;
while (buffer_size > 0) {
av_init_packet(&avpkt);
avpkt.data = buffer_offset;
avpkt.size = buffer_size;
bytes_consumed = avcoded_decode_audio3(context, output_buffer,
&output_size, &avpkt);
if (bytes_consumed < 0) {
// Error handling
return;
}
/* Send decoded output to device */
buffer_size -= bytes_consumed;
buffer_offset += bytes_consumed;
}
}}}
The spurious error message is coming from decode_frame() in
libavcodec/mpegaudiodec.c: line 1977
{{{
}else if(s->frame_size < buf_size){
av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n");
buf_size= s->frame_size;
}
}}}
At very worst, this should only be AV_LOG_WARNING because it's internally
correctable and doesn't affect normal operation. But I would actually
argue that this message could be removed completely instead, because (to
be blunt) who cares if the input buffer is too big, so long as the entire
frame is present and we return the correct number of bytes consumed to the
caller? This message is just noise.
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/441>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list