Cleanup and add tests for convert_samples_rate