Density perturbations with relativistic thermodynamics