Reputation: 317
I'm trying to use the opus Forward Error Correction (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 and sends them over UDP.
I'm not clear on the decoding process though.
Upvotes: 8
Views: 4405
Reputation: 317
I managed to make it work.
The encoding part stated in the question was correct:
For the decoding part, when a packet is lost, call the decode function on the next packet first with fec=1 and again with fec=0.
When calling decode with fec=1, the pcm sent will be entirely filled. If you don't know the length that the pcm should be use on the decoder OPUS_GET_LAST_PACKET_DURATION(x) where x will get the the duration of the last packet.
Upvotes: 9