shithub: opus

Download patch

ref: 420231ab1956ba64191ae4b6c46462060048ed52
parent: c1959e7dc346fac747ca29efa63ff2a6ddb44f44
author: Jean-Marc Valin <[email protected]>
date: Fri Nov 8 14:53:27 EST 2013

Makes surround bandwidth decision based on the number of channels (duh!)

--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -774,11 +774,11 @@
          equiv_rate = st->bitrate_bps;
          if (frame_size*50 < Fs)
             equiv_rate -= 60*(Fs/frame_size - 50)*st->layout.nb_channels;
-         if (equiv_rate > 112000)
+         if (equiv_rate > 16000*st->layout.nb_channels)
             opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_FULLBAND));
-         else if (equiv_rate > 76000)
+         else if (equiv_rate > 12000*st->layout.nb_channels)
             opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_SUPERWIDEBAND));
-         else if (equiv_rate > 48000)
+         else if (equiv_rate > 8000*st->layout.nb_channels)
             opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_WIDEBAND));
          else
             opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_NARROWBAND));