From bfa5d5d9aadb1443ef10444ae935b41cd637733b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Spr=C3=A5ng?= Date: Mon, 4 Feb 2019 16:40:19 +0100 Subject: [PATCH] Return early from VP9EncoderImpl::Encode() if all layers inactive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: chromium:927027 Change-Id: Ib3eab2ca782619b2b2a595f67db630b009c3ffba Reviewed-on: https://webrtc-review.googlesource.com/c/121407 Reviewed-by: Stefan Holmer Commit-Queue: Erik Språng Cr-Commit-Position: refs/heads/master@{#26534} --- modules/video_coding/codecs/vp9/vp9_impl.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc index 250ad0e813..d86f78f1c1 100644 --- a/modules/video_coding/codecs/vp9/vp9_impl.cc +++ b/modules/video_coding/codecs/vp9/vp9_impl.cc @@ -721,6 +721,10 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image, if (encoded_complete_callback_ == nullptr) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } + if (num_active_spatial_layers_ == 0) { + // All spatial layers are disabled, return without encoding anything. + return WEBRTC_VIDEO_CODEC_OK; + } // We only support one stream at the moment. if (frame_types && !frame_types->empty()) {