title: How do I use CoreAudio's AudioConverter to encode AAC in real-time?
body: <p>All the sample code I can find that uses <code>AudioConverterRef</code> focuses on use cases where I have all the data up-front (such as converting a file on disk). They commonly call <code>AudioConverterFillComplexBuffer</code> with the PCM to be converted as the <code>inInputDataProcUserData</code> and just fill it in in the callback. (Is that really how it's supposed to be used? Why does it need a callback, then?) For my use case, I'm trying to stream aac audio from the microphone, so I have no file, and my PCM buffer is being filled in in real time.</p>
  
  <p>Since I don't have all the data up-front, I've tried doing <code>*ioNumberDataPackets = 0</code> in the callback once my input data is out, but that just puts the AudioConverter in a dead state where it needs to be <code>AudioConverterReset()</code>ted, and I don't get any data out of it.</p>
  
  <p>One approach I've seen suggested online is to return an error from the callback if the data I have stored is too small, and just try again once I have more data, but that seems like such a waste of resources that I can't bring myself to even try it.</p>
  
  <p>Do I really need to do the "retry until my input buffer is big enough", or is there a better way?</p>