]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10551: [mod_opus] added FEC bitrates map for opus@16000h (for the "keep-fec-enable...
authorDragos Oancea <dragos.oancea@nexmo.com>
Thu, 27 Jul 2017 15:59:16 +0000 (16:59 +0100)
committerDragos Oancea <dragos.oancea@nexmo.com>
Thu, 27 Jul 2017 15:59:16 +0000 (16:59 +0100)
src/mod/codecs/mod_opus/mod_opus.c

index 07699cc50d937e750bdba4a0181e2f7b9c78b408..b06d8fa18894f40b9c09393fb94cb3839693dbbe 100644 (file)
@@ -437,7 +437,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng
  * at the beginning of the call. */
 static int switch_opus_get_fec_bitrate(int fs, int loss)
 {
-       int threshold_bitrates[25] = {
+       int threshold_bitrates_8k[25] = {
                15600,15200,15200,15200,14800,
                14800,14800,14800,14400,14400,
                14400,14000,14000,14000,13600,
@@ -445,15 +445,29 @@ static int switch_opus_get_fec_bitrate(int fs, int loss)
                13200,12800,12800,12800,12400
        };
 
+       int threshold_bitrates_16k[25] = {
+               20400, 20400, 20000, 20000, 19600,
+               19600, 19600, 19200, 19200, 18800,
+               18800, 18800, 18400, 18400, 18000,
+               18000, 18000, 17600, 17600, 17200,
+               17200, 17200, 16800, 16800, 16400
+       };
+
        if (loss <= 0){
                return SWITCH_STATUS_FALSE;
        }
 
        if (fs == 8000) {
                if (loss >=25) {
-                       return threshold_bitrates[24];
+                       return threshold_bitrates_8k[24];
+               } else {
+                       return threshold_bitrates_8k[loss-1];
+               }
+       } else if (fs == 16000) {
+               if (loss >=25) {
+                       return threshold_bitrates_16k[24];
                } else {
-                       return threshold_bitrates[loss-1];
+                       return threshold_bitrates_16k[loss-1];
                }
        }