summaryrefslogtreecommitdiffstats
path: root/GUI
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-06-27 01:04:44 -0700
committeryum <yum.food.vr@gmail.com>2023-06-27 01:04:44 -0700
commit40e0202f5954c475c9c48155b95bc4dc67433242 (patch)
treed76d66a7a1ae355f4c5decce5842d3cf661b6ac7 /GUI
parent694756a96a6109cd79a77221dd4e40638ff55b82 (diff)
Limit priority of transcription process
Seems to help reduce impact on time-sensitive apps like OBS.
Diffstat (limited to 'GUI')
-rw-r--r--GUI/GUI/GUI/PythonWrapper.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp
index 037d961..9855b00 100644
--- a/GUI/GUI/GUI/PythonWrapper.cpp
+++ b/GUI/GUI/GUI/PythonWrapper.cpp
@@ -281,6 +281,15 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd,
CloseHandle(pi.hThread);
});
+ // Set spawned process priority to low, to avoid lagging things like OBS.
+ if (!SetPriorityClass(pi.hProcess, BELOW_NORMAL_PRIORITY_CLASS)) {
+ std::ostringstream err_oss;
+ err_oss << "Error while executing python command \"" << cmd_oss.str()
+ << "\": Failed to reduce priority class: " << GetWin32ErrMsg();
+ out_cb("", err_oss.str());
+ return false;
+ }
+
// While the process is running, drain output and send input every 10 ms.
DWORD timeout_ms = 10;
DWORD ret = WAIT_TIMEOUT;