From: Dragos Oancea Date: Thu, 9 Jul 2015 11:22:19 +0000 (-0400) Subject: FS-7819: mod_opus: restore bitrate after increase (if there's no more packet loss... X-Git-Tag: v1.6.2~303^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=244331aa1536a0dad2cc115757fc5507446e1b00;p=thirdparty%2Ffreeswitch.git FS-7819: mod_opus: restore bitrate after increase (if there's no more packet loss) , added step for 60 ms --- diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 02287e4995..49914ee061 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -634,10 +634,14 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec) opus_int32 a32,b32; uint32_t fs = context->enc_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000); float frame_rate = 1000 / (codec->implementation->microseconds_per_packet / 1000); - uint32_t step = 8000 / (codec->implementation->microseconds_per_packet / 1000); /* this works for 10 ms, 20 ms and 40 ms frame sizes. not for 60 ms*/ + uint32_t step = (codec->implementation->microseconds_per_packet / 1000) != 60 ? 8000 / (codec->implementation->microseconds_per_packet / 1000 ) : 134 ; opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(¤t_bitrate)); opus_encoder_ctl(context->encoder_object, OPUS_GET_PACKET_LOSS_PERC(¤t_loss)); + if ( current_loss == 0 ){ + opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(opus_prefs.maxaveragebitrate)); + return SWITCH_STATUS_SUCCESS; + } if( fs == 8000 ) { LBRR_rate_thres_bps = 12000; /*LBRR_NB_MIN_RATE_BPS*/ } else if( fs == 12000 ) {