diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-13 14:08:22 -0500 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-13 23:22:37 -0500 |
commit | c5635d284b489c7705c2357cc4f0601587416b78 (patch) | |
tree | 61db8c6caf108d7b8ccdffbee91415b5e347cdd0 /src/opus_multistream_encoder.c | |
parent | 8bbdf5fa0a98d686df6a3bdc5553dbdaa82b1019 (diff) | |
download | opus-c5635d284b489c7705c2357cc4f0601587416b78.tar.gz |
Adds packet padding that works for all codes and fixes 40/60 ms CBR.
Padding is now handled by the repacketizer.
Diffstat (limited to 'src/opus_multistream_encoder.c')
-rw-r--r-- | src/opus_multistream_encoder.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c index 4430e694..7cb1af7d 100644 --- a/src/opus_multistream_encoder.c +++ b/src/opus_multistream_encoder.c @@ -757,7 +757,7 @@ static int opus_multistream_encode_native surround_rate_allocation(st, bitrates, frame_size); if (!vbr) - max_data_bytes = IMIN(max_data_bytes, st->bitrate_bps/(8*Fs/frame_size)); + max_data_bytes = IMIN(max_data_bytes, 3*st->bitrate_bps/(3*8*Fs/frame_size)); ptr = (char*)st + align(sizeof(OpusMSEncoder)); for (s=0;s<st->layout.nb_streams;s++) @@ -859,13 +859,8 @@ static int opus_multistream_encode_native while taking into account the fact that the encoder can now return more than one frame at a time (e.g. 60 ms CELT-only) */ opus_repacketizer_cat(&rp, tmp_data, len); - len = opus_repacketizer_out_range_impl(&rp, 0, opus_repacketizer_get_nb_frames(&rp), data, max_data_bytes-tot_size, s != st->layout.nb_streams-1); - if (!vbr && s == st->layout.nb_streams-1 && curr_max > len) - { - /* Can pad_frame() still fail here? */ - if (!pad_frame(data, len, curr_max)) - len = curr_max; - } + len = opus_repacketizer_out_range_impl(&rp, 0, opus_repacketizer_get_nb_frames(&rp), + data, max_data_bytes-tot_size, s != st->layout.nb_streams-1, !vbr && s == st->layout.nb_streams-1); data += len; tot_size += len; } |