Use single thread vp9 decoder for fuzzing

Single thread vp9 decoder is more fuzzer friendly.

Bug: chromium:1009073
Change-Id: I7f98680f1ce227126a62a1beccd8a283c9423aa6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156361
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Kuang-che Wu <kcwu@google.com>
Cr-Commit-Position: refs/heads/master@{#29435}
This commit is contained in:
Kuang-che Wu
2019-10-10 21:11:47 +08:00
committed by Commit Bot
parent 45eb135832
commit f17976d019

View File

@ -1625,10 +1625,20 @@ int VP9DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) {
vpx_codec_dec_cfg_t cfg;
memset(&cfg, 0, sizeof(cfg));
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
// We focus on webrtc fuzzing here, not libvpx itself. Use single thread for
// fuzzing, because:
// - libvpx's VP9 single thread decoder is more fuzzer friendly. It detects
// errors earlier than the multi-threads version.
// - Make peak CPU usage under control (not depending on input)
cfg.threads = 1;
(void)kMaxNumTiles4kVideo; // unused
#else
// We want to use multithreading when decoding high resolution videos. But,
// since we don't know resolution of input stream at this stage, we always
// enable it.
cfg.threads = std::min(number_of_cores, kMaxNumTiles4kVideo);
#endif
vpx_codec_flags_t flags = 0;
if (vpx_codec_dec_init(decoder_, vpx_codec_vp9_dx(), &cfg, flags)) {