From be489ba34e68c25442b602f390e7fa3477c2c91e Mon Sep 17 00:00:00 2001
From: philippegorley <philippe.gorley@savoirfairelinux.com>
Date: Fri, 9 Aug 2019 15:54:17 -0400
Subject: [PATCH] decoder: disable accel if disabled in settings

Change-Id: Ic38d6cb9d75411bad22013af7eed737a3a09487a
---
 src/media/media_decoder.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/media/media_decoder.cpp b/src/media/media_decoder.cpp
index c278e0c733..9a4106a93c 100644
--- a/src/media/media_decoder.cpp
+++ b/src/media/media_decoder.cpp
@@ -118,6 +118,7 @@ MediaDemuxer::openInput(const DeviceParams& params)
     if(!params.pixel_format.empty()){
         av_dict_set(&options_, "pixel_format", params.pixel_format.c_str(), 0);
     }
+
     JAMI_DBG("Trying to open device %s with format %s, pixel format %s, size %dx%d, rate %lf", params.input.c_str(),
                                                         params.format.c_str(), params.pixel_format.c_str(), params.width, params.height, params.framerate.real());
 
@@ -263,6 +264,12 @@ MediaDecoder::setupStream()
     int ret = 0;
     avcodec_free_context(&decoderCtx_);
 
+#ifdef RING_ACCEL
+    // if there was a fallback to software decoding, do not enable accel
+    // it has been disabled already by the video_receive_thread/video_input
+    enableAccel_ &= Manager::instance().videoPreferences.getDecodingAccelerated();
+#endif
+
     inputDecoder_ = findDecoder(avStream_->codecpar->codec_id);
     if (!inputDecoder_) {
         JAMI_ERR() << "Unsupported codec";
-- 
GitLab