mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 06:32:43 +00:00
lc3: provide octets_per_frame in configure call, update examples
This commit is contained in:
parent
36dbe4b122
commit
da364eec51
@ -59,10 +59,10 @@ typedef struct {
|
||||
* @param context
|
||||
* @param sample_rate
|
||||
* @param frame_duration
|
||||
* @param context
|
||||
* @param octets_per_frame
|
||||
* @return status
|
||||
*/
|
||||
uint8_t (*configure)(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration);
|
||||
uint8_t (*configure)(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame);
|
||||
|
||||
/**
|
||||
* Get number of octets per LC3 frame for bitrate
|
||||
@ -83,28 +83,26 @@ typedef struct {
|
||||
* Decode LC3 Frame into signed 16-bit samples
|
||||
* @param context
|
||||
* @param bytes
|
||||
* @param byte_count
|
||||
* @param BFI Bad Frame Indication flags
|
||||
* @param pcm_out buffer for decoded PCM samples
|
||||
* @param stride count between two consecutive samples
|
||||
* @param BEC_detect Bit Error Detected flag
|
||||
* @return status
|
||||
*/
|
||||
uint8_t (*decode_signed_16)(void * context, const uint8_t *bytes, uint16_t byte_count, uint8_t BFI,
|
||||
uint8_t (*decode_signed_16)(void * context, const uint8_t *bytes, uint8_t BFI,
|
||||
int16_t* pcm_out, uint16_t stride, uint8_t * BEC_detect);
|
||||
|
||||
/**
|
||||
* Decode LC3 Frame into signed 24-bit samples, sign-extended to 32-bit
|
||||
* @param context
|
||||
* @param bytes
|
||||
* @param byte_count
|
||||
* @param BFI Bad Frame Indication flags
|
||||
* @param pcm_out buffer for decoded PCM samples
|
||||
* @param stride count between two consecutive samples
|
||||
* @param BEC_detect Bit Error Detected flag
|
||||
* @return status
|
||||
*/
|
||||
uint8_t (*decode_signed_24)(void * context, const uint8_t *bytes, uint16_t byte_count, uint8_t BFI,
|
||||
uint8_t (*decode_signed_24)(void * context, const uint8_t *bytes, uint8_t BFI,
|
||||
int32_t* pcm_out, uint16_t stride, uint8_t * BEC_detect);
|
||||
|
||||
} btstack_lc3_decoder_t;
|
||||
@ -115,10 +113,10 @@ typedef struct {
|
||||
* @param context
|
||||
* @param sample_rate
|
||||
* @param frame_duration
|
||||
* @param context
|
||||
* @param octets_per_frame
|
||||
* @return status
|
||||
*/
|
||||
uint8_t (*configure)(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration);
|
||||
uint8_t (*configure)(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame);
|
||||
|
||||
/**
|
||||
* Get bitrate from number of octets per LC3 frame
|
||||
@ -141,10 +139,9 @@ typedef struct {
|
||||
* @param pcm_in buffer for decoded PCM samples
|
||||
* @param stride count between two consecutive samples
|
||||
* @param bytes
|
||||
* @param byte_count
|
||||
* @return status
|
||||
*/
|
||||
uint8_t (*encode_signed_16)(void * context, const int16_t* pcm_in, uint16_t stride, uint8_t *bytes, uint16_t byte_count);
|
||||
uint8_t (*encode_signed_16)(void * context, const int16_t* pcm_in, uint16_t stride, uint8_t *bytes);
|
||||
|
||||
/**
|
||||
* Encode LC3 Frame with 24-bit signed PCM samples, sign-extended to 32 bit
|
||||
@ -152,10 +149,9 @@ typedef struct {
|
||||
* @param pcm_in buffer for decoded PCM samples
|
||||
* @param stride count between two consecutive samples
|
||||
* @param bytes
|
||||
* @param byte_count
|
||||
* @return status
|
||||
*/
|
||||
uint8_t (*encode_signed_24)(void * context, const int32_t* pcm_in, uint16_t stride, uint8_t *bytes, uint16_t byte_count);
|
||||
uint8_t (*encode_signed_24)(void * context, const int32_t* pcm_in, uint16_t stride, uint8_t *bytes);
|
||||
|
||||
} btstack_lc3_encoder_t;
|
||||
|
||||
|
@ -55,7 +55,7 @@ static uint16_t lc3_frame_duration_in_us(btstack_lc3_frame_duration_t frame_dura
|
||||
|
||||
/* Decoder implementation */
|
||||
|
||||
static uint8_t lc3_decoder_google_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration){
|
||||
static uint8_t lc3_decoder_google_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame){
|
||||
btstack_lc3_decoder_google_t * instance = (btstack_lc3_decoder_google_t *) context;
|
||||
|
||||
// map frame duration
|
||||
@ -67,6 +67,7 @@ static uint8_t lc3_decoder_google_configure(void * context, uint32_t sample_rate
|
||||
// store config
|
||||
instance->sample_rate = sample_rate;
|
||||
instance->frame_duration = frame_duration;
|
||||
instance->octets_per_frame = octets_per_frame;
|
||||
|
||||
// config decoder
|
||||
instance->decoder = lc3_setup_decoder(duration_us, sample_rate, 0, &instance->decoder_mem);
|
||||
@ -96,7 +97,9 @@ static uint16_t lc3_decoder_google_get_number_samples_per_frame(void * context){
|
||||
return lc3_frame_samples(duration_us, instance->sample_rate);
|
||||
}
|
||||
|
||||
static uint8_t lc3_decoder_google_decode(void * context, const uint8_t *bytes, uint16_t byte_count, uint8_t BFI, enum lc3_pcm_format fmt, void * pcm_out, uint16_t stride, uint8_t * BEC_detect){
|
||||
static uint8_t
|
||||
lc3_decoder_google_decode(void *context, const uint8_t *bytes, uint8_t BFI, enum lc3_pcm_format fmt, void *pcm_out,
|
||||
uint16_t stride, uint8_t *BEC_detect) {
|
||||
btstack_lc3_decoder_google_t * instance = (btstack_lc3_decoder_google_t *) context;
|
||||
|
||||
if (BFI){
|
||||
@ -108,7 +111,7 @@ static uint8_t lc3_decoder_google_decode(void * context, const uint8_t *bytes, u
|
||||
*BEC_detect = 0;
|
||||
}
|
||||
|
||||
int result = lc3_decode(instance->decoder, (const void *) bytes, byte_count, fmt, pcm_out, stride);
|
||||
int result = lc3_decode(instance->decoder, (const void *) bytes, instance->octets_per_frame, fmt, pcm_out, stride);
|
||||
switch (result){
|
||||
case 0: // success
|
||||
return ERROR_CODE_SUCCESS;
|
||||
@ -120,12 +123,12 @@ static uint8_t lc3_decoder_google_decode(void * context, const uint8_t *bytes, u
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t lc3_decoder_google_decode_signed_16(void * context, const uint8_t *bytes, uint16_t byte_count, uint8_t BFI, int16_t* pcm_out, uint16_t stride, uint8_t * BEC_detect){
|
||||
return lc3_decoder_google_decode(context, bytes, byte_count, BFI, LC3_PCM_FORMAT_S16, (void *) pcm_out, stride, BEC_detect);
|
||||
static uint8_t lc3_decoder_google_decode_signed_16(void * context, const uint8_t *bytes, uint8_t BFI, int16_t* pcm_out, uint16_t stride, uint8_t * BEC_detect){
|
||||
return lc3_decoder_google_decode(context, bytes, BFI, LC3_PCM_FORMAT_S16, (void *) pcm_out, stride, BEC_detect);
|
||||
}
|
||||
|
||||
static uint8_t lc3_decoder_google_decode_signed_24(void * context, const uint8_t *bytes, uint16_t byte_count, uint8_t BFI, int32_t* pcm_out, uint16_t stride, uint8_t * BEC_detect) {
|
||||
return lc3_decoder_google_decode(context, bytes, byte_count, BFI, LC3_PCM_FORMAT_S24, (void *) pcm_out, stride, BEC_detect);
|
||||
static uint8_t lc3_decoder_google_decode_signed_24(void * context, const uint8_t *bytes, uint8_t BFI, int32_t* pcm_out, uint16_t stride, uint8_t * BEC_detect) {
|
||||
return lc3_decoder_google_decode(context, bytes, BFI, LC3_PCM_FORMAT_S24, (void *) pcm_out, stride, BEC_detect);
|
||||
}
|
||||
|
||||
static const btstack_lc3_decoder_t btstack_l3c_decoder_google_instance = {
|
||||
@ -143,7 +146,7 @@ const btstack_lc3_decoder_t * btstack_lc3_decoder_google_init_instance(btstack_l
|
||||
|
||||
/* Encoder implementation */
|
||||
|
||||
static uint8_t lc3_encoder_google_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration){
|
||||
static uint8_t lc3_encoder_google_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame){
|
||||
btstack_lc3_encoder_google_t * instance = (btstack_lc3_encoder_google_t *) context;
|
||||
|
||||
// map frame duration
|
||||
@ -155,6 +158,7 @@ static uint8_t lc3_encoder_google_configure(void * context, uint32_t sample_rate
|
||||
// store config
|
||||
instance->sample_rate = sample_rate;
|
||||
instance->frame_duration = frame_duration;
|
||||
instance->octets_per_frame = octets_per_frame;
|
||||
|
||||
// config encoder
|
||||
instance->encoder = lc3_setup_encoder(duration_us, sample_rate, 0, &instance->encoder_mem);
|
||||
@ -185,9 +189,10 @@ static uint16_t lc3_encoder_google_get_number_samples_per_frame(void * context){
|
||||
}
|
||||
return lc3_frame_samples(duration_us, instance->sample_rate);
|
||||
}
|
||||
static uint8_t lc3_encoder_google_encode_signed(void * context, enum lc3_pcm_format fmt, const void *pcm_in, uint16_t stride, uint8_t *bytes, uint16_t byte_count) {
|
||||
static uint8_t
|
||||
lc3_encoder_google_encode_signed(void *context, enum lc3_pcm_format fmt, const void *pcm_in, uint16_t stride, uint8_t *bytes) {
|
||||
btstack_lc3_encoder_google_t * instance = (btstack_lc3_encoder_google_t *) context;
|
||||
int result = lc3_encode(instance->encoder, fmt, pcm_in, stride, byte_count, (void*) bytes);
|
||||
int result = lc3_encode(instance->encoder, fmt, pcm_in, stride, instance->octets_per_frame, (void*) bytes);
|
||||
switch (result){
|
||||
case 0:
|
||||
return ERROR_CODE_SUCCESS;
|
||||
@ -196,12 +201,12 @@ static uint8_t lc3_encoder_google_encode_signed(void * context, enum lc3_pcm_for
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t lc3_encoder_google_encode_signed_16(void * context, const int16_t* pcm_in, uint16_t stride, uint8_t *bytes, uint16_t byte_count){
|
||||
return lc3_encoder_google_encode_signed(context, LC3_PCM_FORMAT_S16, (const void *) pcm_in, stride, bytes, byte_count);
|
||||
static uint8_t lc3_encoder_google_encode_signed_16(void * context, const int16_t* pcm_in, uint16_t stride, uint8_t *bytes){
|
||||
return lc3_encoder_google_encode_signed(context, LC3_PCM_FORMAT_S16, (const void *) pcm_in, stride, bytes);
|
||||
}
|
||||
|
||||
static uint8_t lc3_encoder_google_encode_signed_24(void * context, const int32_t* pcm_in, uint16_t stride, uint8_t *bytes, uint16_t byte_count){
|
||||
return lc3_encoder_google_encode_signed(context, LC3_PCM_FORMAT_S24, (const void *) pcm_in, stride, bytes, byte_count);
|
||||
static uint8_t lc3_encoder_google_encode_signed_24(void * context, const int32_t* pcm_in, uint16_t stride, uint8_t *bytes){
|
||||
return lc3_encoder_google_encode_signed(context, LC3_PCM_FORMAT_S24, (const void *) pcm_in, stride, bytes);
|
||||
}
|
||||
|
||||
static const btstack_lc3_encoder_t btstack_l3c_encoder_google_instance = {
|
||||
|
@ -51,6 +51,7 @@ typedef struct {
|
||||
lc3_decoder_t decoder; // pointer
|
||||
uint32_t sample_rate;
|
||||
btstack_lc3_frame_duration_t frame_duration;
|
||||
uint16_t octets_per_frame;
|
||||
} btstack_lc3_decoder_google_t;
|
||||
|
||||
typedef struct {
|
||||
@ -58,6 +59,7 @@ typedef struct {
|
||||
lc3_encoder_t encoder; // pointer
|
||||
uint32_t sample_rate;
|
||||
btstack_lc3_frame_duration_t frame_duration;
|
||||
uint16_t octets_per_frame;
|
||||
} btstack_lc3_encoder_google_t;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ static uint16_t lc3_frame_duration_in_us(btstack_lc3_frame_duration_t frame_dura
|
||||
|
||||
/* Decoder implementation */
|
||||
|
||||
static uint8_t lc3plus_fraunhofer_decoder_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration){
|
||||
static uint8_t lc3plus_fraunhofer_decoder_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame){
|
||||
btstack_lc3plus_fraunhofer_decoder_t * instance = (btstack_lc3plus_fraunhofer_decoder_t *) context;
|
||||
LC3PLUS_Dec * decoder = (LC3PLUS_Dec*) instance->decoder;
|
||||
|
||||
@ -72,6 +72,7 @@ static uint8_t lc3plus_fraunhofer_decoder_configure(void * context, uint32_t sam
|
||||
// store config
|
||||
instance->sample_rate = sample_rate;
|
||||
instance->frame_duration = frame_duration;
|
||||
instance->octetes_per_frame = octets_per_frame;
|
||||
|
||||
LC3PLUS_Error error;
|
||||
error = lc3plus_dec_init(decoder, sample_rate, 1, LC3PLUS_PLC_ADVANCED, 0);
|
||||
@ -94,7 +95,7 @@ static uint16_t lc3plus_fraunhofer_decoder_get_number_samples_per_frame(void * c
|
||||
return lc3plus_dec_get_output_samples(decoder);
|
||||
}
|
||||
|
||||
static uint8_t lc3plus_fraunhofer_decoder_decode_signed_16(void * context, const uint8_t *bytes, uint16_t byte_count, uint8_t BFI, int16_t* pcm_out, uint16_t stride, uint8_t * BEC_detect){
|
||||
static uint8_t lc3plus_fraunhofer_decoder_decode_signed_16(void * context, const uint8_t *bytes, uint8_t BFI, int16_t* pcm_out, uint16_t stride, uint8_t * BEC_detect){
|
||||
btstack_lc3plus_fraunhofer_decoder_t * instance = (btstack_lc3plus_fraunhofer_decoder_t *) context;
|
||||
LC3PLUS_Dec * decoder = (LC3PLUS_Dec*) instance->decoder;
|
||||
|
||||
@ -103,6 +104,7 @@ static uint8_t lc3plus_fraunhofer_decoder_decode_signed_16(void * context, const
|
||||
output_samples[0] = pcm_out;
|
||||
|
||||
// trigger plc if BFI by passing 0 valid input bytes
|
||||
uint16_t byte_count = instance->octetes_per_frame;
|
||||
if (BFI != 0){
|
||||
byte_count = 0;
|
||||
}
|
||||
@ -123,7 +125,7 @@ static uint8_t lc3plus_fraunhofer_decoder_decode_signed_16(void * context, const
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t lc3plus_fraunhofer_decoder_decode_signed_24(void * context, const uint8_t *bytes, uint16_t byte_count, uint8_t BFI, int32_t* pcm_out, uint16_t stride, uint8_t * BEC_detect) {
|
||||
static uint8_t lc3plus_fraunhofer_decoder_decode_signed_24(void * context, const uint8_t *bytes, uint8_t BFI, int32_t* pcm_out, uint16_t stride, uint8_t * BEC_detect) {
|
||||
btstack_lc3plus_fraunhofer_decoder_t * instance = (btstack_lc3plus_fraunhofer_decoder_t *) context;
|
||||
LC3PLUS_Dec * decoder = (LC3PLUS_Dec*) instance->decoder;
|
||||
|
||||
@ -132,6 +134,7 @@ static uint8_t lc3plus_fraunhofer_decoder_decode_signed_24(void * context, const
|
||||
output_samples[0] = pcm_out;
|
||||
|
||||
// trigger plc if BFI by passing 0 valid input bytes
|
||||
uint16_t byte_count = instance->octetes_per_frame;
|
||||
if (BFI != 0){
|
||||
byte_count = 0;
|
||||
}
|
||||
@ -167,7 +170,7 @@ const btstack_lc3_decoder_t * btstack_lc3plus_fraunhofer_decoder_init_instance(b
|
||||
|
||||
/* Encoder implementation */
|
||||
|
||||
static uint8_t lc3plus_fraunhofer_encoder_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration){
|
||||
static uint8_t lc3plus_fraunhofer_encoder_configure(void * context, uint32_t sample_rate, btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame){
|
||||
btstack_lc3plus_fraunhofer_encoder_t * instance = (btstack_lc3plus_fraunhofer_encoder_t *) context;
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
}
|
||||
|
@ -53,12 +53,14 @@ extern "C" {
|
||||
typedef struct {
|
||||
uint32_t sample_rate;
|
||||
btstack_lc3_frame_duration_t frame_duration;
|
||||
uint16_t octetes_per_frame;
|
||||
uint8_t decoder[LC3PLUS_DEC_MAX_SIZE];
|
||||
} btstack_lc3plus_fraunhofer_decoder_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t sample_rate;
|
||||
btstack_lc3_frame_duration_t frame_duration;
|
||||
uint16_t octetes_per_frame;
|
||||
uint8_t encoder[LC3PLUS_ENC_MAX_SIZE];
|
||||
} btstack_lc3plus_fraunhofer_encoder_t;
|
||||
|
||||
|
@ -232,7 +232,7 @@ static void setup_lc3_encoder(void){
|
||||
for (channel = 0 ; channel < num_bis ; channel++){
|
||||
btstack_lc3_encoder_google_t * context = &encoder_contexts[channel];
|
||||
lc3_encoder = btstack_lc3_encoder_google_init_instance(context);
|
||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration);
|
||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration, octets_per_frame);
|
||||
}
|
||||
number_samples_per_frame = lc3_encoder->get_number_samples_per_frame(&encoder_contexts[0]);
|
||||
btstack_assert(number_samples_per_frame <= MAX_SAMPLES_PER_FRAME);
|
||||
@ -258,7 +258,7 @@ static void setup_lc3_decoder(void){
|
||||
lc3_decoder = btstack_lc3_decoder_google_init_instance(decoder_context);
|
||||
}
|
||||
decoder_contexts[channel] = decoder_context;
|
||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration);
|
||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration, octets_per_frame);
|
||||
}
|
||||
number_samples_per_frame = lc3_decoder->get_number_samples_per_frame(decoder_contexts[0]);
|
||||
btstack_assert(number_samples_per_frame <= MAX_SAMPLES_PER_FRAME);
|
||||
@ -332,7 +332,7 @@ static void test_encoder(){
|
||||
|
||||
// encode frame
|
||||
uint8_t buffer[200];
|
||||
lc3_encoder->encode_signed_16(&encoder_contexts[0], pcm, 1, buffer, octets_per_frame);
|
||||
lc3_encoder->encode_signed_16(&encoder_contexts[0], pcm, 1, buffer);
|
||||
generated_samples += number_samples_per_frame;
|
||||
uint32_t block_encoded_ms = btstack_run_loop_get_time_ms();
|
||||
plc_frame_counter++;
|
||||
@ -346,7 +346,7 @@ static void test_encoder(){
|
||||
|
||||
// decode codec frame
|
||||
uint8_t tmp_BEC_detect;
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[0], buffer, octets_per_frame, BFI, pcm, 1, &tmp_BEC_detect);
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[0], buffer, BFI, pcm, 1, &tmp_BEC_detect);
|
||||
|
||||
uint32_t block_decoded_ms = btstack_run_loop_get_time_ms();
|
||||
|
||||
|
@ -221,7 +221,7 @@ static void setup_lc3_decoder(void){
|
||||
lc3_decoder = btstack_lc3_decoder_google_init_instance(decoder_context);
|
||||
}
|
||||
decoder_contexts[channel] = decoder_context;
|
||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration);
|
||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration, octets_per_frame);
|
||||
}
|
||||
number_samples_per_frame = lc3_decoder->get_number_samples_per_frame(decoder_contexts[0]);
|
||||
btstack_assert(number_samples_per_frame <= MAX_SAMPLES_PER_FRAME);
|
||||
@ -604,7 +604,7 @@ static void store_samples_in_ringbuffer(void){
|
||||
static void plc_do(uint8_t bis_channel) {// inject packet
|
||||
uint8_t tmp_BEC_detect;
|
||||
uint8_t BFI = 1;
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[bis_channel], NULL, cached_iso_sdu_len, BFI,
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[bis_channel], NULL, BFI,
|
||||
&pcm[bis_channel], num_bis,
|
||||
&tmp_BEC_detect);
|
||||
|
||||
@ -737,7 +737,7 @@ static void iso_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *p
|
||||
// decode codec frame
|
||||
uint8_t tmp_BEC_detect;
|
||||
uint8_t BFI = 0;
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[bis_channel], &packet[offset], iso_sdu_length, BFI,
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[bis_channel], &packet[offset], BFI,
|
||||
&pcm[bis_channel], num_bis,
|
||||
&tmp_BEC_detect);
|
||||
have_pcm[bis_channel] = true;
|
||||
|
@ -346,7 +346,7 @@ static void setup_lc3_encoder(void){
|
||||
for (channel = 0 ; channel < num_bis ; channel++){
|
||||
btstack_lc3_encoder_google_t * context = &encoder_contexts[channel];
|
||||
lc3_encoder = btstack_lc3_encoder_google_init_instance(context);
|
||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration);
|
||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration, octets_per_frame);
|
||||
}
|
||||
number_samples_per_frame = lc3_encoder->get_number_samples_per_frame(&encoder_contexts[0]);
|
||||
btstack_assert(number_samples_per_frame <= MAX_SAMPLES_PER_FRAME);
|
||||
@ -404,7 +404,7 @@ static void generate_audio(void){
|
||||
|
||||
static void encode(uint8_t bis_index){
|
||||
// encode as lc3
|
||||
lc3_encoder->encode_signed_16(&encoder_contexts[bis_index], &pcm[bis_index], num_bis, &iso_payload[bis_index * MAX_LC3_FRAME_BYTES], octets_per_frame);
|
||||
lc3_encoder->encode_signed_16(&encoder_contexts[bis_index], &pcm[bis_index], num_bis, &iso_payload[bis_index * MAX_LC3_FRAME_BYTES]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -218,7 +218,7 @@ static void setup_lc3_decoder(void){
|
||||
lc3_decoder = btstack_lc3_decoder_google_init_instance(decoder_context);
|
||||
}
|
||||
decoder_contexts[channel] = decoder_context;
|
||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration);
|
||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration, octets_per_frame);
|
||||
}
|
||||
number_samples_per_frame = lc3_decoder->get_number_samples_per_frame(decoder_contexts[0]);
|
||||
btstack_assert(number_samples_per_frame <= MAX_SAMPLES_PER_FRAME);
|
||||
@ -491,7 +491,7 @@ static void plc_timeout(btstack_timer_source_t * timer) {
|
||||
uint8_t BFI = 1;
|
||||
uint8_t channel;
|
||||
for (channel = 0; channel < num_channels; channel++){
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[channel], NULL, cached_iso_sdu_len, BFI,
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[channel], NULL, BFI,
|
||||
&pcm[channel], num_channels,
|
||||
&tmp_BEC_detect);
|
||||
}
|
||||
@ -568,7 +568,7 @@ static void iso_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *p
|
||||
// decode codec frame
|
||||
uint8_t tmp_BEC_detect;
|
||||
uint8_t BFI = 0;
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[channel], &packet[offset], octets_per_frame, BFI,
|
||||
(void) lc3_decoder->decode_signed_16(decoder_contexts[channel], &packet[offset], BFI,
|
||||
&pcm[channel], num_channels,
|
||||
&tmp_BEC_detect);
|
||||
offset += octets_per_frame;
|
||||
|
@ -259,7 +259,7 @@ static void setup_lc3_encoder(void){
|
||||
for (channel = 0 ; channel < num_channels ; channel++){
|
||||
btstack_lc3_encoder_google_t * context = &encoder_contexts[channel];
|
||||
lc3_encoder = btstack_lc3_encoder_google_init_instance(context);
|
||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration);
|
||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration, octets_per_frame);
|
||||
}
|
||||
number_samples_per_frame = lc3_encoder->get_number_samples_per_frame(&encoder_contexts[0]);
|
||||
btstack_assert(number_samples_per_frame <= MAX_SAMPLES_PER_FRAME);
|
||||
@ -317,7 +317,7 @@ static void generate_audio(void){
|
||||
|
||||
static void encode(uint8_t channel){
|
||||
// encode as lc3
|
||||
lc3_encoder->encode_signed_16(&encoder_contexts[channel], &pcm[channel], num_channels, &iso_payload[channel * MAX_LC3_FRAME_BYTES], octets_per_frame);
|
||||
lc3_encoder->encode_signed_16(&encoder_contexts[channel], &pcm[channel], num_channels, &iso_payload[channel * MAX_LC3_FRAME_BYTES]);
|
||||
}
|
||||
|
||||
static void send_iso_packet(uint8_t cis_index){
|
||||
|
Loading…
x
Reference in New Issue
Block a user