From: Luiz Augusto von Dentz Date: Tue, 24 Jan 2023 23:45:39 +0000 (-0800) Subject: bap: Fix not removing endpoint if local PAC is unregistered X-Git-Tag: accepted/tizen/unified/20240117.163238~375 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2da24029356352266ca1c9404ea7fdf73c1173d8;p=platform%2Fupstream%2Fbluez.git bap: Fix not removing endpoint if local PAC is unregistered If local PAC is unregistered it would also notify via pac_removed callback which shall unregister the endpoint D-Bus object. Fixes: https://github.com/bluez/bluez/issues/457#issuecomment-1402178691 --- diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 24d7a03..4d5780f 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1051,12 +1051,12 @@ static void pac_added(struct bt_bap_pac *pac, void *user_data) bt_bap_foreach_pac(data->bap, BT_BAP_SINK, pac_found, service); } -static bool ep_match_rpac(const void *data, const void *match_data) +static bool ep_match_pac(const void *data, const void *match_data) { const struct bap_ep *ep = data; const struct bt_bap_pac *pac = match_data; - return ep->rpac == pac; + return ep->rpac == pac || ep->lpac == pac; } static void pac_removed(struct bt_bap_pac *pac, void *user_data) @@ -1084,7 +1084,7 @@ static void pac_removed(struct bt_bap_pac *pac, void *user_data) return; } - ep = queue_remove_if(queue, ep_match_rpac, pac); + ep = queue_remove_if(queue, ep_match_pac, pac); if (!ep) return;