mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 04:27:12 +03:00
aac was more complicated - best is to ignore last 128 bytes - release
This commit is contained in:
@@ -341,7 +341,9 @@ static decode_state helixaac_decode(void) {
|
|||||||
bytes_total = _buf_used(streambuf);
|
bytes_total = _buf_used(streambuf);
|
||||||
bytes_wrap = min(bytes_total, _buf_cont_read(streambuf));
|
bytes_wrap = min(bytes_total, _buf_cont_read(streambuf));
|
||||||
|
|
||||||
if (stream.state <= DISCONNECT && !bytes_total) {
|
// Helixaac locks when not having enough samples (~7ms lost)
|
||||||
|
if (stream.state <= DISCONNECT && bytes_total < 128) {
|
||||||
|
LOG_WARN("decoder missed %zu bytes at the end", $bytes_total);
|
||||||
UNLOCK_S;
|
UNLOCK_S;
|
||||||
return DECODE_COMPLETE;
|
return DECODE_COMPLETE;
|
||||||
}
|
}
|
||||||
@@ -431,19 +433,12 @@ static decode_state helixaac_decode(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we always have at least WRAPBUF_LEN unless it's the end of a stream
|
// we always have at least WRAPBUF_LEN unless it's the end of a stream
|
||||||
/* There is a bug in helixaac where it overflows its buffer when not having
|
if (bytes_wrap < WRAPBUF_LEN && bytes_wrap != bytes_total) {
|
||||||
* samples and enters an infinite loop so we can't do here the proper test
|
|
||||||
* if (bytes_wrap < WRAPBUF_LEN && bytes_wrap != bytes_total)
|
|
||||||
* but instead we'll zero the wrap buf and provide a safe overflow space
|
|
||||||
* for the decoder
|
|
||||||
*/
|
|
||||||
if (bytes_wrap < WRAPBUF_LEN) {
|
|
||||||
// build a linear buffer if we are crossing the end of streambuf
|
// build a linear buffer if we are crossing the end of streambuf
|
||||||
memcpy(a->wrap_buf, streambuf->readp, bytes_wrap);
|
memcpy(a->wrap_buf, streambuf->readp, bytes_wrap);
|
||||||
memcpy(a->wrap_buf + bytes_wrap, streambuf->buf, min(WRAPBUF_LEN, bytes_total) - bytes_wrap);
|
memcpy(a->wrap_buf + bytes_wrap, streambuf->buf, min(WRAPBUF_LEN, bytes_total) - bytes_wrap);
|
||||||
sptr = a->wrap_buf;
|
sptr = a->wrap_buf;
|
||||||
if (bytes_total < WRAPBUF_LEN) memset(a->wrap_buf + bytes_total, 0, WRAPBUF_LEN - bytes_total);
|
bytes = bytes_wrap = min(WRAPBUF_LEN, bytes_total);
|
||||||
else bytes = bytes_wrap = min(WRAPBUF_LEN, bytes_total);
|
|
||||||
} else {
|
} else {
|
||||||
sptr = streambuf->readp;
|
sptr = streambuf->readp;
|
||||||
bytes = bytes_wrap;
|
bytes = bytes_wrap;
|
||||||
|
|||||||
Reference in New Issue
Block a user