projects/guix·blob python-team · refs

50 lines · 2.4 KiB

1diff --git a/libavcodec/libopusencc.c b/libavcodec/libopusencc.c
2index 2a97811d18..40ee7b8fec 100644
3--- a/libavcodec/libopusenc.c
4+++ b/libavcodec/libopusenc.c
5@@ -33,6 +33,7 @@
6 typedef struct LibopusEncOpts {
7 int vbr;
8 int application;
9+ int enable_fec;
10 int packet_loss;
11 int complexity;
12 float frame_duration;
13@@ -143,6 +144,13 @@
14 "Unable to set constrained VBR: %s\n", opus_strerror(ret));
15
16 ret = opus_multistream_encoder_ctl(enc,
17+ OPUS_SET_INBAND_FEC(opts->enable_fec));
18+ if (ret != OPUS_OK)
19+ av_log(avctx, AV_LOG_WARNING,
20+ "Unable to set enable FEC flag percentage: %s\n",
21+ opus_strerror(ret));
22+
23+ ret = opus_multistream_encoder_ctl(enc,
24 OPUS_SET_PACKET_LOSS_PERC(opts->packet_loss));
25 if (ret != OPUS_OK)
26 av_log(avctx, AV_LOG_WARNING,
27@@ -452,6 +460,15 @@
28 int ret;
29 int discard_padding;
30
31+ // Reload packet loss setting
32+ ret = opus_multistream_encoder_ctl(opus->enc,
33+ OPUS_SET_PACKET_LOSS_PERC(opus->opts.packet_loss));
34+ if (ret != OPUS_OK)
35+ av_log(avctx, AV_LOG_WARNING,
36+ "Unable to set expected packet loss percentage: %s\n",
37+ opus_strerror(ret));
38+
39+
40 if (frame) {
41 ret = ff_af_queue_add(&opus->afq, frame);
42 if (ret < 0)
43@@ -543,6 +560,7 @@
44 { "audio", "Favor faithfulness to the input", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_AUDIO }, 0, 0, FLAGS, "application" },
45 { "lowdelay", "Restrict to only the lowest delay modes", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0, FLAGS, "application" },
46 { "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 20.0 }, 2.5, 120.0, FLAGS },
47+ { "enable_fec", "Enable forward error correction", OFFSET(enable_fec), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
48 { "packet_loss", "Expected packet loss percentage", OFFSET(packet_loss), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, FLAGS },
49 { "vbr", "Variable bit rate mode", OFFSET(vbr), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 2, FLAGS, "vbr" },
50 { "off", "Use constant bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "vbr" },