Skip to content

Commit c9651c6

Browse files
CC0918nashif
authored andcommitted
Bluetooth: host: a2dp: Fix stream recv callback not be checked
Now when role is sink and source sends data, stream recv callback is not registered, apps works fail. so stream recv callback should be checked. Signed-off-by: Cheng Chang <[email protected]>
1 parent 3657742 commit c9651c6

File tree

1 file changed

+5
-0
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+5
-0
lines changed

subsys/bluetooth/host/classic/a2dp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ static void bt_a2dp_media_data_callback(struct bt_avdtp_sep *sep, struct net_buf
283283
stream = ep->stream;
284284
media_hdr = net_buf_pull_mem(buf, sizeof(*media_hdr));
285285

286+
if (stream->ops == NULL || stream->ops->recv == NULL) {
287+
LOG_WRN("No recv callback registered for stream");
288+
return;
289+
}
290+
286291
stream->ops->recv(stream, buf, sys_be16_to_cpu(media_hdr->sequence_number),
287292
sys_be32_to_cpu(media_hdr->time_stamp));
288293
}

0 commit comments

Comments
 (0)