diff options
author | Felicia Lim <flim@google.com> | 2016-10-28 11:11:18 -0700 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-10-28 15:54:05 -0400 |
commit | bcfe0f68e34371ac1f8edca6bd87092241e173b4 (patch) | |
tree | 75dea3eceba8929a9dd5781b48002a2c22840a0d /src/opus_multistream_encoder.c | |
parent | e564cc509d74ef284fec5f5104249e594a8ca3d4 (diff) | |
download | opus-bcfe0f68e34371ac1f8edca6bd87092241e173b4.tar.gz |
Multistream encoder: allocate an extra byte per stream for 100 ms
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
Diffstat (limited to 'src/opus_multistream_encoder.c')
-rw-r--r-- | src/opus_multistream_encoder.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c index 6ec0fc5a..83e17584 100644 --- a/src/opus_multistream_encoder.c +++ b/src/opus_multistream_encoder.c @@ -915,6 +915,9 @@ static int opus_multistream_encode_native /* Smallest packet the encoder can produce. */ smallest_packet = st->layout.nb_streams*2-1; + /* 100 ms needs an extra byte per stream for the ToC. */ + if (Fs/frame_size == 10) + smallest_packet += st->layout.nb_streams; if (max_data_bytes < smallest_packet) { RESTORE_STACK; @@ -1036,6 +1039,9 @@ static int opus_multistream_encode_native curr_max = max_data_bytes - tot_size; /* Reserve one byte for the last stream and two for the others */ curr_max -= IMAX(0,2*(st->layout.nb_streams-s-1)-1); + /* For 100 ms, reserve an extra byte per stream for the Toc */ + if (Fs/frame_size == 10) + curr_max -= st->layout.nb_streams-s; curr_max = IMIN(curr_max,MS_FRAME_TMP); /* Repacketizer will add one or two bytes for self-delimited frames */ if (s != st->layout.nb_streams-1) curr_max -= curr_max>253 ? 2 : 1; |