Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelicia Lim <flim@google.com>2016-10-28 19:34:51 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-10-28 22:53:42 +0300
commite564cc509d74ef284fec5f5104249e594a8ca3d4 (patch)
tree2d2167dcb46976fc7f1275a0141664bdd4dfcf50
parent33698ee159ab6ab1de5ae86c62249d0c2ae4d8f7 (diff)
Fix CBR packet sizes for 80 ms
Also clean up comments from the last patches Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
-rw-r--r--src/opus_encoder.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 5d959848..db4cdb16 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1285,7 +1285,6 @@ static opus_int32 encode_multiframe_packet(OpusEncoder *st,
}
}
- /* If encoding multiframes recursively, the true number of frames is rp->nb_frames. */
ret = opus_repacketizer_out_range_impl(rp, 0, nb_frames, data, repacketize_len, 0, !st->use_vbr);
if (ret<0)
@@ -1447,11 +1446,11 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
if (!st->use_vbr)
{
int cbrBytes;
- /* Multiply by 3 to make sure the division is exact. */
- int frame_rate6 = 6*st->Fs/frame_size;
+ /* Multiply by 12 to make sure the division is exact. */
+ int frame_rate12 = 12*st->Fs/frame_size;
/* We need to make sure that "int" values always fit in 16 bits. */
- cbrBytes = IMIN( (6*st->bitrate_bps/8 + frame_rate6/2)/frame_rate6, max_data_bytes);
- st->bitrate_bps = cbrBytes*(opus_int32)frame_rate6*8/6;
+ cbrBytes = IMIN( (12*st->bitrate_bps/8 + frame_rate12/2)/frame_rate12, max_data_bytes);
+ st->bitrate_bps = cbrBytes*(opus_int32)frame_rate12*8/12;
/* Make sure we provide at least one byte to avoid failing. */
max_data_bytes = IMAX(1, cbrBytes);
}