修复cpu亲和性设置导致FFmpeg进程不能使用多核cpu的问题:#1149

This commit is contained in:
ziyue 2021-10-16 14:40:42 +08:00
parent d2a9878557
commit daaf73d390

View File

@ -75,6 +75,8 @@ void Process::run(const string &cmd, const string &log_file_tmp) {
throw std::runtime_error(StrPrinter << "fork child process failed,err:" << get_uv_errmsg()); throw std::runtime_error(StrPrinter << "fork child process failed,err:" << get_uv_errmsg());
} }
if (_pid == 0) { if (_pid == 0) {
//取消cpu亲和性设置防止FFmpeg进程cpu占用率不能超过100%的问题
setThreadAffinity(-1);
string log_file; string log_file;
if (log_file_tmp.empty()) { if (log_file_tmp.empty()) {
//未指定子进程日志文件时,重定向至/dev/null //未指定子进程日志文件时,重定向至/dev/null