guix/gnu/packages/patches/ffmpeg-jami-libopusenc-enable-FEC.patch
Maxim Cournoyer de002b93db
gnu: ffmpeg-jami: Relocate to (gnu packages video).
To avoid Guile module dependency cycles, inherited packages must be defined in
the same module.  Use this opportunity to simplify the patches applying
mechanism, versioning custom patches the same as for other packages.

* gnu/packages/patches/ffmpeg-jami-change-RTCP-ratio.patch: New file.
* gnu/packages/patches/ffmpeg-jami-rtp_ext_abs_send_time.patch: Likewise.
* gnu/packages/patches/ffmpeg-jami-libopusdec-enable-FEC.patch: Likewise.
* gnu/packages/patches/ffmpeg-jami-libopusenc-enable-FEC.patch: Likewise.
* gnu/packages/patches/ffmpeg-jami-libopusenc-reload-packet-loss-at-encode.patch:
Likewise.
* gnu/packages/patches/ffmpeg-jami-remove-mjpeg-log.patch: Likewise.
* gnu/packages/patches/ffmpeg-jami-screen-sharing-x11-fix.patch: Likewise.
* gnu/local.mk (dist_patch_DATA): Register them.
* gnu/packages/jami.scm (jami-apply-custom-patches): Delete procedure.
(%ffmpeg-default-configure-flags): Delete variable.
(ffmpeg-compose-configure-flags): Delete procedure.
(ffmpeg-jami): Move to...
* gnu/packages/video.scm (ffmpeg-jami): ... here.  Apply patches to origin and
repatriate configure flags.

Change-Id: Id374fae18240cd76b224915d80b61422635ccb77
2024-01-09 22:10:12 -05:00

50 lines
2.4 KiB
Diff

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" },