mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 12:37:01 +03:00
simplify alac writebuf alloc
This commit is contained in:
@@ -120,15 +120,14 @@ static int read_mp4_header(void) {
|
|||||||
if (!strcmp(type, "alac") && bytes > len) {
|
if (!strcmp(type, "alac") && bytes > len) {
|
||||||
u8_t *ptr = streambuf->readp + 36;
|
u8_t *ptr = streambuf->readp + 36;
|
||||||
unsigned int block_size;
|
unsigned int block_size;
|
||||||
l->decoder = alac_create_decoder(len - 36, ptr, &l->sample_size, &l->sample_rate, &l->channels, &block_size);
|
|
||||||
l->play = l->trak;
|
l->play = l->trak;
|
||||||
|
l->decoder = alac_create_decoder(len - 36, ptr, &l->sample_size, &l->sample_rate, &l->channels, &block_size);
|
||||||
l->writebuf = malloc(block_size + 256);
|
l->writebuf = malloc(block_size + 256);
|
||||||
|
LOG_INFO("allocated write buffer of %u bytes", block_size);
|
||||||
if (!l->writebuf) {
|
if (!l->writebuf) {
|
||||||
LOG_ERROR("cannot allocate write buffer for %u bytes", block_size);
|
LOG_ERROR("allocation failed");
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
}
|
||||||
LOG_INFO("write buffer of %u bytes", block_size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract the total number of samples from stts
|
// extract the total number of samples from stts
|
||||||
|
|||||||
Reference in New Issue
Block a user