Gives the Opus code direct access to (non-opaque) OpusRepacketizer
This avoids potential alignment issues with allocating a char array on the stack.
This commit is contained in:
parent
f340bba0f2
commit
c8649d0e0b
4 changed files with 17 additions and 22 deletions
|
@ -237,13 +237,10 @@ int opus_multistream_encode_float(
|
|||
VARDECL(opus_val16, buf);
|
||||
/* Max size in case the encoder decides to return three frames */
|
||||
unsigned char tmp_data[3*1275+7];
|
||||
VARDECL(unsigned char, rp_);
|
||||
OpusRepacketizer *rp;
|
||||
OpusRepacketizer rp;
|
||||
ALLOC_STACK;
|
||||
|
||||
ALLOC(buf, 2*frame_size, opus_val16);
|
||||
ALLOC(rp_, opus_repacketizer_get_size(), unsigned char);
|
||||
rp = (OpusRepacketizer*)rp_;
|
||||
ptr = (char*)st + align(sizeof(OpusMSEncoder));
|
||||
coupled_size = opus_encoder_get_size(2);
|
||||
mono_size = opus_encoder_get_size(1);
|
||||
|
@ -261,7 +258,7 @@ int opus_multistream_encode_float(
|
|||
int len;
|
||||
int curr_max;
|
||||
|
||||
opus_repacketizer_init(rp);
|
||||
opus_repacketizer_init(&rp);
|
||||
enc = (OpusEncoder*)ptr;
|
||||
if (s < st->layout.nb_coupled_streams)
|
||||
{
|
||||
|
@ -293,8 +290,8 @@ int opus_multistream_encode_float(
|
|||
/* We need to use the repacketizer to add the self-delimiting lengths
|
||||
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);
|
||||
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);
|
||||
data += len;
|
||||
tot_size += len;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue