alsa-ucm: correct the channel default logic (stereo)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-02-11 10:54:16 +01:00 committed by Tanu Kaskinen
parent ef8a302d6b
commit cabd387e26

View file

@ -377,6 +377,13 @@ static int ucm_get_device_property(
pa_log("UCM playback device %s fetch pcm failed", device_name); pa_log("UCM playback device %s fetch pcm failed", device_name);
} }
if (pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_SINK) &&
device->playback_channels == 0) {
pa_log("UCM file does not specify 'PlaybackChannels' "
"for device %s, assuming stereo duplex.", device_name);
device->playback_channels = 2;
}
value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_CAPTURE_CHANNELS); value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_CAPTURE_CHANNELS);
if (value) { /* input */ if (value) { /* input */
/* get channels */ /* get channels */
@ -391,10 +398,10 @@ static int ucm_get_device_property(
pa_log("UCM capture device %s fetch pcm failed", device_name); pa_log("UCM capture device %s fetch pcm failed", device_name);
} }
if (device->playback_channels == 0 && device->capture_channels == 0) { if (pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_SOURCE) &&
pa_log_warn("UCM file does not specify 'PlaybackChannels' or 'CaptureChannels'" device->capture_channels == 0) {
pa_log("UCM file does not specify 'CaptureChannels' "
"for device %s, assuming stereo duplex.", device_name); "for device %s, assuming stereo duplex.", device_name);
device->playback_channels = 2;
device->capture_channels = 2; device->capture_channels = 2;
} }