diff --git a/android/a2dp.c b/android/a2dp.c
index 515cf17..12a8a69 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
void *user_data)
{
struct a2dp_endpoint *endpoint = user_data;
+ struct a2dp_setup *setup;
DBG("");
- if (!err)
+ if (err) {
+ setup_remove_by_id(endpoint->id);
return;
+ }
- setup_remove_by_id(endpoint->id);
+ setup = find_setup(endpoint->id);
+ if (!setup) {
+ error("Unable to find stream setup for %u endpoint",
+ endpoint->id);
+ return;
+ }
+
+ bt_audio_notify_state(setup, HAL_AUDIO_STOPPED);
}
static void sep_close_cfm(struct avdtp *session, struct avdtp_local_sep *sep,