diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-12-17 22:15:56 +0100 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-12-18 15:05:19 +0100 |
commit | 43ae0339da06a208271420d8d43a0d84ce94f525 (patch) | |
tree | 446ae58b68ff83fea8b923b374202c21a59531a9 /plugins/alsa/alsa-api-pcm.c | |
parent | 23cda61198d29010f5a86116b88b8b48eea5e797 (diff) |
streams: inherits parameters from sourcesandbox/tbultel/bluealsa
The capture parameters of a stream must be the ones of
the capture source. The number of channel must typically
match the one of the source microphone, else the configuration
fails
Change-Id: Ie8d0d85a65cb4a94a8698d1015d730e3c2a8b6a5
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-api-pcm.c')
-rw-r--r-- | plugins/alsa/alsa-api-pcm.c | 20 |
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 !}" |