Chromium Code Reviews| Index: chrome/renderer/media/cast_rtp_stream.cc |
| diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc |
| index 4b7963c703f06d7612c63cd2fb39994c42165681..c4836007b464ecc6fb89d8397d8b2a56866104f1 100644 |
| --- a/chrome/renderer/media/cast_rtp_stream.cc |
| +++ b/chrome/renderer/media/cast_rtp_stream.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/debug/trace_event.h" |
| #include "base/logging.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/sys_info.h" |
| #include "chrome/renderer/media/cast_session.h" |
| #include "chrome/renderer/media/cast_udp_transport.h" |
| #include "content/public/renderer/media_stream_audio_sink.h" |
| @@ -116,6 +117,19 @@ bool IsHardwareH264EncodingSupported() { |
| return false; |
| } |
| +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; |
|
miu
2014/04/09 00:53:42
Unless I'm missing something, the change descripti
|
| +} |
| + |
| std::vector<CastRtpParams> SupportedAudioParams() { |
| // TODO(hclam): Fill in more codecs here. |
| std::vector<CastRtpParams> supported_params; |
| @@ -168,6 +182,9 @@ bool ToVideoSenderConfig(const CastRtpParams& params, |
| } else { |
| return false; |
| } |
| + if (!config->use_external_encoder) { |
| + config->number_of_encode_threads = NumberOfEncodeThreads(); |
| + } |
| return true; |
| } |