by using pa_modargs_get_sample_rate() we avoid inconsistant validity
checking of the sample rate in various places
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
goto fail;
}
- if (pa_modargs_get_value_u32(ma, "rate", &u->sample_spec.rate) < 0 ||
- u->sample_spec.rate <= 0 || u->sample_spec.rate > PA_RATE_MAX) {
+ if (pa_modargs_get_sample_rate(ma, &u->sample_spec.rate) < 0) {
pa_log_error("Failed to get rate from module arguments");
goto fail;
}
ss.channels = 1;
ss.rate = 44100;
- if (pa_modargs_get_value_u32(ma, "rate", &ss.rate) < 0 || ss.rate <= 1) {
+ if (pa_modargs_get_sample_rate(ma, &ss.rate) < 0) {
pa_log("Invalid rate specification");
goto fail;
}
pa_assert(rss);
ss = *rss;
- if ((pa_modargs_get_value_u32(ma, "rate", &ss.rate)) < 0 ||
- ss.rate <= 0 ||
- ss.rate > PA_RATE_MAX)
+ if ((pa_modargs_get_sample_rate(ma, &ss.rate)) < 0)
return -1;
channels = ss.channels;