From d5b7d5eaba714556adc0c2912820845cf4710c52 Mon Sep 17 00:00:00 2001
From: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
Date: Wed, 13 Jan 2021 17:12:14 +0100
Subject: [PATCH] media_decoder: enable libopus FEC by default

By default, sets the option to use FEC decoding with libopus when
preparing the decoder context.

Issue: #5155
Change-Id: Icc9dcbbd9df3f538eb2da794e2ff9b6a0380bdc2
---
 src/media/media_decoder.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/media/media_decoder.cpp b/src/media/media_decoder.cpp
index 05f208dea9..24c61e9dfb 100644
--- a/src/media/media_decoder.cpp
+++ b/src/media/media_decoder.cpp
@@ -526,6 +526,11 @@ MediaDecoder::prepareDecoderContext()
         if (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0)
             decoderCtx_->framerate = {30, 1};
     }
+    if (avStream_->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+        if (decoderCtx_->codec_id == AV_CODEC_ID_OPUS) {
+            av_opt_set_int(decoderCtx_, "decode_fec", 1, AV_OPT_SEARCH_CHILDREN);
+        }
+    }
     return 0;
 }
 
-- 
GitLab