diff options
author | miu <miu@chromium.org> | 2015-05-28 15:17:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-28 22:18:07 +0000 |
commit | a4b4d548bbee3e0a7692656dd04a655fe2613498 (patch) | |
tree | 0c36471226d1ec62f32863aa6446d849e940f767 | |
parent | 3764e175bd2c8c335eb95397d66886347ccbc88a (diff) | |
download | chromium_src-a4b4d548bbee3e0a7692656dd04a655fe2613498.zip chromium_src-a4b4d548bbee3e0a7692656dd04a655fe2613498.tar.gz chromium_src-a4b4d548bbee3e0a7692656dd04a655fe2613498.tar.bz2 |
[Cast] Increase number of encode threads to CEIL(N/2).
For systems with 4 or fewer cores, the number of encode threads is
unchanged. However, for higher-end systems, it makes sense to allow
more cores to be utilized to reduce frame encoding latency, especially
for key frames.
BUG=156767
Review URL: https://codereview.chromium.org/1152093004
Cr-Commit-Position: refs/heads/master@{#331866}
-rw-r--r-- | chrome/renderer/media/cast_rtp_stream.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc index bbe675a..0f849b8 100644 --- a/chrome/renderer/media/cast_rtp_stream.cc +++ b/chrome/renderer/media/cast_rtp_stream.cc @@ -4,6 +4,8 @@ #include "chrome/renderer/media/cast_rtp_stream.h" +#include <algorithm> + #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" @@ -130,16 +132,10 @@ bool IsHardwareH264EncodingSupported() { } int NumberOfEncodeThreads() { - // We want to give CPU cycles for capturing and not to saturate the system - // just for encoding. So on a lower end system with only 1 or 2 cores we - // use only one thread for encoding. - if (base::SysInfo::NumberOfProcessors() <= 2) - return 1; - - // On higher end we want to use 2 threads for encoding to reduce latency. - // In theory a physical CPU core has maximum 2 hyperthreads. Having 3 or - // more logical processors means the system has at least 2 physical cores. - return 2; + // Do not saturate CPU utilization just for encoding. On a lower-end system + // with only 1 or 2 cores, use only one thread for encoding. On systems with + // more cores, allow half of the cores to be used for encoding. + return std::min(8, (base::SysInfo::NumberOfProcessors() + 1) / 2); } std::vector<CastRtpParams> SupportedAudioParams() { |