[mad-dev] more details - Problems happens every 18432 bytes and
lasts exactly 4806 bytes.
Joe Drew
hoserhead@woot.net
28 May 2002 08:07:31 -0400
On Mon, 2002-05-27 at 23:40, Reza Naima wrote:
> All of which have a length of 4806 bytes, and happen at a regular
> interval of every 18432 (0x4800) bytes.
Are you preserving the data which has not been decoded, and needs to be
preserved for the next call to mad_stream_buffer? When you don't, it
causes seams and blips and pops.
The following snippet of code is from mpg321, mad.c:read_from_fd().
int bytes_to_preserve = stream->bufend - stream->next_frame;
/* need to preserve the bytes which comprise an incomplete
frame, that mad has passed back to us */
if (bytes_to_preserve)
memmove(playbuf->buf, stream->next_frame, bytes_to_preserve);
if( !(read(playbuf->fd, playbuf->buf + bytes_to_preserve, BUF_SIZE -
bytes_to_preserve) > 0) )
playbuf->done = 1;
mad_stream_buffer(stream, playbuf->buf, playbuf->length);
--
Joe Drew <hoserhead@woot.net> <drew@debian.org>
Please encrypt email sent to me.