On Apr 29, 2007, at 11:01 AM, Radek BartoĊ wrote:
I tried to incorporate Madlld low-level API demonstration code into my MP3 player, but I'm experiencing a weird problem. When data stored by mad_stream_buffer to MAD are going to run out MAD_ERROR_BADHUFFDATA is generated right before MAD_ERROR_BUFLEN. Then when new data are sent to MAD MAD_ERROR_BADCRC and MAD_ERROR_BADDATAPTR occur. Since then no other errors occur until next data are consumed. This produces slight skip in otherwise fluent playback. I checked twice that my code which I'm attaching is equivalent to Madlld's one. Please, if you'll notice a reasong of this behaviour in my code, let me know since I'm little desperate about this.
You should not inspect this->int_stream.error (at line 35) unless mad_decode_frame() returns -1, because this field is not otherwise reset. I suspect you may be loading new data each time through the loop, until another decoding error occurs as a consequence.