I'm planning to use MAD in a streaming application. I have no control over the incoming data rate, although it is ostensibly CBR data with a fixed sample rate. Similarly, the processing rate of the decoded
samples is
controlled by the DAC. So inevitably sooner or later I'll get a buffer overflow or underflow.
So if I understand, the input can be for instance 128kbps or 160kbps, but the DAC expects a fixed rate of PCM samples? I don't see a problem then, since the rate of PCM samples is independent on the bitrate of the MPEG-stream. So your PCM-samples will be delivered to the DAC with always the same speed.
Thanks. I do know the sample rate (in fact, I need to resample the data from typically 48000Hz mono to 22050Hz stereo after the decode). My problem
is that the DAC runs autonomously, and interrupts when it wants more data. I can't 'choose' how fast to give it samples. As the CPU and DAC clocks won't be exactly synchronised, over time I'll end up with either too many or too few samples in my buffer.
I guess I need to add or delete samples, either by changing the buffer or by adjusting the resampling ratio slightly. My question is when to do it and how much to adjust.
The contents of this email and any attachments are sent for the personal attention of the addressee(s) only and may be confidential. If you are not the intended addressee, any use, disclosure or copying of this email and any attachments is unauthorised - please notify the sender by return and delete the message. Any representations or commitments expressed in this email are subject to contract.
ntl Group Limited