Joshua Haberman wrote:
It seems that when you pass the decoder data from the input callback, it tries to synthesize everything you give it. If the end of the buffer you passed ends in the middle of a frame, you get seams. Passing all the data to the decoder at once solves the problem, but that's not practical.
As far as I can see, you can't get any metainformation (like the size of each frame) until you pass it data. Once you pass it data, you've probably misaligned the frame and produced garbage. What's the proper way to handle this situation?
Each time you refill your buffer, you need to preserve the data in your existing buffer from stream.next_frame to the end.
This usually amounts to calling memmove() on this unconsumed portion of the buffer and appending new data after it, before calling mad_stream_buffer().
Cheers, -rob