[mad-dev] mp3 bitstream error

Rob Leslie rob@mars.org
Fri, 6 Aug 2004 00:28:16 -0700

On Aug 5, 2004, at 10:15 PM, Grigory A. wrote:
> I am trying to play attached bitstream  using mimimad application.
> and minimad say to me
> decoding error 0x0235 at byte offset 0
>   MAD_ERROR_BADDATAPTR      = 0x0235,   /* bad main_data_begin pointer 
> */
> but my winamp play it well.
> What is the problem?

This error is caused when a frame's main_data_begin pointer points 
beyond the available bit reservoir. This can occur if, e.g., the stream 
has been cut or spliced. (Note that when decoding the very first frame 
in a stream, this pointer must necessarily be zero.)

When this error occurs, the frame cannot be decoded. However, the bit 
reservoir contained in the frame will be used to decode future frames. 
So it is possible to continue decoding even though you will not get any 
output samples from the failed frame. Depending on the size of the 
missing bit reservoir, this error may occur in several frames until the 
reservoir is replenished.

In most cases you can simply ignore the error, as Winamp appears to do. 
You may want to employ an error concealment strategy, such as repeating 
the previous successfully decoded frame's subband samples (if any) or 
muting the frame.

Rob Leslie