             return nil
         }
 
-        // TODO FIXME is this required?
-         outputBuffer.frameLength = outputBuffer.frameCapacity
+        // AudioConverterFillComplexBuffer does not know about the
+        // AVAudioPCMBuffer, and we must update its state ourselves.
+
+        outputBuffer.frameLength = outputBuffer.frameCapacity
 
         log.trace("Converted \(frameCount) frames from AAC to PCM")
 

class ADTSParser {

    let pcmFormat: AVAudioFormat
    let bufferDuration: TimeInterval

    weak var delegate: ADTSParserDelegate?


        framesPerPacket = Int(inputStreamDescription.mFramesPerPacket)
        log.info("Each input packet contains \(framesPerPacket) frames of audio")

        return true
    }

    private func didParsePackets(_ byteCountUInt32: UInt32, _ packetCountUInt32: UInt32, _ audioDataPointer: UnsafeRawPointer, _ packetDescriptionsPointer: UnsafeMutablePointer<AudioStreamPacketDescription>) {
