3737#if ENABLE_LDAC_IO_TEST
3838# include <ldacBT.h>
3939#endif
40+ #if ENABLE_LHDC
41+ # include <lhdcBT.h>
42+ #endif
4043#if HAVE_SNDFILE
4144# include <sndfile.h>
4245#endif
6063#if ENABLE_LDAC_IO_TEST
6164# include "a2dp-ldac.h"
6265#endif
66+ #if ENABLE_LHDC
67+ # include "a2dp-lhdc.h"
68+ #endif
6369#if ENABLE_MPEG
6470# include "a2dp-mpeg.h"
6571#endif
8187#if ENABLE_OFONO
8288# include "ofono.h"
8389#endif
84- #if ENABLE_LC3PLUS || ENABLE_LDAC_IO_TEST
90+ #if ENABLE_LC3PLUS || ENABLE_LDAC_IO_TEST || ENABLE_LHDC
8591# include "rtp.h"
8692#endif
8793#include "storage.h"
@@ -112,6 +118,8 @@ void *a2dp_lc3plus_dec_thread(struct ba_transport_pcm *t_pcm);
112118void * a2dp_lc3plus_enc_thread (struct ba_transport_pcm * t_pcm );
113119void * a2dp_ldac_dec_thread (struct ba_transport_pcm * t_pcm );
114120void * a2dp_ldac_enc_thread (struct ba_transport_pcm * t_pcm );
121+ void * a2dp_lhdc_dec_thread (struct ba_transport_pcm * t_pcm );
122+ void * a2dp_lhdc_enc_thread (struct ba_transport_pcm * t_pcm );
115123void * a2dp_mp3_enc_thread (struct ba_transport_pcm * t_pcm );
116124void * a2dp_mpeg_dec_thread (struct ba_transport_pcm * t_pcm );
117125void * a2dp_opus_dec_thread (struct ba_transport_pcm * t_pcm );
@@ -212,6 +220,13 @@ static const a2dp_ldac_t config_ldac_48000_stereo = {
212220 .channel_mode = LDAC_CHANNEL_MODE_STEREO ,
213221};
214222
223+ __attribute__ ((unused ))
224+ static const a2dp_lhdc_v3_t config_lhdc_44100_stereo = {
225+ .info = A2DP_VENDOR_INFO_INIT (LHDC_V3_VENDOR_ID , LHDC_V3_CODEC_ID ),
226+ .sampling_freq = LHDC_SAMPLING_FREQ_44100 ,
227+ .bit_depth = LHDC_BIT_DEPTH_24 ,
228+ };
229+
215230__attribute__ ((unused ))
216231static const a2dp_opus_t config_opus_48000_stereo = {
217232 .sampling_freq = OPUS_SAMPLING_FREQ_48000 ,
@@ -1301,6 +1316,39 @@ CK_START_TEST(test_a2dp_ldac) {
13011316} CK_END_TEST
13021317#endif
13031318
1319+ #if ENABLE_LHDC
1320+ CK_START_TEST (test_a2dp_lhdc ) {
1321+
1322+ config .lhdc_eqmid = LHDCBT_QUALITY_HIGH ;
1323+
1324+ struct ba_transport * t1 = test_transport_new_a2dp (device1 ,
1325+ BA_TRANSPORT_PROFILE_A2DP_SOURCE , "/path/lhdc" , & a2dp_lhdc_source ,
1326+ & config_lhdc_44100_stereo );
1327+ struct ba_transport * t2 = test_transport_new_a2dp (device2 ,
1328+ BA_TRANSPORT_PROFILE_A2DP_SINK , "/path/lhdc" , & a2dp_lhdc_sink ,
1329+ & config_lhdc_44100_stereo );
1330+
1331+ struct ba_transport_pcm * t1_pcm = & t1 -> a2dp .pcm ;
1332+ struct ba_transport_pcm * t2_pcm = & t2 -> a2dp .pcm ;
1333+
1334+ if (aging_duration ) {
1335+ t1 -> mtu_read = t1 -> mtu_write = t2 -> mtu_read = t2 -> mtu_write =
1336+ RTP_HEADER_LEN + sizeof (rtp_media_header_t ) + 990 ;
1337+ test_io (t1_pcm , t2_pcm , a2dp_lhdc_enc_thread , a2dp_lhdc_dec_thread , 4 * 1024 );
1338+ }
1339+ else {
1340+ t1 -> mtu_read = t1 -> mtu_write = t2 -> mtu_read = t2 -> mtu_write =
1341+ RTP_HEADER_LEN + sizeof (rtp_media_header_t ) + 990 ;
1342+ test_io (t1_pcm , t2_pcm , a2dp_lhdc_enc_thread , test_io_thread_dump_bt , 2 * 1024 );
1343+ test_io (t1_pcm , t2_pcm , test_io_thread_dump_pcm , a2dp_lhdc_dec_thread , 2 * 1024 );
1344+ }
1345+
1346+ ba_transport_destroy (t1 );
1347+ ba_transport_destroy (t2 );
1348+
1349+ } CK_END_TEST
1350+ #endif
1351+
13041352#if ENABLE_OPUS
13051353CK_START_TEST (test_a2dp_opus ) {
13061354
@@ -1324,6 +1372,9 @@ CK_START_TEST(test_a2dp_opus) {
13241372 test_io (t1_pcm , t2_pcm , test_io_thread_dump_pcm , a2dp_opus_dec_thread , 2 * 1024 );
13251373 }
13261374
1375+ ba_transport_destroy (t1 );
1376+ ba_transport_destroy (t2 );
1377+
13271378} CK_END_TEST
13281379#endif
13291380
@@ -1437,6 +1488,9 @@ int main(int argc, char *argv[]) {
14371488#if ENABLE_LDAC_IO_TEST
14381489 { a2dp_codecs_codec_id_to_string (A2DP_CODEC_VENDOR_ID (LDAC_VENDOR_ID , LDAC_CODEC_ID )), test_a2dp_ldac },
14391490#endif
1491+ #if ENABLE_LHDC
1492+ { a2dp_codecs_codec_id_to_string (A2DP_CODEC_VENDOR_ID (LHDC_V3_VENDOR_ID , LHDC_V3_CODEC_ID )), test_a2dp_lhdc },
1493+ #endif
14401494#if ENABLE_OPUS
14411495 { a2dp_codecs_codec_id_to_string (A2DP_CODEC_VENDOR_ID (OPUS_VENDOR_ID , OPUS_CODEC_ID )), test_a2dp_opus },
14421496#endif
0 commit comments