diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2019-02-07 11:52:52 +0100 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2019-02-07 12:57:50 +0000 |
commit | 387d591243f8b4e40eb27cd6bde00b8cb3874ba6 (patch) | |
tree | ea778133c6d7e24424fc804b12e4ccb14f9198f1 | |
parent | 48cd4335d91c1341df94e48ca3ea07dbf418bccc (diff) |
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 <thierry.bultel@iot.bzh>
-rw-r--r-- | plugins/lib/bluealsa/hal-bluealsa.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/plugins/lib/bluealsa/hal-bluealsa.c b/plugins/lib/bluealsa/hal-bluealsa.c index 853ab05..b2d4537 100644 --- a/plugins/lib/bluealsa/hal-bluealsa.c +++ b/plugins/lib/bluealsa/hal-bluealsa.c @@ -436,7 +436,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; @@ -556,16 +555,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; @@ -581,7 +575,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) @@ -593,14 +586,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: |