From 24391a4b6050819935f66897e49ffdb2fddc714a Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Thu, 7 Feb 2019 11:52:52 +0100 Subject: hal-bluealsa: fixes the abort due to sync call in io event The binder does not accept that synchronous calls are performed in the context of a systemd event, it makes is abort. To solve that, synchronous calls for creating/deleting bluetooth streams in the softmixer are simply here replaced by asynchronous calls. BUG-AGL: SPEC-2162 Change-Id: I4916d11cc904622449930365c5c09f67fe74425f Signed-off-by: Thierry Bultel --- plugins/lib/bluealsa/hal-bluealsa.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'plugins/lib/bluealsa') diff --git a/plugins/lib/bluealsa/hal-bluealsa.c b/plugins/lib/bluealsa/hal-bluealsa.c index ebc0560..10a61ae 100644 --- a/plugins/lib/bluealsa/hal-bluealsa.c +++ b/plugins/lib/bluealsa/hal-bluealsa.c @@ -442,7 +442,6 @@ static int halBlueAlsaAttachTransportStreams(bluealsa_transport_t * transport) { hal_bluealsa_plugin_data_t * pluginData=getPluginContext(plugin); json_object* requestJ = NULL; - json_object* returnJ = NULL; json_object* sourceJ = NULL; json_object* playbackJ = NULL; @@ -562,16 +561,11 @@ static int halBlueAlsaAttachTransportStreams(bluealsa_transport_t * transport) { /* In softmixer, this will create a transaction verb (whose name is transactionUidS), * will be used later to destroy all the created objects upon transport removal */ - if (afb_api_call_sync(plugin->api, SMIXER_API_NAME, "attach", requestJ, &returnJ, NULL, NULL)) { - AFB_API_ERROR(plugin->api, "Error calling attach verb of mixer" ); - goto done; - } + /* a call sync is forbidden, because we in the context of an event io */ + afb_api_call(plugin->api, SMIXER_API_NAME, "attach", requestJ, NULL, NULL); transport->transactionUidS = transactionUidS; - if (returnJ) - json_object_put(returnJ); - ret = 0; goto done; @@ -587,7 +581,6 @@ static int halBluezAlsaRemoveTransportStream(bluealsa_transport_t * transport) { CtlPluginT * plugin = transport->watch->plugin; json_object* requestJ = NULL; - json_object* returnJ = NULL; AFB_API_INFO(plugin->api, "Call transaction detach verb %s", transport->transactionUidS); if (transport->transactionUidS == NULL) @@ -599,14 +592,8 @@ static int halBluezAlsaRemoveTransportStream(bluealsa_transport_t * transport) { json_object_object_add(requestJ, "action", json_object_new_string("remove")); - if (afb_api_call_sync(plugin->api, SMIXER_API_NAME, transport->transactionUidS, requestJ, &returnJ, NULL, NULL)) { - AFB_API_ERROR(plugin->api, "Error calling attach verb of mixer" ); - goto fail; - } - - if (returnJ) - json_object_put(returnJ); - + /* a call sync is forbidden, because we in the context of an event io */ + afb_api_call(plugin->api, SMIXER_API_NAME, transport->transactionUidS, requestJ, NULL, NULL); return 0; fail: -- cgit 1.2.3-korg