Merge pull request #341 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:opus-keep-fec-on-improve to master

* commit '244331aa1536a0dad2cc115757fc5507446e1b00':
  FS-7819: mod_opus: restore bitrate after increase (if there's no more packet loss) , added step for 60 ms
This commit is contained in:
Brian West 2015-07-10 10:57:36 -05:00
commit 7e660ea856
1 changed files with 5 additions and 1 deletions

View File

@ -648,10 +648,14 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec)
opus_int32 a32,b32; opus_int32 a32,b32;
uint32_t fs = context->enc_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000); uint32_t fs = context->enc_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000);
float frame_rate = 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(&current_bitrate)); opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&current_bitrate));
opus_encoder_ctl(context->encoder_object, OPUS_GET_PACKET_LOSS_PERC(&current_loss)); opus_encoder_ctl(context->encoder_object, OPUS_GET_PACKET_LOSS_PERC(&current_loss));
if ( current_loss == 0 ){
opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(opus_prefs.maxaveragebitrate));
return SWITCH_STATUS_SUCCESS;
}
if( fs == 8000 ) { if( fs == 8000 ) {
LBRR_rate_thres_bps = 12000; /*LBRR_NB_MIN_RATE_BPS*/ LBRR_rate_thres_bps = 12000; /*LBRR_NB_MIN_RATE_BPS*/
} else if( fs == 12000 ) { } else if( fs == 12000 ) {