diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2019-02-13 14:37:01 +0100 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2019-02-18 16:55:44 +0100 |
commit | 396da1607aa1cf1b3ba509c2ec4ebccda2fe382d (patch) | |
tree | 50add122af392f7ffa2c54ca3c1962582037aa37 /plugins/alsa/alsa-api-pcm.c | |
parent | c9fb69878e06592c21f77a0caa6c77c75f4957f5 (diff) |
core-pcm: fixed channels setting issues
Recent tries on the minnow board have show that the setting of channels
on a PCM must be done -after- the setting of the rate.
When not doing that, there can be issues (really, complicated to find)
around the boundaries values (open intervals) on the period bytes.
Additionally, the number of channels can now be forced in the json file.
Change-Id: I2c20853daadf9ccab06be6e04d1a185440f57780
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 | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/alsa/alsa-api-pcm.c b/plugins/alsa/alsa-api-pcm.c index c91b054..834d2fb 100644 --- a/plugins/alsa/alsa-api-pcm.c +++ b/plugins/alsa/alsa-api-pcm.c @@ -384,8 +384,8 @@ PUBLIC void ApiPcmDelParams(SoftMixerT* mixer, AlsaPcmHwInfoT* params) { } PUBLIC void ApiPcmParamsShow(SoftMixerT * mixer, const char *msg, const AlsaPcmHwInfoT * params) { - AFB_API_INFO(mixer->api, "%s PARAMS: rate=%d, format=%d, formatString=%s", - msg, params->rate, params->format, params->formatString); + AFB_API_INFO(mixer->api, "%s PARAMS: rate=%d, format=%d, formatString=%s, channels %d", + msg, params->rate, params->format, params->formatString, params->channels); } @@ -408,10 +408,11 @@ PUBLIC AlsaPcmHwInfoT * ApiPcmSetParams(SoftMixerT *mixer, const char *uid, json if (paramsJ) { int error = - wrap_json_unpack(paramsJ, "{s?i,s?s,s?s !}", + wrap_json_unpack(paramsJ, "{s?i,s?s,s?s,s?i !}", "rate", ¶ms->rate, "format", &format, - "access", &access); + "access", &access, + "channels", ¶ms->channels); if (error) { AFB_API_ERROR(mixer->api, "%s: sndcard=%s invalid params=%s", __func__, uid, json_object_get_string(paramsJ)); @@ -419,6 +420,9 @@ PUBLIC AlsaPcmHwInfoT * ApiPcmSetParams(SoftMixerT *mixer, const char *uid, json } } + AFB_API_NOTICE(mixer->api, "%s:%s rate set to %d", __func__, uid, params->rate); + AFB_API_NOTICE(mixer->api, "%s:%s channels set to %d", __func__, uid, params->channels); + // default format if (!format) { params->format = SND_PCM_FORMAT_S16_LE; |