Re: kExtAudioFileError_AsyncWriteBufferOverflow on iPad
Re: kExtAudioFileError_AsyncWriteBufferOverflow on iPad
- Subject: Re: kExtAudioFileError_AsyncWriteBufferOverflow on iPad
- From: Chris Adamson <email@hidden>
- Date: Wed, 01 Oct 2014 11:39:55 -0400
Hey, gang, hope you don't mind my bumping a thread from three years ago, but I just hit this myself and haven't been able to work around it.
Basic arrangement is AURemoteIO callback from the mic, encoding to mono AAC with ExtAudioFileWriteAsync() in the callback.
In my case, the above error only occurs on an iPhone 4, since our app supports iOS 7 and that's the oldest device running 7 (also the only single-core, IIUC). Usually, we get this error from ExtAudioFileWriteAsync() when switching apps, particularly via the double-home-press that shows each of the backgrounded apps. Also, we only see this when we set the kExtAudioFileManufacturer_CodecManufacturer to kAppleHardwareAudioCodecManufacturer; doesn't happen with software codec.
I took the advice of this thread and attempted a quick fix whereby if I get kExtAudioFileError_AsyncWriteBufferOverflow, I split the AudioBufferList into two smaller buffers, and then attempt the ExtAudioFileWriteAsync() call again, twice, with each half. This usually works once, but the next call to ExtAudioFileWriteAsync() fails again. And they just keep failing.
I also tried changing kAudioUnitProperty_MaximumFramesPerSlice, in hopes of getting called back less frequently (in case that would take the pressure off the ExtAudioFile encoder), but that didn't work either.
There's a comment in ExtendedAudioFile.h on this error code, saying "// an async write could not be completed in time", so I tried an experiment whereby I would just drop data on the floor and not call ExtAudioFileWriteAsync() for 1-5 seconds, giving it a chance to catch up or recover or whatever it needs to do. No effect.
So I guess I'm wondering… what did anybody do to successfully recover from this state, because I feel like I'm running out of ideas.
—Chris
On Apr 5, 2011, at 12:53 PM, Rick Cohen <email@hidden> wrote:
> [iPad1, iOS 4.3]
>
> Hello Aran and Brian,
>
> I am also seeing the same thing in my iPad app, encoding to AAC.
>
> Brian, are you suggesting that inside the render callback we should
> have a loop that calls ExtAudioFileWriteAsync multiple times? How
> many frames do you suggest that we write? In my app the typical
> number seems to be 1024 frames per callback.
>
> I tried using the kExtAudioFileProperty_IOBufferSizeBytes property to
> increase the size of the IO Buffer from 64K (default size) to 128K,
> but this failed in the thread that ExtAudioFile uses to write the data
> to the file.
>
> Thanks in advance for any advice!
>
> - Rick
>
> On Sat, Jan 22, 2011 at 2:25 PM, Brian Willoughby <email@hidden> wrote:
>> Check the size of your buffer. I believe that I may have run into the same
>> error and had to fix it by reducing my buffer size, sometimes by looping
>> over a larger buffer and writing smaller chunks to ExtAudioFile. As soon as
>> I sent in a smaller buffer, the error stopped, and the resulting file had no
>> problems.
>>
>> Brian Willoughby
>> Sound Consulting
>>
>> On Jan 22, 2011, at 02:40, Aran Mulholland wrote:
>>>
>>> anyone got any answers on this?
>>>
>>> On Wed, Jan 5, 2011 at 9:16 PM, Aran Mulholland <email@hidden>
>>> wrote:
>>>>
>>>> I am getting an kExtAudioFileError_AsyncWriteBufferOverflow (-66570)
>>>> when using an ExtAudioFileWriteAsync from a render callback. I only
>>>> get the error when I am encoding the Audio (AAC). If i record straight
>>>> pcm (wav) its all good. In the simulator all works fine as well. Am I
>>>> simply running out of processor power on the device (iPad)? I thought
>>>> there was a hardware encoder, is there any other considerations I
>>>> should take into account when doing this?
>>>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden