From 090dd9dbdc5fe05d4d5a654ed0dcd511bf7b0ad8 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Fri, 12 Jul 2019 00:32:14 +0200 Subject: [PATCH] encoders/generic: Fix threading priority and thread count override --- source/encoders/generic.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/source/encoders/generic.cpp b/source/encoders/generic.cpp index 59b846a..d91e238 100644 --- a/source/encoders/generic.cpp +++ b/source/encoders/generic.cpp @@ -380,10 +380,10 @@ encoder::generic::generic(obs_data_t* settings, obs_encoder_t* encoder) static_cast(obs_data_get_int(settings, P_FFMPEG_STANDARDCOMPLIANCE)); this->context->debug = 0; /// Threading - if (this->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) { - this->context->thread_type = FF_THREAD_FRAME; - } else if (this->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) { + if (this->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) { this->context->thread_type = FF_THREAD_SLICE; + } else if (this->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) { + this->context->thread_type = FF_THREAD_FRAME; } else { this->context->thread_type = 0; } @@ -392,13 +392,8 @@ encoder::generic::generic(obs_data_t* settings, obs_encoder_t* encoder) this->context->thread_count = static_cast(threads); this->lag_in_frames = this->context->thread_count; } else { - if (this->codec->capabilities & AV_CODEC_CAP_AUTO_THREADS) { - this->context->thread_count = 0; - this->lag_in_frames = std::thread::hardware_concurrency(); - } else { - this->context->thread_count = std::thread::hardware_concurrency(); - this->lag_in_frames = this->context->thread_count; - } + this->context->thread_count = std::thread::hardware_concurrency(); + this->lag_in_frames = this->context->thread_count; } // Video and Audio exclusive setup