When the bitrate was set to 64 CoreAudio would call complex_input_data_proc more than once, which in turn would cause consumed bytes in the input buffer to be "freed" more than once (once for every additional call of complex_input_data_proc and once in aac_encode)