summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/opusenc-dtx.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--media/ffvpx/opusenc-dtx.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/media/ffvpx/opusenc-dtx.patch b/media/ffvpx/opusenc-dtx.patch
new file mode 100644
index 0000000000..bf9fc9de87
--- /dev/null
+++ b/media/ffvpx/opusenc-dtx.patch
@@ -0,0 +1,63 @@
+diff --git a/media/ffvpx/libavcodec/libopusenc.c b/media/ffvpx/libavcodec/libopusenc.c
+--- a/media/ffvpx/libavcodec/libopusenc.c
++++ b/media/ffvpx/libavcodec/libopusenc.c
+@@ -37,16 +37,17 @@ typedef struct LibopusEncOpts {
+ int application;
+ int packet_loss;
+ int fec;
+ int complexity;
+ float frame_duration;
+ int packet_size;
+ int max_bandwidth;
+ int mapping_family;
++ int dtx;
+ #ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+ int apply_phase_inv;
+ #endif
+ } LibopusEncOpts;
+
+ typedef struct LibopusEncContext {
+ AVClass *class;
+ OpusMSEncoder *enc;
+@@ -154,16 +155,23 @@ static int libopus_configure_encoder(AVC
+
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_INBAND_FEC(opts->fec));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set inband FEC: %s\n",
+ opus_strerror(ret));
+
++ ret = opus_multistream_encoder_ctl(enc,
++ OPUS_SET_DTX(opts->dtx));
++ if (ret != OPUS_OK)
++ av_log(avctx, AV_LOG_WARNING,
++ "Unable to set DTX: %s\n",
++ opus_strerror(ret));
++
+ if (avctx->cutoff) {
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_MAX_BANDWIDTH(opts->max_bandwidth));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set maximum bandwidth: %s\n", opus_strerror(ret));
+ }
+
+@@ -551,16 +559,17 @@ static const AVOption libopus_options[]
+ { "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 20.0 }, 2.5, 120.0, FLAGS },
+ { "packet_loss", "Expected packet loss percentage", OFFSET(packet_loss), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, FLAGS },
+ { "fec", "Enable inband FEC. Expected packet loss must be non-zero", OFFSET(fec), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, 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" },
+ { "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "vbr" },
+ { "constrained", "Use constrained VBR", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, "vbr" },
+ { "mapping_family", "Channel Mapping Family", OFFSET(mapping_family), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, FLAGS, "mapping_family" },
++ { "dtx", "Enable DTX", OFFSET(dtx), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
+ #ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+ { "apply_phase_inv", "Apply intensity stereo phase inversion", OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
+ #endif
+ { NULL },
+ };
+
+ static const AVClass libopus_class = {
+ .class_name = "libopus",