diff --git a/libavcodec/libopusencc.c b/libavcodec/libopusencc.c
index 2a97811d18..40ee7b8fec 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -33,6 +33,7 @@
typedef struct LibopusEncOpts {
int vbr;
int application;
+ int enable_fec;
int packet_loss;
int complexity;
float frame_duration;
@@ -143,6 +144,13 @@
"Unable to set constrained VBR: %s\n", opus_strerror(ret));
ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_INBAND_FEC(opts->enable_fec));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set enable FEC flag percentage: %s\n",
+ opus_strerror(ret));
+
+ ret = opus_multistream_encoder_ctl(enc,
OPUS_SET_PACKET_LOSS_PERC(opts->packet_loss));
if (ret != OPUS_OK)
av_log(avctx, AV_LOG_WARNING,
@@ -452,6 +460,15 @@
int ret;
int discard_padding;
+ // Reload packet loss setting
+ ret = opus_multistream_encoder_ctl(opus->enc,
+ OPUS_SET_PACKET_LOSS_PERC(opus->opts.packet_loss));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set expected packet loss percentage: %s\n",
+ opus_strerror(ret));
+
+
if (frame) {
ret = ff_af_queue_add(&opus->afq, frame);
if (ret < 0)
@@ -543,6 +560,7 @@
{ "audio", "Favor faithfulness to the input", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_AUDIO }, 0, 0, FLAGS, "application" },
{ "lowdelay", "Restrict to only the lowest delay modes", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0, FLAGS, "application" },
{ "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 20.0 }, 2.5, 120.0, FLAGS },
+ { "enable_fec", "Enable forward error correction", OFFSET(enable_fec), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ "packet_loss", "Expected packet loss percentage", OFFSET(packet_loss), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, FLAGS },
{ "vbr", "Variable bit rate mode", OFFSET(vbr), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 2, FLAGS, "vbr" },
{ "off", "Use constant bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "vbr" },
=1'>hurd.scm