opusenc-dtx.patch (1804B)
1 diff --git a/media/ffvpx/libavcodec/libopusenc.c b/media/ffvpx/libavcodec/libopusenc.c 2 index 6b8b2cda0ec66..d1095d3177606 100644 3 --- a/media/ffvpx/libavcodec/libopusenc.c 4 +++ b/media/ffvpx/libavcodec/libopusenc.c 5 @@ -43,6 +43,7 @@ typedef struct LibopusEncOpts { 6 int packet_size; 7 int max_bandwidth; 8 int mapping_family; 9 + int dtx; 10 #ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST 11 int apply_phase_inv; 12 #endif 13 @@ -160,6 +161,13 @@ static int libopus_configure_encoder(AVCodecContext *avctx, OpusMSEncoder *enc, 14 "Unable to set inband FEC: %s\n", 15 opus_strerror(ret)); 16 17 + ret = opus_multistream_encoder_ctl(enc, 18 + OPUS_SET_DTX(opts->dtx)); 19 + if (ret != OPUS_OK) 20 + av_log(avctx, AV_LOG_WARNING, 21 + "Unable to set DTX: %s\n", 22 + opus_strerror(ret)); 23 + 24 if (avctx->cutoff) { 25 ret = opus_multistream_encoder_ctl(enc, 26 OPUS_SET_MAX_BANDWIDTH(opts->max_bandwidth)); 27 @@ -557,6 +565,7 @@ static const AVOption libopus_options[] = { 28 { "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, .unit = "vbr" }, 29 { "constrained", "Use constrained VBR", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, .unit = "vbr" }, 30 { "mapping_family", "Channel Mapping Family", OFFSET(mapping_family), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, FLAGS, .unit = "mapping_family" }, 31 + { "dtx", "Enable DTX", OFFSET(dtx), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, 32 #ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST 33 { "apply_phase_inv", "Apply intensity stereo phase inversion", OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS }, 34 #endif