-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add support for LHDC v2 A2DP source and sink #742
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #742 +/- ##
==========================================
- Coverage 70.51% 70.19% -0.32%
==========================================
Files 96 97 +1
Lines 16005 16067 +62
Branches 2509 2517 +8
==========================================
- Hits 11286 11279 -7
- Misses 4602 4670 +68
- Partials 117 118 +1 ☔ View full report in Codecov by Sentry. |
@anonymix007 I'm trying to add support for LHDC v2 using your library, but it seems that something is not right. As I've mentioned earlier, I have a retail device which is able to stream LHDC v2 codec (Huawei Mate 20 Pro). Unfortunately, the
It seems that the decoder is not able to decode most of the frames... Used A2DP configuration: $ a2dpconf lhdc-v2:3a050000324c140001
LHDC v2 <hex:3a050000324c140001> {
vendor-id:32 = 0x0000053a [Savitech Corp.,]
vendor-codec-id:16 = 0x4c32
<reserved>:2
bit-depth:2 = 24
sample-rate:4 = 48000
low-latency:1 = false
max-bitrate:3 = 900
version:4 = 0
<reserved>:4
ch-split-mode:4 = None
} However, when stream is created with Encoded and decoded sine with patch as follows: diff --git a/src/a2dp-lhdc.c b/src/a2dp-lhdc.c
index f6d50e7..08fc4a2 100644
--- a/src/a2dp-lhdc.c
+++ b/src/a2dp-lhdc.c
@@ -303,7 +303,11 @@ void *a2dp_lhdc_enc_thread(struct ba_transport_pcm *t_pcm) {
if (codec_id == A2DP_CODEC_VENDOR_ID(LHDC_V2_VENDOR_ID, LHDC_V2_CODEC_ID)) {
- if ((rv = lhdcBT_encode(handle, input, bt.tail)) < 0) {
+ int32_t xxx[2048] = { 0 };
+ for (size_t i = 0; i < lhdc_ch_samples; i++)
+ xxx[i] = input[i*2];
+ if ((rv = lhdcBT_encode(handle, xxx, bt.tail)) < 0) {
error("LHDC encoding error: %d", rv);
break;
}
Left channel is garbage, and the encoded channel is decoded as a right one. Also, it seems that the Do you have any idea what might be wrong with v2 here? In next few days I'll try to get some Android phone with LHDC v3 to test the v3 decoder. |
PCM data ends up in this function:
I'll take a look at the dump a bit later.
This could be a bug in my implementation or normal behavior, I'm not sure. Is it happening for just a few first frames or is it consistent?
AFAIU it won't work because sink devices do not do anything to defragment payloads afterwards. |
This PR is a follow-up for #672