Skip to content

Implement the sbc encoder and decoder based on Android Bluetooth SBC #88865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MarkWangChinese
Copy link
Collaborator

  • It is based on Android Bluetooth SBC.
  • The Android Bluetooth SBC is being proposed as an external library in submodule repo (libsbc).

Copy link

github-actions bot commented Apr 21, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
libsbc 🆕 N/A (Added) zephyrproject-rtos/libsbc@8e1beda (main) N/A

DNM label due to: 1 added project

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-libsbc DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Apr 21, 2025
@MarkWangChinese MarkWangChinese force-pushed the feature/impl_sbc_codec branch 2 times, most recently from 85f9924 to 4a7d78d Compare April 25, 2025 08:36
@nashif nashif added the area: Bluetooth Classic Bluetooth Classic (BR/EDR) label Apr 26, 2025
@nashif nashif requested a review from jhedberg April 26, 2025 14:06
Copy link
Member

@jhedberg jhedberg left a comment

Choose a reason for hiding this comment

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

Some comments on function return values

Comment on lines 16 to 18
if (encoder == NULL) {
return -1;
}
Copy link
Member

Choose a reason for hiding this comment

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

Do you really want to return -EPERM here, since EPERM is defined as 1? That's how this would get interpreted by the caller assuming that this function is returning negative posix error codes (like you're doing with -EINVAL and -EOVERFLOW in other places of the function).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed them all. I changed to use the negative posix error codes, but missed some.

encoder_params->s16SamplingFreq = 3;
break;
default:
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Same here

uint32_t ret;

if ((encoder == NULL) || (in_data == NULL) || (out_data == NULL)) {
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

This function returns uint32_t so it doesn't make sense to try to return a negative value.

OI_STATUS status;

if (decoder == NULL) {
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Same as -EPERM, i.e. probably not what you want.

Use the Android Bluetooth SBC encoder and decoder.
The Android Bluetooth SBC is put as external library (libsbc).
sbc.c/sbc.h implement the interface that is compliant with
Zephyr style and can be used by Zephyr's other modules (
like A2DP).

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
add libsbc to west.yml and add libsbc to MAINTAINERS.yml

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
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: Process DNM (manifest) This PR should not be merged (controlled by action-manifest) manifest manifest-libsbc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants