From 2e61a8fa60560b4894427b822fead689c8e2f26d Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Mon, 22 Aug 2022 19:04:41 +0200 Subject: [PATCH] Revert "Enable Multithreaded H264 Encoding For OpenH264" This reverts commit bc8a62b244c4038d2a005bffcbe7a82bd933d7d1. Reason for revert: reverting per https://bugs.chromium.org/p/webrtc/issues/detail?id=14368#c5 This needs more careful consideration and should be put behind a finch flag or origin trial Original change's description: > Enable Multithreaded H264 Encoding For OpenH264 > > Re-enabled multithreaded encoding using OpenH264, as the issue described in crbug.com/583348 no longer applies. > > Bug: webrtc:14368 > Change-Id: I5ae768a6edf3b40d99c13fb4ee4662626c993a66 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271820 > Reviewed-by: Sergey Silkin > Commit-Queue: Sergey Silkin > Cr-Commit-Position: refs/heads/main@{#37837} Bug: webrtc:14368 Change-Id: Icebedfe4eb8e3901670b9f90e229379fca95206b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272600 Reviewed-by: Sergey Silkin Commit-Queue: Philipp Hancke Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#37878} --- .../codecs/h264/h264_encoder_impl.cc | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/modules/video_coding/codecs/h264/h264_encoder_impl.cc index bc823a520a..f6d52c6539 100644 --- a/modules/video_coding/codecs/h264/h264_encoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_encoder_impl.cc @@ -53,17 +53,20 @@ enum H264EncoderImplEvent { }; int NumberOfThreads(int width, int height, int number_of_cores) { + // TODO(hbos): In Chromium, multiple threads do not work with sandbox on Mac, + // see crbug.com/583348. Until further investigated, only use one thread. + // if (width * height >= 1920 * 1080 && number_of_cores > 8) { + // return 8; // 8 threads for 1080p on high perf machines. + // } else if (width * height > 1280 * 960 && number_of_cores >= 6) { + // return 3; // 3 threads for 1080p. + // } else if (width * height > 640 * 480 && number_of_cores >= 3) { + // return 2; // 2 threads for qHD/HD. + // } else { + // return 1; // 1 thread for VGA or less. + // } // TODO(sprang): Also check sSliceArgument.uiSliceNum om GetEncoderPrams(), // before enabling multithreading here. - if (width * height >= 1920 * 1080 && number_of_cores > 8) { - return 8; // 8 threads for 1080p on high perf machines. - } else if (width * height > 1280 * 960 && number_of_cores >= 6) { - return 3; // 3 threads for 1080p. - } else if (width * height > 640 * 480 && number_of_cores >= 3) { - return 2; // 2 threads for qHD/HD. - } else { - return 1; // 1 thread for VGA or less. - } + return 1; } VideoFrameType ConvertToVideoFrameType(EVideoFrameType type) {