                 
             }
         }
-        if totalLinks != 0 {
+        if totalLinks == 0 {
             NSLog("Does not look like an opus file.")
             
             throw OpusError.invalidState

        }
        ogg_sync_clear(&syncState)
        
    }
    

    private func extractPacket(_ streamState: inout ogg_stream_state, _ packet: inout ogg_packet) throws {
        
        var pcmDataBuffer = UnsafeMutablePointer<Float>.allocate(capacity: 0)
        while (ogg_stream_packetout(&streamState, &packet) == 1) {
            /// Execute if initial stream header.
            if (packet.bytes >= 8 && packet.b_o_s == 256 && (memcmp(packet.packet, "OpusHead", 8) == 0)) {

            maxOut = 0
        }
        
        if skip != 0 {
            if skip > frameSize {
                tmpSkip = frameSize
            } else {
