RTC_CHECK crop_width_,crop_height_ are nonnegative Similar to the two RTC_CHECK_GE's earlier in the VideoStreamEncoder::ReconfigureEncoder() method (originally added to webrtc/video/vie_encoder.cc in https://codereview.webrtc.org/2936393002), add two RTC_CHECK_GE's to ensure that crop_width_ and crop_height_ are nonnegative. Bug: b:330482827 Change-Id: Ia4989307b754abb101e50d33beeca4483a694a62 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/346026 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Commit-Queue: Wan-Teh Chang <wtc@google.com> Cr-Commit-Position: refs/heads/main@{#42017}
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 2f4c6e9..4390fe3 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc
@@ -1186,6 +1186,8 @@ encoder_config_.codec_type == kVideoCodecAV1) { // Spatial layers configuration might impose some parity restrictions, // thus some cropping might be needed. + RTC_CHECK_GE(last_frame_info_->width, codec.width); + RTC_CHECK_GE(last_frame_info_->height, codec.height); crop_width_ = last_frame_info_->width - codec.width; crop_height_ = last_frame_info_->height - codec.height; ApplySpatialLayerBitrateLimits(