Return early from VP9EncoderImpl::Encode() if all layers inactive
Bug: chromium:927027
Change-Id: Ib3eab2ca782619b2b2a595f67db630b009c3ffba
Reviewed-on: https://webrtc-review.googlesource.com/c/121407
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26534}
diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc
index 250ad0e..d86f78f 100644
--- a/modules/video_coding/codecs/vp9/vp9_impl.cc
+++ b/modules/video_coding/codecs/vp9/vp9_impl.cc
@@ -721,6 +721,10 @@
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()) {