Correct multistream variable frame size stride
authorMark Harris <mark.hsj@gmail.com>
Sat, 27 Aug 2016 14:10:15 +0000 (07:10 -0700)
committerMark Harris <mark.hsj@gmail.com>
Sat, 27 Aug 2016 14:10:15 +0000 (07:10 -0700)
The multistream encoder input has st->layout.nb_channels channels.
The number of channels actually encoded is st->layout.nb_streams +
st->layout.nb_coupled_streams, which may be fewer, so ideally it
would only analyze those when computing the optimal frame size, but
there is no code to do that currently.

src/opus_multistream_encoder.c

index e722e31..f4e00fe 100644 (file)
@@ -861,13 +861,11 @@ static int opus_multistream_encode_native
 
    {
       opus_int32 delay_compensation;
-      int channels;
 
-      channels = st->layout.nb_streams + st->layout.nb_coupled_streams;
       opus_encoder_ctl((OpusEncoder*)ptr, OPUS_GET_LOOKAHEAD(&delay_compensation));
       delay_compensation -= Fs/400;
       frame_size = compute_frame_size(pcm, analysis_frame_size,
-            st->variable_duration, channels, Fs, st->bitrate_bps,
+            st->variable_duration, st->layout.nb_channels, Fs, st->bitrate_bps,
             delay_compensation, downmix
 #ifndef DISABLE_FLOAT_API
             , st->subframe_mem