views:

147

answers:

1

I'm having problems using AudioQueueOfflineRender to decode AAC data.

When I examine the buffer after the call, it is always filled with empty data. I made sure the input buffer is valid and packet descriptions are provided.

I searched and found that a few others have had the same problem: http://lists.apple.com/archives/Coreaudio-api/2008/Jul/msg00119.html

Also, the inTimestamp argument doesn't make sense to me. Why should the renderer care where in the audio the beginning of the buffer corresponds to? The function throws an error if I pass in NULL, so I pass in the timestamp anyway.

A: 

Have you read through Technical Q&A QA1562 and the Audio Queue Guide? Specifically, it states that you must ask for 0 frames immediately after start:

AudioQueueStart(myInfo.mQueue, NULL);

AudioTimeStamp theTimeStamp;
theTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
theTimeStamp.mSampleTime = 0;

/*
    Important - We need to call this once asking for 0 frames!
*/
AudioQueueOfflineRender(myInfo.mQueue, &theTimeStamp, captureBuffer, 0);
slf
Yes, I have this line as it seems to be a requirement.
hyn
The timestamp is very important, QA1562 shows this. Are you theTimeStamp.mSampleTime += writeFrames;?
slf