[opus] Using FEC

Jean-Marc Valin jmvalin at jmvalin.ca
Fri Mar 30 15:44:54 UTC 2018

On 03/22/2018 05:48 AM, Elinor Alpay wrote:
> I'm trying to use the FEC feature.
> I have a service which does the encoding with OPUS_SET_INBAND_FEC(1)
> and OPUS_SET_PACKET_LOSS_PERC(20) with 10ms packets.

Sounds good -- assuming you indeed have around 20% loss which is really
a lot.

> I'm not clear on the decoding process though.
> 1- When a packet is lost, do I need to call decode with fec=1 ONLY or do
> I need to call decode with fec=0 after as well?

When packet N goes missing, then you want to decode packet N+1 with
fec=1, then decode packet N+1 again with fec=0. After that, you can move
on to packet N+2.

> 2- How do I know up front the size of the pcm that I send to decode with
> fec enabled?

The number of PCM samples you get for a packet with fec=1 is always
guaranteed to be the same as what you get with fec=0. You can get the
size with opus_packet_get_nb_samples().



More information about the opus mailing list