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}
This commit is contained in:
Wan-Teh Chang 2024-04-06 21:21:18 -07:00 committed by WebRTC LUCI CQ
parent e92be7f42f
commit e5a6ab45d3

View File

@ -1186,6 +1186,8 @@ void VideoStreamEncoder::ReconfigureEncoder() {
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(