Only use automatic bandwidth detection when the user doesn't force bandwidth
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 21 Dec 2012 18:09:43 +0000 (13:09 -0500)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 21 Dec 2012 18:09:43 +0000 (13:09 -0500)
Also fixes an issue with 40- and 60-ms frames using the repacketizer.

src/opus_encoder.c

index d1df5bf..be245bd 100644 (file)
@@ -858,7 +858,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
     if (st->Fs <= 8000 && st->bandwidth > OPUS_BANDWIDTH_NARROWBAND)
         st->bandwidth = OPUS_BANDWIDTH_NARROWBAND;
 #ifndef FIXED_POINT
-    if (st->detected_bandwidth)
+    if (st->detected_bandwidth && st->user_bandwidth == OPUS_AUTO)
     {
        st->bandwidth = IMIN(st->bandwidth, st->detected_bandwidth);
     }