Fix encoder crash with non-positive sample rates.