alsa-ucm: Fix bad rate check

Need to check the rate value for being > 0 not the return value of
pa_atou().
This commit is contained in:
Arun Raghavan 2013-09-30 15:15:36 +05:30
parent 24d2fa5415
commit 5a2fd6624d

View file

@ -263,7 +263,7 @@ static int ucm_get_device_property(
/* get rate */
if ((value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_PLAYBACK_RATE)) ||
(value = pa_proplist_gets(verb->proplist, PA_ALSA_PROP_UCM_PLAYBACK_RATE))) {
if (pa_atou(value, &ui) > 0 && ui < PA_RATE_MAX) {
if (pa_atou(value, &ui) == 0 && ui > 0 && ui < PA_RATE_MAX) {
pa_log_debug("UCM playback device %s rate %d", device_name, ui);
device->playback_rate = ui;
} else
@ -284,7 +284,7 @@ static int ucm_get_device_property(
/* get rate */
if ((value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_CAPTURE_RATE)) ||
(value = pa_proplist_gets(verb->proplist, PA_ALSA_PROP_UCM_CAPTURE_RATE))) {
if (pa_atou(value, &ui) > 0 && ui < PA_RATE_MAX) {
if (pa_atou(value, &ui) == 0 && ui > 0 && ui < PA_RATE_MAX) {
pa_log_debug("UCM capture device %s rate %d", device_name, ui);
device->capture_rate = ui;
} else