Avoid OpenH264 encoder bug for #threads > 1 on Mac and Chromium+Sandbox.

Until the bug has been further investigated, we're limiting the number
of threads to 1 to avoid problems. See crbug.com/583348.

BUG=chromium:500605, chromium:468365, chromium:583348

Review URL: https://codereview.webrtc.org/1677543002

Cr-Commit-Position: refs/heads/master@{#11536}
This commit is contained in:
hbos
2016-02-09 02:34:29 -08:00
committed by Commit bot
parent 097d54956d
commit 0715a83a07

View File

@ -28,15 +28,18 @@ namespace {
const bool kOpenH264EncoderDetailedLogging = false; const bool kOpenH264EncoderDetailedLogging = false;
int NumberOfThreads(int width, int height, int number_of_cores) { int NumberOfThreads(int width, int height, int number_of_cores) {
if (width * height >= 1920 * 1080 && number_of_cores > 8) { // TODO(hbos): In Chromium, multiple threads do not work with sandbox on Mac,
return 8; // 8 threads for 1080p on high perf machines. // see crbug.com/583348. Until further investigated, only use one thread.
} else if (width * height > 1280 * 960 && number_of_cores >= 6) { // if (width * height >= 1920 * 1080 && number_of_cores > 8) {
return 3; // 3 threads for 1080p. // return 8; // 8 threads for 1080p on high perf machines.
} else if (width * height > 640 * 480 && number_of_cores >= 3) { // } else if (width * height > 1280 * 960 && number_of_cores >= 6) {
return 2; // 2 threads for qHD/HD. // return 3; // 3 threads for 1080p.
} else { // } else if (width * height > 640 * 480 && number_of_cores >= 3) {
return 1; // 1 thread for VGA or less. // return 2; // 2 threads for qHD/HD.
} // } else {
// return 1; // 1 thread for VGA or less.
// }
return 1;
} }
} // namespace } // namespace