Parent: d764f78f27653bc1df71c462e9aca7a18bc75f9f
Author: Pauli Virtanen <pav@iki.fi>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2023-07-05 20:48:31
Tree: f4accfd5d09d7bd50d474c8a2855f3e0715abd58
transport: handle BAP Enabling state correctly when resuming If BAP stream is in Enabling state when transport acquire is attempted, we should wait for bap_state_changed to emit the completion event. transport->resume() is only called with new owner with no owner->pending, and shall return nonzero completion id on success. Currently if BAP stream is Enabling, it returns zero which fails the acquire operation. To fix this, return valid completion id in this case instead. Also keep track of the g_idle_add resume id, so that we don't try to give it to bt_bap_stream_cancel. Fixes sound server getting spurious Not Authorized errors when trying to acquire a pending transport. This can happen on BAP server: linked transports become pending when the first of the two enters Streaming. If sound server tries to acquire the other linked transport whose stream is still Enabling, the acquire fails (media_owner_free + btd_error_not_authorized). Log: =============================================================== profiles/audio/transport.c:bap_state_changed() stream 0x25c2880: qos(2) -> enabling(3) ... profiles/audio/transport.c:bap_state_changed() stream 0x25cc590: qos(2) -> enabling(3) ... src/shared/bap.c:bap_stream_state_changed() stream 0x25cc590 dir 0x01: enabling -> streaming profiles/audio/bap.c:bap_state() stream 0x25cc590: enabling(3) -> streaming(4) profiles/audio/transport.c:bap_state_changed() stream 0x25cc590: enabling(3) -> streaming(4) /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd1: fd(36) ready profiles/audio/transport.c:transport_update_playing() /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd1 State=TRANSPORT_STATE_IDLE Playing=1 profiles/audio/transport.c:transport_set_state() State changed /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd1: TRANSPORT_STATE_IDLE -> TRANSPORT_STATE_PENDING profiles/audio/transport.c:transport_set_state() State changed /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd0: TRANSPORT_STATE_IDLE -> TRANSPORT_STATE_PENDING profiles/audio/transport.c:media_owner_create() Owner created: sender=:1.1242 profiles/audio/transport.c:media_owner_free() Owner :1.1242 ===============================================================
Diffstat
| M | profiles/audio/transport.c | | | 67 | ++++++++++++++++++++++++++++++++++++++++- - - - - - - - - - - - |
1 files changed, 55 insertions(+), 12 deletions(-)