Quanto mais perda de pacotes você especificar, mais dados de redunidade serão codificados no arquivo para poder lidar com isso.
As mentioned FEC, is added in-band by an Opus encoder, but only after being configured to do so. A previous post already discusses all the available options you can set on the encoder, so be sure to check that out if you haven’t already. Here though we’ll discuss some of those options and how they work in combination to make it so the encoder includes FEC data. As stated in the Opus FAQ several conditions must be met before the encoder will add error correction to frames:
- The feature must be enabled. The “fec” option must be set for a defined format (note, options for codec Opus for Asterisk can be set in in codecs.conf ). This option defaults to “no”, so if you don’t specifically enable it Asterisk will not include FEC data when encoding.
- The encoder must be told to expect loss. This means an estimated packet loss percentage must also be specified. Setting this shifts the threshold at which the encoder will start to include FEC data. The higher the number the lower the threshold.
- The codec must be operating in a mode conducive to lower bandwidths. Make sure the maximum bandwidth is set to narrow or medium. This can be achieved by adjusting the “max_bandwidth” option. You can do this either directly by setting the option itself, or indirectly by setting the “max_playback_rate” option to 16khz or less.
Don’t forget to make sure both sides have negotiated for FEC. If everything is properly set up, but one side does not offer FEC (“useinbandfec=yes“) then it will not be enabled.