aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-api-pcm.c')
-rw-r--r--plugins/alsa/alsa-api-pcm.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/plugins/alsa/alsa-api-pcm.c b/plugins/alsa/alsa-api-pcm.c
index cc2817d..e1f1710 100644
--- a/plugins/alsa/alsa-api-pcm.c
+++ b/plugins/alsa/alsa-api-pcm.c
@@ -581,14 +581,6 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
goto fail_pcm_sndcard;
}
- // check sndcard accepts params
- pcm->sndcard->params = ApiPcmSetParams(mixer, pcm->uid, paramsJ);
- if (!pcm->sndcard->params) {
- AFB_ApiError(mixer->api, "%s: hal=%s Fail to set params sndcard uid=%s params=%s",
- __func__, uid, pcm->uid, json_object_get_string(paramsJ));
- goto fail_pcm_sndcard_ctl;
- }
-
if (direction == SND_PCM_STREAM_PLAYBACK) {
if (!sinkJ) {
AFB_ApiError(mixer->api, "%s: hal=%s SND_PCM_STREAM_PLAYBACK require sinks args=%s",
@@ -626,7 +618,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
case json_type_object:
channel = ProcessOneChannel(mixer, pcm->uid, channelsJ);
if (channel == NULL) {
- goto fail_pcm_sndcard_ctl;
+ goto fail_pcm_channels;
}
pcm->nbChannels++;
@@ -653,6 +645,16 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
}
}
+ // check sndcard accepts params
+ pcm->sndcard->params = ApiPcmSetParams(mixer, pcm->uid, paramsJ);
+ if (!pcm->sndcard->params) {
+ AFB_ApiError(mixer->api, "%s: hal=%s Fail to set params sndcard uid=%s params=%s",
+ __func__, uid, pcm->uid, json_object_get_string(paramsJ));
+ goto fail_pcm_sndcard_ctl;
+ }
+
+ pcm->sndcard->params->channels = pcm->nbChannels;
+
if (controlsJ) {
json_object *volJ = NULL, *muteJ = NULL;
error = wrap_json_unpack(controlsJ, "{s?o,s?o !}"