             let audioBufferList: AudioBufferList
             let packetDescriptions: UnsafeMutableBufferPointer<AudioStreamPacketDescription>
 
-            init(audioBuffers: UnsafeMutableBufferPointer<AudioBuffer>, packetDescriptions: UnsafeMutableBufferPointer<AudioStreamPacketDescription>) {
+            private var audioBuffer: AudioBuffer
+
+            init(bytes: UnsafeMutableBufferPointer<UInt8>, packetDescriptions: UnsafeMutableBufferPointer<AudioStreamPacketDescription>) {
+
                 packetCount = UInt32(packetDescriptions.count)
-                audioBufferList = AudioBufferList(mNumberBuffers: UInt32(audioBuffers.count), mBuffers: audioBuffers[0])
+
+                audioBuffer = AudioBuffer(mNumberChannels: 1, mDataByteSize: UInt32(bytes.count), mData: bytes.baseAddress)
+                audioBufferList = AudioBufferList(mNumberBuffers: 1, mBuffers: audioBuffer)
+
                 self.packetDescriptions = packetDescriptions
             }
         }
 
-        let context = InputProcContext(audioBuffers: audioBuffers, packetDescriptions: packetDescriptions)
+        let context = InputProcContext(bytes: bytes, packetDescriptions: packetDescriptions)
         let contextPointer = Unmanaged.passUnretained(context).toOpaque()
 
         let inputDataProc: AudioConverterComplexInputDataProc

        let bytes = UnsafeMutableBufferPointer<UInt8>(start: audioDataBytesPointer, count: byteCount)
        let packetDescriptions = UnsafeMutableBufferPointer<AudioStreamPacketDescription>(start: packetDescriptionsPointer, count: packetCount)

        if !didParse(bytes: bytes, packetDescriptions: packetDescriptions) {
            errorOut()
        }
    }

    // The input arguments will remain valid only for the duration of this
    // function, so we need to copy them if they're going to be needed later.

    private func didParse(bytes: UnsafeMutableBufferPointer<UInt8>, packetDescriptions: UnsafeMutableBufferPointer<AudioStreamPacketDescription>) -> Bool {

        return convert(bytes: bytes, packetDescriptions: packetDescriptions)
/*
        if pendingBytesCount + bytes.count > maximumPendingBytesCount ||
            pendingPacketsCount + packetDescriptions.count > maximumPendingPacketsCount {
            if !convertPending() {
                return false
            }
        }

        if bytes.count > maximumPendingBytesCount ||
            packetDescriptions.count > maximumPendingPacketsCount {
            return convert(bytes: bytes, packetDescriptions: packetDescriptions)
        }

        buffer(bytes: bytes, packetDescriptions: packetDescriptions)
        return true */

    }

    private func convertPending() -> Bool {
        if pendingPacketsCount == 0 {
            return true
        }
        
        let audioBuffers = UnsafeMutableBufferPointer<AudioBuffer>(start: pendingAudioBuffers, count: pendingAudioBuffersCount)
        let packetDescriptions = UnsafeMutableBufferPointer<AudioStreamPacketDescription>(start: pendingPacketDescriptions, count: pendingPacketsCount)

        let pcmBuffer = convert(audioBuffers: audioBuffers, packetDescriptions: packetDescriptions)

        pendingBytesCount = 0
        pendingAudioBuffersCount = 0
        pendingPacketsCount = 0

        if pcmBuffer == nil {
            return false
        }

        delegate?.adtsParser(self, didParsePCMBuffer: pcmBuffer!)
        return true
    }

    private func convert(bytes: UnsafeMutableBufferPointer<UInt8>, packetDescriptions: UnsafeMutableBufferPointer<AudioStreamPacketDescription>) -> Bool {

        var audioBuffer = AudioBuffer(mNumberChannels: 1, mDataByteSize: UInt32(bytes.count), mData: bytes.baseAddress)
        let audioBuffers = UnsafeMutableBufferPointer(start: &audioBuffer, count: 1)

        guard let pcmBuffer = convert(audioBuffers: audioBuffers, packetDescriptions: packetDescriptions) else {
            return false
        }

        delegate?.adtsParser(self, didParsePCMBuffer: pcmBuffer)
        return true
    }


    private func buffer(bytes: UnsafeMutableBufferPointer<UInt8>, packetDescriptions: UnsafeMutableBufferPointer<AudioStreamPacketDescription>) {

        assert(pendingBytesCount + bytes.count <= maximumPendingBytesCount)
        assert(pendingAudioBuffersCount + 1 <= maximumPendingPacketsCount)
        assert(pendingPacketsCount + packetDescriptions.count <= maximumPendingPacketsCount)

        let nextPendingBytes = pendingBytes.advanced(by: pendingBytesCount)
        let nextPendingAudioBuffers = pendingAudioBuffers.advanced(by: pendingAudioBuffersCount)
        let nextPendingPacketDescriptions = pendingPacketDescriptions.advanced(by: pendingPacketsCount)

        var audioBuffer = AudioBuffer(mNumberChannels: 1, mDataByteSize: UInt32(bytes.count), mData: nextPendingBytes)

        nextPendingBytes.initialize(from: bytes.baseAddress!, count: bytes.count)
        nextPendingAudioBuffers.initialize(from: &audioBuffer, count: 1)
        nextPendingPacketDescriptions.initialize(from: packetDescriptions.baseAddress!, count: packetDescriptions.count)

        pendingBytesCount += bytes.count
        pendingAudioBuffersCount += 1
        pendingPacketsCount += packetDescriptions.count

    }


    private func convert(audioBuffers: UnsafeMutableBufferPointer<AudioBuffer>, packetDescriptions: UnsafeMutableBufferPointer<AudioStreamPacketDescription>) -> AVAudioPCMBuffer? {

        guard let converter = converter else {
            log.warning("The audio stream is trying to convert audio packets without informing us about the audio format")

                log.warning("Ignoring error when trying to dispose audio converter: \(osStatusDescription(status))")
            }
        }
    }

    /// The delegate methods are called synchronously during
