test/le_audio: fix plc for 16-bit packet sequence counter

This commit is contained in:
Matthias Ringwald 2022-09-02 10:38:58 +02:00
parent a9d566f789
commit ae7e4c110c

View File

@ -135,9 +135,10 @@ static hci_con_handle_t bis_con_handles[MAX_NUM_BIS];
static unsigned int next_bis_index;
// analysis
static bool last_packet_received[MAX_NUM_BIS];
static uint16_t last_packet_sequence[MAX_NUM_BIS];
static uint32_t last_packet_time_ms[MAX_NUM_BIS];
static uint8_t last_packet_prefix[MAX_NUM_BIS * PACKET_PREFIX_LEN];
static uint8_t last_packet_prefix[MAX_NUM_BIS * PACKET_PREFIX_LEN];
// BIG Sync
static le_audio_big_sync_t big_sync_storage;
@ -539,6 +540,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
app_state = APP_STREAMING;
last_samples_report_ms = btstack_run_loop_get_time_ms();
memset(last_packet_sequence, 0, sizeof(last_packet_sequence));
memset(last_packet_received, 0, sizeof(last_packet_received));
printf("Start receiving\n");
break;
}
@ -661,14 +663,16 @@ static void iso_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *p
} else {
if (last_packet_sequence[bis_channel] > 0){
int32_t packet_sequence_delta = btstack_time_delta(packet_sequence_number, last_packet_sequence[bis_channel]);
if (last_packet_received[bis_channel]){
int16_t packet_sequence_delta = btstack_time16_delta(packet_sequence_number, last_packet_sequence[bis_channel]);
if (packet_sequence_delta < 1){
// drop delayed packet -- should not happen
// drop delayed packet that had already been generated by PLC
printf("Dropping delayed packet. Current sequence number %u, last received or generated by PLC: %u\n",
packet_sequence_number, last_packet_sequence[bis_channel]);
return;
}
} else {
last_packet_received[bis_channel] = true;
}
// decode codec frame