Core Audio - CARIngBuffer

Posted by tech74 on Stack Overflow See other posts from Stack Overflow or by tech74
Published on 2010-04-05T11:40:59Z Indexed on 2010/04/05 11:43 UTC
Read the original article Hit count: 749

Filed under:

Hi, Im looking at using the CARingBuffer in iPhone SDK 3.1 Developer\Extras\CoreAudio\PublicUtility, however was a little puzzled about some of its methods. Firstly this will only make sense really to anyone who's used this class

For example the GetTimebounds,SetTimeBounds, ClipTimeBounds functions what are these actually doing?

Also when using it, i get crashes caused by example this method in the main Fetch method

-> ZeroABL(abl, 0, destStartOffset * mBytesPerFrame);

CARingBufferError CARingBuffer::Fetch(AudioBufferList *abl, UInt32 nFrames, SampleTime startRead) { SampleTime endRead = startRead + nFrames;

SampleTime startRead0 = startRead; SampleTime endRead0 = endRead; SampleTime size;

CARingBufferError err = ClipTimeBounds(startRead, endRead); if (err) return err; size = endRead - startRead;

SInt32 destStartOffset = startRead - startRead0; if (destStartOffset > 0) { ZeroABL(abl, 0, destStartOffset * mBytesPerFrame); }

Here the destStartOffset has become larger than the size of the abl Bufferlist so when a memset is done it exceeds the boundaries of the abl Bufferlist causing the crash. Why hasn't this class got checks in to prevent this.

© Stack Overflow or respective owner

Related posts about iphone