alsa-ucm: Fallback to stereo duplex
authorDavid Henningsson <david.henningsson@canonical.com>
Tue, 5 Feb 2013 08:22:17 +0000 (09:22 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Wed, 6 Feb 2013 11:49:57 +0000 (13:49 +0200)
If 'PlaybackChannels' and 'CaptureChannels' are absent in the UCM
file for a device, assume the device is stereo duplex.

Reported-by: Luke Yelavich <luke.yelavich@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
src/modules/alsa/alsa-ucm.c

index 80e98ea7a3a430a231bf1f9a3115849dd0707a3c..9e62dcb388efb823fb154b4e6dc94a78c11f55f9 100644 (file)
@@ -247,7 +247,12 @@ static int ucm_get_device_property(
         }
     }
 
-    pa_assert(device->playback_channels || device->capture_channels);
+    if (device->playback_channels == 0 && device->capture_channels == 0) {
+        pa_log_warn("UCM file does not specify 'PlaybackChannels' or 'CaptureChannels'"
+                    "for device %s, assuming stereo duplex.", device_name);
+        device->playback_channels = 2;
+        device->capture_channels = 2;
+    }
 
     /* get priority of device */
     if (device->playback_channels) { /* sink device */