summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-loop.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2019-02-20 12:24:41 +0100
committerThierry Bultel <thierry.bultel@iot.bzh>2019-02-20 12:24:41 +0100
commit943f34b1d319e0ddc157dcfd85acde628f9d2ead (patch)
tree6b517f4aa6cee3e7adf3bd2cc895bfae0440262d /plugins/alsa/alsa-api-loop.c
parentd31ba2476fca9396e255fefd3b216befb8a7f316 (diff)
loops/avirt: forget saved loops after creation
avirt needs a backup of loops, before creating the streams. However, this breaks software dynamic streams such as those of of type bluez-alsa, because the logic was re-calling the loop creation at each call of the 'attach' verb. The fix simply consists in forgetting the saved loops once they are created Change-Id: I63f492b89233bed12de583de6e1077ac1c9c3ccf Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-api-loop.c')
-rw-r--r--plugins/alsa/alsa-api-loop.c12
1 files changed, 7 insertions, 5 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;
}