shithub: opus

Download patch

ref: efe16c5d470e3d693cc7de1a0cb92a93db3e771c
parent: b180a3feacde90c3e43e5b5b55300eea3317e328
author: Jean-Marc Valin <[email protected]>
date: Thu Sep 29 18:02:37 EDT 2011

don't allow the user to override the bandwidth so that it's above what Fs allows

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -555,6 +555,9 @@
             st->bandwidth = OPUS_BANDWIDTH_WIDEBAND;
     }
 
+    if (st->user_bandwidth != OPUS_AUTO)
+        st->bandwidth = st->user_bandwidth;
+
     /* Prevents Opus from wasting bits on frequencies that are above
        the Nyquist rate of the input signal */
     if (st->Fs <= 24000 && st->bandwidth > OPUS_BANDWIDTH_SUPERWIDEBAND)
@@ -566,8 +569,6 @@
     if (st->Fs <= 8000 && st->bandwidth > OPUS_BANDWIDTH_NARROWBAND)
         st->bandwidth = OPUS_BANDWIDTH_NARROWBAND;
 
-    if (st->user_bandwidth != OPUS_AUTO)
-        st->bandwidth = st->user_bandwidth;
 
     /* Can't support higher than wideband for >20 ms frames */
     if (frame_size > st->Fs/50 && (st->mode == MODE_CELT_ONLY || st->bandwidth > OPUS_BANDWIDTH_WIDEBAND))