Joe -
Yes, Rob was kind enough to tell me about that requirement earlier. Before I fixed that, the code would would just get confused and die when I called mad_stream_buffer(). To verify that this isn't related to the problem I'm having now, I changed the buffer size that I was passing to mad_stream_buffer(), and it had no change on the ouput audio.
I spent a few hours just staring at the code last night in hopes of some relevation, but nothing :(
Thanks, Reza
Joe Drew wrote:
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);