From 43ae0339da06a208271420d8d43a0d84ce94f525 Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Mon, 17 Dec 2018 22:15:56 +0100 Subject: streams: inherits parameters from source 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 --- plugins/alsa/alsa-api-streams.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'plugins/alsa/alsa-api-streams.c') diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c index d9d9667..c4bbbc3 100644 --- a/plugins/alsa/alsa-api-streams.c +++ b/plugins/alsa/alsa-api-streams.c @@ -200,8 +200,8 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT int volNumid = 0; AFB_ApiDebug(mixer->api, - "%s, stream %s %s, source %s, sink %s, mute %d", - __func__,uid, stream->uid, stream->source, stream->sink, stream->mute); + "NEW STREAM stream %s %s, source %s, sink %s, mute %d", + uid, stream->uid, stream->source, stream->sink, stream->mute); loopDev = ApiLoopFindSubdev(mixer, stream->uid, stream->source, &loop); if (loopDev) { @@ -248,10 +248,20 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT goto OnErrorExit; } + if (captureCard->params) { + if (stream->params) { + + AFB_ApiInfo(mixer->api,"%s: Stream %s inherits from capture %s parameters !", + __func__, stream->uid, captureCard->cid.cardid); + + memcpy(stream->params, captureCard->params, sizeof(AlsaPcmHwInfoT)); + } + } + capturePcm->closeAtDeletion = true; capturePcm->mute = stream->mute; - AFB_ApiDebug(mixer->api,"%s: PCM opened !", __func__); + AFB_ApiDebug(mixer->api,"%s: Capture PCM opened !", __func__); // Registry capturePcm PCM for active/pause event if (loopDev && loopDev->numid) { @@ -310,11 +320,6 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT } - - // retrieve channel count from route and push it to stream - - stream->params->channels = zone->ccount; - // create mute control and Registry it as pause/resume ctl) if (asprintf(&runName, "pause-%s", stream->uid) == -1) { SOFTMIXER_NOMEM(mixer->api); @@ -371,14 +376,16 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT if ((zone->params->rate != stream->params->rate) || (zone->params->format != stream->params->format)) { AFB_ApiNotice(mixer->api, - "%s: Instanciate a RATE CONVERTER (stream [%d,%s(%d)], zone [%d,%s(%d)])", + "%s: Instanciate a RATE CONVERTER (stream [%d,%s(%d),%d channels], zone [%d,%s(%d), %d channels])", __func__, stream->params->rate, stream->params->formatS, stream->params->format, + stream->params->channels, zone->params->rate, zone->params->formatS, - zone->params->format); + zone->params->format, + zone->params->channels); char *rateName; if (asprintf(&rateName, "rate-%s", stream->uid) == -1) { -- cgit 1.2.3-korg