ref: 17922c2a28ea97b2e90e1493123facb0d26c46b5
parent: 562587e91b5ff5534a4b22a1adab7329c6c62670
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Tue Feb 6 10:48:21 EST 2024
Fix internal error on DRED Forgot to account for padding length bytes when DRED payload is large.
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -2395,6 +2395,8 @@
if (st->use_vbr) dred_chunks = IMIN(dred_chunks, st->dred_target_chunks);
/* Remaining space for DRED, accounting for cost the 3 extra bytes for code 3, padding length, and extension number. */
dred_bytes_left = IMIN(DRED_MAX_DATA_SIZE, max_data_bytes-ret-3);
+ /* Account for the extra bytes required to signal large padding length. */
+ dred_bytes_left -= (dred_bytes_left+1+DRED_EXPERIMENTAL_BYTES)/255;
/* Check whether we actually have something to encode. */
if (dred_chunks >= 1 && dred_bytes_left >= DRED_MIN_BYTES+DRED_EXPERIMENTAL_BYTES) {
int dred_bytes;
--
⑨