aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-06-22 09:58:21 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2018-06-22 09:58:21 +0200
commit12c0873db5f94266034e9f9c8729a67d0eee7603 (patch)
tree92297ce042eac939095e27ee831b09df2bddf4b4
parent3b8dbd3db52134ace368fd96b7b37cef8d2d03f1 (diff)
sinks: fixed index mismatch when multiple sound cards are declared
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
-rw-r--r--plugins/alsa/alsa-api-sink.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/alsa/alsa-api-sink.c b/plugins/alsa/alsa-api-sink.c
index c8f9f9d..c8ad727 100644
--- a/plugins/alsa/alsa-api-sink.c
+++ b/plugins/alsa/alsa-api-sink.c
@@ -99,21 +99,21 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
for (int idx = 0; idx < count; idx++) {
json_object *sinkJ = json_object_array_get_idx(argsJ, idx);
- mixer->sinks[index + idx] = ApiPcmAttachOne(mixer, uid, SND_PCM_STREAM_PLAYBACK, sinkJ);
- if (!mixer->sinks[index + idx]) {
+ AlsaSndPcmT * pcm = ApiPcmAttachOne(mixer, uid, SND_PCM_STREAM_PLAYBACK, sinkJ);
+ if (!pcm) {
AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(sinkJ));
goto OnErrorExit;
}
-
// move from hardware to DMIX attach to sndcard
- if (asprintf(&dmixUid, "dmix-%s", mixer->sinks[index]->uid) == -1)
+ if (asprintf(&dmixUid, "dmix-%s", pcm->uid) == -1)
goto OnErrorExit;
- dmixConfig = AlsaCreateDmix(mixer, dmixUid, mixer->sinks[index], 0);
+ dmixConfig = AlsaCreateDmix(mixer, dmixUid, pcm, 0);
if (!dmixConfig) {
- AFB_ReqFailF(request, "internal-error", "mixer=%s sink=%s fail to create DMIX config", mixer->uid, mixer->sinks[index]->uid);
+ AFB_ReqFailF(request, "internal-error", "mixer=%s sink=%s fail to create DMIX config", mixer->uid, pcm->uid);
goto OnErrorExit;
}
+ mixer->sinks[index + idx] = pcm;
}
break;
default: