Rob Leslie wrote:
On Sep 26, 2007, at 3:40 AM, Niels Roosen wrote:
Am I missing something or could it be that using mad this way hasn't been tested excessively enough and is it true that the memory alllocated in mad_layer_III() on lines 2530 and 2538 (libmad version 0.15.1b) is not freed properly? I would be delighted to either get confirmation on this or some advice on how to solve this issue.
The memory allocated in mad_layer_III() is freed in mad_frame_finish() and mad_stream_finish(); you should make sure these are definitely being called on the same structures you pass to mad_frame_decode().
Since you say you are making these calls, I'm at a loss to offer any specific advice without seeing your code.
What I do is initialize the decoder, decode incoming data per frame until the client disconnects, and then, when another client connects, run the mad_stream_finish() and mad_frame_finish() on the pointers to the relevant structures before running the initialization functions again, in order to clean up any remaining data in the decoder. I took this from some example code but unfortunately don't know what any more, but I suppose that is how it should be done.
I will post the relevant code tomorrow, should I do that as attachment or inline?
Regards,
Niels