Re: MAD_ERROR_BADHUFFDATA before MAD_ERROR_BUFLEN

Radek BartoĊˆ <[email protected]> Tue, 22 May 2007 14:27:26 +0200
Newsgroups gmane.comp.audio.mad.devel
Organization FIT BUT
Message-ID <[email protected]>
On Monday 21 of May 2007 03:04:46 Rob Leslie wrote:

> 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.

If I understand your advise correctly, you are saying that I should move =
code=20
reading new data (lines 35-73) right after MAD_ERROR_BUFLEN detections to=
=20
line 97? I tried that but result is the same. Moreover reading code is=20
executed first time due fullfilled condition this->int_stream.buffer =3D=3D=
 NULL=20
and it resets this->int_stream.error to MAD_ERROR_NONE at line 72 each ti=
me=20
so next evocation of this code would be due previous MAD_ERROR_BUFLEN and=
 it=20
should be called only once for each MAD_ERROR_BUFLEN error.

The only thing I know about problem is that MAD_ERROR_BADHUFFDATA or any =
other=20
errors are returned before MAD_ERROR_BUFLEN and this seems like MAD won't=
=20
recognize that it hasn't complete frame at the end of buffered data, trie=
s to=20
decode it with these errors and then returns MAD_ERROR_BUFLEN. Then after=
=20
passing new block of data is first frame in buffer of course incomplete t=
oo=20
and MAD gets unsynchronized with errors.

--=20
Bc. Radek Barto=C5=88

Faculty of Information Technology
Brno University of Technology

E-mail: [email protected]
Web: http://blackhex.no-ip.org
Jabber: [email protected]