Skip to content

Conversation

MarkWangChinese
Copy link
Contributor

@MarkWangChinese MarkWangChinese commented Aug 26, 2025

add BT_A2DP_STREAM_BUF_MTU_RESERVE to let app to know how many bytes are reserved from l2cap mtu.

I add one new A2DP API (bt_a2dp_stream_alloc_buf), then application don't need this MACRO, application can use the buf->len to check how many bytes of l2cap MTU is occupied. #95259

implement the remaining API of a2dp_codec_sbc.h
implement the a2dp source sample.
implement the a2dp sink sample, only mimxrt1170_evk@B board's codec is supported now.

@Thalley
Copy link
Contributor

Thalley commented Aug 27, 2025

@MarkWangChinese What's in the music.h file?
image

Github cannot handle files of that size

@Thalley Thalley requested a review from Copilot August 27, 2025 08:16
Copilot

This comment was marked as outdated.

@MarkWangChinese
Copy link
Contributor Author

@MarkWangChinese What's in the music.h file? image

Github cannot handle files of that size

It is a piece of one public music. NXP SDK examples used it, I put it here too. People can hear the music from the peer's headsets. I think it has better experience than sine. I have the sine.h file too. If Zephyr can't has this file, I can remove it and only keep sine.h.

@JarmouniA
Copy link
Contributor

It is a piece of one public music. NXP SDK examples used it, I put it here too. People can hear the music from the peer's headsets. I think it has better experience than sine. I have the sine.h file too. If Zephyr can't has this file, I can remove it and only keep sine.h.

https://docs.zephyrproject.org/latest/contribute/bin_blobs.html

@MarkWangChinese MarkWangChinese force-pushed the feature/impl_a2dp_samples branch from 9ce89f2 to d8935b7 Compare August 28, 2025 02:59
@MarkWangChinese
Copy link
Contributor Author

https://docs.zephyrproject.org/latest/contribute/bin_blobs.html

OK, I have removed the music.h from this pr. If needed, I will add the music.h back as blob in another pr.

@Thalley
Copy link
Contributor

Thalley commented Aug 28, 2025

@MarkWangChinese since I'm not familiar with A2DP or any classic audio, I'm not sure if my review will be worth a lot. I'll keep myself oriented about this PR, and if I do find some spare time in the near future, I will do a proper review, given that I'm the Maintainer of the LE Audio, but for now I hope some people more familiar with classic can review this :)

Copilot

This comment was marked as outdated.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds complete A2DP sample implementations for both source and sink roles, fixes the SBC channel mode constant typo from "STREO" to "STEREO", and implements remaining SBC codec helper APIs. The implementation includes functional audio encoding/decoding with optional codec support for hardware playback.

  • Fixes misspelled constant from A2DP_SBC_CH_MODE_STREO to A2DP_SBC_CH_MODE_STEREO
  • Implements remaining A2DP SBC codec helper functions for block length, subband number, allocation method, and channel mode
  • Adds complete A2DP source sample with SBC encoding, device discovery, and audio streaming
  • Adds complete A2DP sink sample with SBC decoding and optional hardware codec playback support

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
subsys/bluetooth/host/classic/shell/a2dp.c Fixes spelling of STREO to STEREO constant
subsys/bluetooth/host/classic/a2dp_codec_sbc.c Implements missing SBC helper functions and fixes constant spelling
samples/bluetooth/classic/a2dp_source/* Complete A2DP source sample implementation with encoding and streaming
samples/bluetooth/classic/a2dp_sink/* Complete A2DP sink sample implementation with decoding and codec support
include/zephyr/bluetooth/classic/a2dp_codec_sbc.h Adds function declarations for new SBC helper functions
include/zephyr/bluetooth/classic/a2dp.h Fixes constant spelling and adds doxygen documentation
doc/connectivity/bluetooth/api/* Adds A2DP API documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

bt_shell_print(" Dual ");
}
if (0U != (codec_ie[0U] & A2DP_SBC_CH_MODE_STREO)) {
if (0U != (codec_ie[0U] & A2DP_SBC_CH_MODE_STEREO)) {
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant name was corrected from 'STREO' to 'STEREO' which fixes the spelling error.

Copilot uses AI. Check for mistakes.

@lylezhu2012 lylezhu2012 changed the title Feature/impl a2dp samples Bluetooth: Classic: Feature/impl a2dp samples Sep 16, 2025
@MarkWangChinese MarkWangChinese force-pushed the feature/impl_a2dp_samples branch from 1a27cd8 to b7f33bf Compare September 16, 2025 13:04
implement the remaining API of a2dp_codec_sbc.h

Signed-off-by: Mark Wang <[email protected]>
implement the a2dp source sample.

Signed-off-by: Mark Wang <[email protected]>
@MarkWangChinese MarkWangChinese force-pushed the feature/impl_a2dp_samples branch from b7f33bf to 7f24796 Compare October 9, 2025 07:08
implement the a2dp sink sample, only mimxrt1170_evk@B board's codec is
supported now.

Signed-off-by: Mark Wang <[email protected]>
add a2dp to the doc

Signed-off-by: Mark Wang <[email protected]>
@MarkWangChinese MarkWangChinese force-pushed the feature/impl_a2dp_samples branch from 7f24796 to b1bdc60 Compare October 9, 2025 07:38
@hermabe hermabe removed their request for review October 9, 2025 07:48
Copy link

sonarqubecloud bot commented Oct 9, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Classic Bluetooth Classic (BR/EDR) area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth area: Samples Samples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants