We describe the absorption by the walls of a quantum electrodynamics cavity as a process during which the elementary excitations (photons) of an internal mode of the cavity exit by tunneling through the cavity walls. We estimate by classical methods the survival time of a photon inside the cavity and the quality factor of its mirrors.