From f127a2cce7f34bfe213754b8756fb96e983f7d0b Mon Sep 17 00:00:00 2001
From: Arjen Hiemstra <ahiemstra@heimr.nl>
Date: Thu, 20 Mar 2025 14:28:29 +0100
Subject: [PATCH] Set "threads" option by default in Encoder

So we don't have to repeat this in other encoders.
---
 src/encoder.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/encoder.cpp b/src/encoder.cpp
index f8b3d67..874ac08 100644
--- a/src/encoder.cpp
+++ b/src/encoder.cpp
@@ -189,6 +189,8 @@ AVDictionary *Encoder::buildEncodingOptions()
 {
     AVDictionary *options = NULL;
 
+    av_dict_set_int(&options, "threads", qMin(16, QThread::idealThreadCount()), 0);
+
     switch (m_encodingPreference) {
     case PipeWireBaseEncodedStream::EncodingPreference::NoPreference:
         av_dict_set(&options, "preset", "veryfast", 0);
-- 
GitLab

