diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2019-05-13 14:30:01 +0200 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2019-05-14 15:14:20 +0200 |
commit | b5206132b6fb5b060acacaf2aee45841a7792a8c (patch) | |
tree | ef69b33d17629f6eddd249eadc7f2c446557620a /plugins/alsa/alsa-api-mixer.c | |
parent | 6c627f8650b88b19704dd4e513fe7fff701c00c1 (diff) | |
parent | 43df82896d8535f99233b4d3ab35a744b07871e0 (diff) |
Merge branch 'sandbox/tbultel/spec-2387' into guppyguppy_7.0.4guppy_7.0.3guppy_7.0.2guppy/7.0.4guppy/7.0.3guppy/7.0.27.0.47.0.37.0.2guppy
Bug AGL: SPEC-2387
This brings the following commits from master:
* 43df828 loops/avirt: forget saved loops after creation
* 622096c plug route: added a calculation for the number of physical c..
* c950295 streams: improved log output
* 7520fbf core-pcm: fixed channels setting issues
* 293fe69 core pcm: use the same model for writing and reading audio
* e355716 pcm plugs: rework the alsa config cleanup
* eb45566 alsa-api-pcm: added an 'optional' parameter
* 93bf6e6 alsa-transaction: simplify the cleanup
* bb70b48 alsa-api-pcm: added support of quirks
* 93ca785 alsa-utils-dump: added missing ending null char
Change-Id: I8ccc641b1f6827873e479185c0098d732d1b2b0a
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-api-mixer.c')
-rw-r--r-- | plugins/alsa/alsa-api-mixer.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c index 328f02e..15dae20 100644 --- a/plugins/alsa/alsa-api-mixer.c +++ b/plugins/alsa/alsa-api-mixer.c @@ -32,7 +32,7 @@ static json_object *LoopsJ = NULL; static void MixerExit() { SoftMixerT *mixer, *tmp; - printf("%s !\n", __func__); + printf("-------------------------- %s ------------------------!\n", __func__); cds_list_for_each_entry_safe(mixer, tmp, &mixerList, list) { // remove this mixer from the global mixer list @@ -41,13 +41,12 @@ static void MixerExit() { AlsaMixerTransaction * transaction, * tmp_trans; cds_list_for_each_entry_safe(transaction, tmp_trans, &mixer->transactionList, transaction_node) { - cds_list_del(&transaction->transaction_node); - AlsaMixerTransactionDoCleanup(transaction); AlsaMixerTransactionDelete(transaction); } + AFB_API_INFO(mixer->api, "Mixer %s terminated", mixer->uid); MixerDelete(mixer); } - printf("%s DONE ! Bye !\n", __func__); + printf("------------------------- %s DONE ! Bye ! --------------\n", __func__); } CTLP_ONLOAD(plugin, callbacks){ @@ -582,7 +581,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { if (playbacksJ) { error = ApiSinkAttach(mixer, request, uid, playbacksJ); - if (error) goto fail_loop; + if (error) goto fail; json_object *resultJ = MixerInfoPcms(mixer, playbacksJ, SND_PCM_STREAM_PLAYBACK, 0); json_object_object_add(responseJ, "playbacks", resultJ); @@ -594,7 +593,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { error = ApiSourceAttach(mixer, request, uid, capturesJ); if (error) { AFB_ApiError(mixer->api,"%s: source attach failed", __func__); - goto fail_sink; + goto fail; } json_object *resultJ = MixerInfoPcms(mixer, capturesJ, SND_PCM_STREAM_CAPTURE, 0); @@ -606,7 +605,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { if (zonesJ) { error = ApiZoneAttach(mixer, request, uid, zonesJ); if (error) - goto fail_source; + goto fail; json_object *resultJ = MixerInfoZones(mixer, zonesJ, 0); json_object_object_add(responseJ, "zone", resultJ); @@ -619,7 +618,11 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { AFB_ApiInfo(mixer->api, "%s set LOOPS/AVIRT", __func__); error = ApiLoopAttach(mixer, request, uid, ((loopsJ) ? loopsJ : LoopsJ), streamsJ); - if (error) goto fail_loop; + if (error) + goto fail; + // Now, forget the saved LoopsJ + if (LoopsJ) + LoopsJ = NULL; } AFB_ApiInfo(mixer->api, "%s set RAMPS", __func__); @@ -627,7 +630,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { if (rampsJ) { error = ApiRampAttach(mixer, request, uid, rampsJ); if (error) - goto fail_zone; + goto fail; json_object *resultJ = MixerInfoRamps(mixer, rampsJ, 0); json_object_object_add(responseJ, "ramps", resultJ); @@ -638,7 +641,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { if (streamsJ) { error = ApiStreamAttach(mixer, request, uid, prefix, streamsJ); if (error) - goto fail_ramp; + goto fail; json_object *resultJ = MixerInfoStreams(mixer, streamsJ, 0); json_object_object_add(responseJ, "streams", resultJ); @@ -648,7 +651,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { if (error) { AFB_ApiError(mixer->api, "%s mixer=%s verb=%s fail to register post attach Verb ", __func__, mixer->uid, uid); - goto fail_stream; + goto fail; } AFB_ApiNotice(mixer->api, "%s responseJ=%s", __func__, json_object_get_string(responseJ)); @@ -657,22 +660,12 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { AFB_ApiInfo(mixer->api,"%s DONE", __func__); return; -fail_stream: - // TODO remove created streams -fail_ramp: - // TODO remove created ramps -fail_zone: - // TODO remove created zone -fail_loop: - // TODO remove created loops -fail_source: - // TODO remove created sources -fail_sink: - // TODO remove created sinks fail: if (mixer->transaction) - free(mixer->transaction); + AlsaMixerTransactionDelete(mixer->transaction); + + mixer->transaction = NULL; AFB_ApiError(mixer->api,"%s FAILED", __func__); return; @@ -771,6 +764,10 @@ CTLP_CAPI(MixerAttach, source, argsJ, responseJ) { return 0; OnErrorExit: + if (mixer->transaction) + AlsaMixerTransactionDelete(mixer->transaction); + + mixer->transaction = NULL; return -1; } |