The non-equilibrium equation of state is found in the approximation of the functional on the local density, and its application to the description of the emission of protons and pions in heavy ion collisions is considered. The non-equilibrium equation of state is studied in the context of the hydrodynamic approach. The compression stage, the expansion stage, and the freeze-out stage of the hot spot formed during the collisions of heavy ions are considered. The energy spectra of protons and subthreshold pions produced in collisions of heavy ions are calculated with inclusion of the nuclear viscosity effects and compared with experimental data for various combinations of colliding nuclei with energies of several tens of MeV per nucleon.