RTC_[D]CHECK_op: Remove superfluous casts
There's no longer any need to make the two arguments have the same signedness, so we can remove a bunch of superfluous (and sometimes dangerous) casts. It turned out I also had to fix the safe_cmp functions to properly handle enums that are implicitly convertible to integers. NOPRESUBMIT=true BUG=webrtc:6645 Review-Url: https://codereview.webrtc.org/2534683002 Cr-Commit-Position: refs/heads/master@{#15281}
This commit is contained in:
@ -95,7 +95,7 @@ static void RtpFragmentize(EncodedImage* encoded_image,
|
||||
for (int nal = 0; nal < layerInfo.iNalCount; ++nal, ++fragments_count) {
|
||||
RTC_CHECK_GE(layerInfo.pNalLengthInByte[nal], 0);
|
||||
// Ensure |required_size| will not overflow.
|
||||
RTC_CHECK_LE(static_cast<size_t>(layerInfo.pNalLengthInByte[nal]),
|
||||
RTC_CHECK_LE(layerInfo.pNalLengthInByte[nal],
|
||||
std::numeric_limits<size_t>::max() - required_size);
|
||||
required_size += layerInfo.pNalLengthInByte[nal];
|
||||
}
|
||||
@ -326,7 +326,7 @@ int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame,
|
||||
bool force_key_frame = false;
|
||||
if (frame_types != nullptr) {
|
||||
// We only support a single stream.
|
||||
RTC_DCHECK_EQ(frame_types->size(), static_cast<size_t>(1));
|
||||
RTC_DCHECK_EQ(frame_types->size(), 1);
|
||||
// Skip frame?
|
||||
if ((*frame_types)[0] == kEmptyFrame) {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
|
||||
@ -697,8 +697,8 @@ int VP8EncoderImpl::Encode(const VideoFrame& frame,
|
||||
// |raw_images_[0]|, the resolution of these frames must match. Note that
|
||||
// |input_image| might be scaled from |frame|. In that case, the resolution of
|
||||
// |raw_images_[0]| should have been updated in UpdateCodecFrameSize.
|
||||
RTC_DCHECK_EQ(input_image->width(), static_cast<int>(raw_images_[0].d_w));
|
||||
RTC_DCHECK_EQ(input_image->height(), static_cast<int>(raw_images_[0].d_h));
|
||||
RTC_DCHECK_EQ(input_image->width(), raw_images_[0].d_w);
|
||||
RTC_DCHECK_EQ(input_image->height(), raw_images_[0].d_h);
|
||||
|
||||
// Image in vpx_image_t format.
|
||||
// Input image is const. VP8's raw image is not defined as const.
|
||||
|
||||
@ -497,8 +497,8 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
|
||||
if (frame_types && frame_types->size() > 0) {
|
||||
frame_type = (*frame_types)[0];
|
||||
}
|
||||
RTC_DCHECK_EQ(input_image.width(), static_cast<int>(raw_->d_w));
|
||||
RTC_DCHECK_EQ(input_image.height(), static_cast<int>(raw_->d_h));
|
||||
RTC_DCHECK_EQ(input_image.width(), raw_->d_w);
|
||||
RTC_DCHECK_EQ(input_image.height(), raw_->d_h);
|
||||
|
||||
// Set input image for use in the callback.
|
||||
// This was necessary since you need some information from input_image.
|
||||
|
||||
@ -164,7 +164,7 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
|
||||
video_codec.minBitrate = streams[0].min_bitrate_bps / 1000;
|
||||
if (video_codec.minBitrate < kEncoderMinBitrateKbps)
|
||||
video_codec.minBitrate = kEncoderMinBitrateKbps;
|
||||
RTC_DCHECK_LE(streams.size(), static_cast<size_t>(kMaxSimulcastStreams));
|
||||
RTC_DCHECK_LE(streams.size(), kMaxSimulcastStreams);
|
||||
if (video_codec.codecType == kVideoCodecVP9) {
|
||||
// If the vector is empty, bitrates will be configured automatically.
|
||||
RTC_DCHECK(config.spatial_layers.empty() ||
|
||||
|
||||
Reference in New Issue
Block a user