alsa-ucm: Don't allow Playback/CaptureRate to be 0
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 30 Sep 2013 03:02:16 +0000 (08:32 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 30 Sep 2013 03:02:59 +0000 (08:32 +0530)
This was a review comment on the original patch that I missed fixing.

src/modules/alsa/alsa-ucm.c

index 47ff926e2d1646b70ddde6296009779432967062..2c0e87eba79ce72941c55db2bf18fe225efd2772 100644 (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 < 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 < PA_RATE_MAX) {
                 pa_log_debug("UCM capture device %s rate %d", device_name, ui);
                 device->capture_rate = ui;
             } else