summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/alsa/alsa-api-loop.c12
-rw-r--r--plugins/alsa/alsa-api-mixer.c17
2 files changed, 17 insertions, 12 deletions
diff --git a/plugins/alsa/alsa-api-loop.c b/plugins/alsa/alsa-api-loop.c
index c601880..c9456f2 100644
--- a/plugins/alsa/alsa-api-loop.c
+++ b/plugins/alsa/alsa-api-loop.c
@@ -443,10 +443,13 @@ PUBLIC int ApiLoopAttach(SoftMixerT *mixer, afb_req_t request, const char * uid,
AlsaSndLoopT * newLoop = NULL;
+ AFB_API_INFO(mixer->api, "%s: %s", __func__, json_object_get_string(argsJ));
+
if (mixer->nbLoops >= mixer->max.loops) {
- AFB_IfReqFailF(mixer, request, "too-small", "mixer=%s hal=%s max loop=%d", mixer->uid, uid, mixer->max.loops);
+ AFB_API_ERROR(mixer->api, "%s: too many loops !", __func__);
+ AFB_IfReqFailF(mixer, request, "too-small", "mixer=%s hal=%s max loop=%d", mixer->uid, uid, mixer->max.loops);
goto fail;
- }
+ }
switch (json_object_get_type(argsJ)) {
size_t count;
@@ -462,14 +465,14 @@ PUBLIC int ApiLoopAttach(SoftMixerT *mixer, afb_req_t request, const char * uid,
count = json_object_array_length(argsJ);
if (count > (mixer->max.loops - mixer->nbLoops)) {
AFB_IfReqFailF(mixer, request, "too-small", "mixer=%s hal=%s max loop=%d", mixer->uid, uid, mixer->max.loops);
- goto fail_loop;
+ goto fail;
}
for (int idx = 0; idx < count; idx++) {
json_object *loopJ = json_object_array_get_idx(argsJ, idx);
newLoop = loopCreate(mixer, uid, loopJ, streamsJ);
if (newLoop == NULL) {
- goto fail_loop;
+ goto fail;
}
}
break;
@@ -480,7 +483,6 @@ PUBLIC int ApiLoopAttach(SoftMixerT *mixer, afb_req_t request, const char * uid,
return 0;
-fail_loop:
fail:
return -1;
}
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c
index bc27e24..16b05ff 100644
--- a/plugins/alsa/alsa-api-mixer.c
+++ b/plugins/alsa/alsa-api-mixer.c
@@ -614,13 +614,16 @@ STATIC void MixerAttachVerb(afb_req_t request) {
// In AVIRT mode, we require both the loops and streams JSON objects to
// construct the loopbacks, so when the loops are set, but the streams
// are not, we need to save the loops until the streams are given to us
- if (streamsJ && (loopsJ || LoopsJ)) {
- AFB_API_INFO(mixer->api, "%s set LOOPS/AVIRT", __func__);
- error = ApiLoopAttach(mixer, request, uid,
- ((loopsJ) ? loopsJ : LoopsJ), streamsJ);
- if (error)
- goto fail;
- }
+ if (streamsJ && (loopsJ || LoopsJ)) {
+ AFB_API_INFO(mixer->api, "%s set LOOPS/AVIRT", __func__);
+ error = ApiLoopAttach(mixer, request, uid, ((loopsJ) ? loopsJ : LoopsJ), streamsJ);
+ if (error) {
+ goto fail;
+ }
+ // Now, forget the saved LoopsJ
+ if (LoopsJ)
+ LoopsJ = NULL;
+ }
AFB_API_INFO(mixer->api, "%s set RAMPS", __func__);