mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-30 07:21:20 +00:00
test/hfp: fix hci parser
This commit is contained in:
parent
d5bcd37fce
commit
20834b7ab7
@ -109,11 +109,22 @@ static void process_file(const char * pklg_path, const char * wav_path, int pack
|
||||
|
||||
uint8_t packet[256];
|
||||
uint32_t size = big_endian_read_32(header, 0) - 9;
|
||||
bytes_read = __read(fd, packet, size);
|
||||
|
||||
uint8_t type = header[12];
|
||||
|
||||
if (type != packet_type) continue;
|
||||
if (type != packet_type) {
|
||||
// skip data
|
||||
while (size){
|
||||
int bytes_to_read = btstack_min(sizeof(packet), size);
|
||||
__read(fd, packet, bytes_to_read);
|
||||
size -= bytes_to_read;
|
||||
}
|
||||
} else {
|
||||
if (size > sizeof(packet) ){
|
||||
printf("Error: size %d, packet counter %d \n", size, sco_packet_counter);
|
||||
exit(10);
|
||||
}
|
||||
bytes_read = __read(fd, packet, size);
|
||||
|
||||
sco_packet_counter++;
|
||||
|
||||
@ -146,6 +157,7 @@ static void process_file(const char * pklg_path, const char * wav_path, int pack
|
||||
|
||||
wav_writer_write_int16(num_samples, audio_frame_out);
|
||||
}
|
||||
}
|
||||
|
||||
wav_writer_close();
|
||||
close(fd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user