Prepare to rename RTC_NOTREACHED to RTC_DCHECK_NOTREACHED
Add implementation of RTC_DCHECK_NOTREACHED equal to the RTC_NOTREACHED. The new macros will replace the old one when old one's usage will be removed. The idea of the renaming to provide a clear signal that this is debug build only macros and will be stripped in the production build. Bug: webrtc:9065 Change-Id: I4c35d8b03e74a4b3fd1ae75dba2f9c05643101db Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237802 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35348}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
f5ea3b96cd
commit
d3251968d1
@ -102,7 +102,7 @@ std::unique_ptr<H264Encoder> H264Encoder::Create(
|
||||
RTC_LOG(LS_INFO) << "Creating H264EncoderImpl.";
|
||||
return std::make_unique<H264EncoderImpl>(codec);
|
||||
#else
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
@ -127,7 +127,7 @@ std::unique_ptr<H264Decoder> H264Decoder::Create() {
|
||||
RTC_LOG(LS_INFO) << "Creating H264DecoderImpl.";
|
||||
return std::make_unique<H264DecoderImpl>();
|
||||
#else
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ VideoFrameType ConvertToVideoFrameType(EVideoFrameType type) {
|
||||
case videoFrameTypeInvalid:
|
||||
break;
|
||||
}
|
||||
RTC_NOTREACHED() << "Unexpected/invalid frame type: " << type;
|
||||
RTC_DCHECK_NOTREACHED() << "Unexpected/invalid frame type: " << type;
|
||||
return VideoFrameType::kEmptyFrame;
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ SEncParamExt H264EncoderImpl::CreateEncoderParams(size_t i) const {
|
||||
} else if (codec_.mode == VideoCodecMode::kScreensharing) {
|
||||
encoder_params.iUsageType = SCREEN_CONTENT_REAL_TIME;
|
||||
} else {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
encoder_params.iPicWidth = configurations_[i].width;
|
||||
encoder_params.iPicHeight = configurations_[i].height;
|
||||
|
||||
@ -52,7 +52,7 @@ inline std::string ToString(H264PacketizationMode mode) {
|
||||
} else if (mode == H264PacketizationMode::SingleNalUnit) {
|
||||
return "SingleNalUnit";
|
||||
}
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_SET_POSTENCODE_DROP:
|
||||
return vpx_codec_control(ctx, VP9E_SET_POSTENCODE_DROP, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -181,7 +181,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
// Might be intended for uint32_t but int literal used, try fallback.
|
||||
return codec_control(ctx, ctrl_id, static_cast<uint32_t>(param));
|
||||
}
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -199,7 +199,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_GET_LEVEL:
|
||||
return vpx_codec_control(ctx, VP9E_GET_LEVEL, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -213,7 +213,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_SET_ROI_MAP:
|
||||
return vpx_codec_control(ctx, VP9E_SET_ROI_MAP, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -227,7 +227,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_GET_ACTIVEMAP:
|
||||
return vpx_codec_control(ctx, VP8E_SET_ACTIVEMAP, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -239,7 +239,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP8E_SET_SCALEMODE:
|
||||
return vpx_codec_control(ctx, VP8E_SET_SCALEMODE, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -251,7 +251,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_SET_SVC_PARAMETERS:
|
||||
return vpx_codec_control_(ctx, VP9E_SET_SVC_PARAMETERS, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -263,7 +263,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_SET_SVC_FRAME_DROP_LAYER:
|
||||
return vpx_codec_control_(ctx, VP9E_SET_SVC_FRAME_DROP_LAYER, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -277,7 +277,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_REGISTER_CX_CALLBACK:
|
||||
return vpx_codec_control_(ctx, VP9E_REGISTER_CX_CALLBACK, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -291,7 +291,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_GET_SVC_LAYER_ID:
|
||||
return vpx_codec_control_(ctx, VP9E_GET_SVC_LAYER_ID, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -306,7 +306,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_GET_SVC_REF_FRAME_CONFIG:
|
||||
return vpx_codec_control_(ctx, VP9E_GET_SVC_REF_FRAME_CONFIG, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -319,7 +319,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_SET_SVC_SPATIAL_LAYER_SYNC:
|
||||
return vpx_codec_control_(ctx, VP9E_SET_SVC_SPATIAL_LAYER_SYNC, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
@ -331,7 +331,7 @@ class LibvpxFacade : public LibvpxInterface {
|
||||
case VP9E_SET_EXTERNAL_RATE_CONTROL:
|
||||
return vpx_codec_control_(ctx, VP9E_SET_EXTERNAL_RATE_CONTROL, param);
|
||||
default:
|
||||
RTC_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
RTC_DCHECK_NOTREACHED() << "Unsupported libvpx ctrl_id: " << ctrl_id;
|
||||
}
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
|
||||
@ -36,11 +36,11 @@ class MultiplexDecoderAdapter::AdapterDecodedImageCallback
|
||||
adapter_->Decoded(stream_idx_, &decoded_image, decode_time_ms, qp);
|
||||
}
|
||||
int32_t Decoded(VideoFrame& decoded_image) override {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
int32_t Decoded(VideoFrame& decoded_image, int64_t decode_time_ms) override {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -54,11 +54,11 @@ class VideoCodecUnitTest : public ::testing::Test {
|
||||
: test_(test) {}
|
||||
|
||||
int32_t Decoded(VideoFrame& frame) override {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return -1;
|
||||
}
|
||||
int32_t Decoded(VideoFrame& frame, int64_t decode_time_ms) override {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return -1;
|
||||
}
|
||||
void Decoded(VideoFrame& frame,
|
||||
|
||||
@ -73,7 +73,7 @@ class VideoEncoderDecoderInstantiationTest
|
||||
encoder_factory_ = CreateObjCEncoderFactory();
|
||||
decoder_factory_ = CreateObjCDecoderFactory();
|
||||
#else
|
||||
RTC_NOTREACHED() << "Only support Android and iOS.";
|
||||
RTC_DCHECK_NOTREACHED() << "Only support Android and iOS.";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -350,7 +350,7 @@ void VideoCodecTestFixtureImpl::H264KeyframeChecker::CheckEncodedFrame(
|
||||
EXPECT_FALSE(contains_pps) << "Delta frame should not contain PPS.";
|
||||
EXPECT_FALSE(contains_idr) << "Delta frame should not contain IDR.";
|
||||
} else {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ class QpFrameChecker : public VideoCodecTestFixture::EncodedFrameChecker {
|
||||
} else if (codec == kVideoCodecVP9) {
|
||||
EXPECT_TRUE(vp9::GetQp(encoded_frame.data(), encoded_frame.size(), &qp));
|
||||
} else {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
EXPECT_EQ(encoded_frame.qp_, qp) << "Encoder QP != parsed bitstream QP.";
|
||||
}
|
||||
|
||||
@ -78,10 +78,10 @@ std::vector<unsigned int> GetTemporalIds(size_t num_layers) {
|
||||
// 0 0 ...
|
||||
return {0, 3, 2, 3, 1, 3, 2, 3};
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
break;
|
||||
}
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return {0};
|
||||
}
|
||||
|
||||
@ -236,10 +236,10 @@ DefaultTemporalLayers::GetDependencyInfo(size_t num_layers) {
|
||||
{"----", {kReference, kReference, kReferenceAndUpdate}},
|
||||
{"----", {kReference, kReference, kReference, kFreezeEntropy}}};
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
break;
|
||||
}
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return {{"", {kNone, kNone, kNone}}};
|
||||
}
|
||||
|
||||
@ -694,7 +694,7 @@ FrameDependencyStructure DefaultTemporalLayers::GetTemplateStructure(
|
||||
return template_structure;
|
||||
}
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
// To make the compiler happy!
|
||||
return template_structure;
|
||||
}
|
||||
@ -725,7 +725,7 @@ std::vector<std::set<uint8_t>> GetTemporalDependencies(
|
||||
{0}, {4, 6, 8}, {4, 6, 8}, {4, 8, 10},
|
||||
{4, 8}, {8, 10, 12}, {8, 10, 12}, {8, 12, 14}};
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ void SetRawImagePlanes(vpx_image_t* raw_image, VideoFrameBuffer* buffer) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1357,7 +1357,7 @@ LibvpxVp8Encoder::PrepareBuffers(rtc::scoped_refptr<VideoFrameBuffer> buffer) {
|
||||
MaybeUpdatePixelFormat(VPX_IMG_FMT_NV12);
|
||||
break;
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
|
||||
// Prepare `raw_images_` from `mapped_buffer` and, if simulcast, scaled
|
||||
@ -1399,10 +1399,11 @@ LibvpxVp8Encoder::PrepareBuffers(rtc::scoped_refptr<VideoFrameBuffer> buffer) {
|
||||
<< " instead of "
|
||||
<< VideoFrameBufferTypeToString(mapped_buffer->type())
|
||||
<< ". Can't encode frame.";
|
||||
RTC_NOTREACHED() << "Scaled buffer type "
|
||||
<< VideoFrameBufferTypeToString(scaled_buffer->type())
|
||||
<< " is not compatible with mapped buffer type "
|
||||
<< VideoFrameBufferTypeToString(mapped_buffer->type());
|
||||
RTC_DCHECK_NOTREACHED()
|
||||
<< "Scaled buffer type "
|
||||
<< VideoFrameBufferTypeToString(scaled_buffer->type())
|
||||
<< " is not compatible with mapped buffer type "
|
||||
<< VideoFrameBufferTypeToString(mapped_buffer->type());
|
||||
return {};
|
||||
}
|
||||
SetRawImagePlanes(&raw_images_[i], scaled_buffer);
|
||||
|
||||
@ -212,7 +212,7 @@ Vp8FrameConfig ScreenshareLayers::NextFrameConfig(size_t stream_index,
|
||||
++stats_.num_dropped_frames_;
|
||||
break;
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
|
||||
DependencyInfo dependency_info;
|
||||
@ -446,7 +446,7 @@ FrameDependencyStructure ScreenshareLayers::GetTemplateStructure(
|
||||
return template_structure;
|
||||
}
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
// To make the compiler happy!
|
||||
return template_structure;
|
||||
}
|
||||
|
||||
@ -565,7 +565,7 @@ TEST_F(ScreenshareLayerTest, UpdatesHistograms) {
|
||||
} else if (flags == -1) {
|
||||
dropped_frame = true;
|
||||
} else {
|
||||
RTC_NOTREACHED() << "Unexpected flags";
|
||||
RTC_DCHECK_NOTREACHED() << "Unexpected flags";
|
||||
}
|
||||
clock_.AdvanceTime(TimeDelta::Millis(1000 / 5));
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ struct GofInfoVP9 {
|
||||
pid_diff[7][1] = 2;
|
||||
break;
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ ColorSpace ExtractVP9ColorSpace(vpx_color_space_t space_t,
|
||||
transfer = ColorSpace::TransferID::kBT2020_10;
|
||||
break;
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
break;
|
||||
}
|
||||
matrix = ColorSpace::MatrixID::kBT2020_NCL;
|
||||
|
||||
@ -573,7 +573,7 @@ int LibvpxVp9Encoder::InitEncode(const VideoCodec* inst,
|
||||
case VP9Profile::kProfile1:
|
||||
// Encoding of profile 1 is not implemented. It would require extended
|
||||
// support for I444, I422, and I440 buffers.
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
break;
|
||||
case VP9Profile::kProfile2:
|
||||
img_fmt = VPX_IMG_FMT_I42016;
|
||||
@ -833,7 +833,7 @@ int LibvpxVp9Encoder::InitAndSetControlSettings(const VideoCodec* inst) {
|
||||
libvpx_->codec_control(encoder_, VP9E_SET_SVC_INTER_LAYER_PRED, 2);
|
||||
break;
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
|
||||
memset(&svc_drop_frame_, 0, sizeof(svc_drop_frame_));
|
||||
@ -1111,7 +1111,7 @@ int LibvpxVp9Encoder::Encode(const VideoFrame& input_image,
|
||||
break;
|
||||
}
|
||||
case VP9Profile::kProfile1: {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
break;
|
||||
}
|
||||
case VP9Profile::kProfile2: {
|
||||
@ -2001,7 +2001,7 @@ rtc::scoped_refptr<VideoFrameBuffer> LibvpxVp9Encoder::PrepareBufferForProfile0(
|
||||
break;
|
||||
}
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
return mapped_buffer;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ std::unique_ptr<VP9Encoder> VP9Encoder::Create() {
|
||||
LibvpxInterface::Create(),
|
||||
FieldTrialBasedConfig());
|
||||
#else
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
@ -88,7 +88,7 @@ std::unique_ptr<VP9Encoder> VP9Encoder::Create(
|
||||
return std::make_unique<LibvpxVp9Encoder>(codec, LibvpxInterface::Create(),
|
||||
FieldTrialBasedConfig());
|
||||
#else
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
@ -106,7 +106,7 @@ std::unique_ptr<VP9Decoder> VP9Decoder::Create() {
|
||||
#ifdef RTC_ENABLE_VP9
|
||||
return std::make_unique<LibvpxVp9Decoder>();
|
||||
#else
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ Vp9FrameBufferPool::GetFrameBuffer(size_t min_size) {
|
||||
|
||||
// TODO(phoglund): this limit is being hit in tests since Oct 5 2016.
|
||||
// See https://bugs.chromium.org/p/webrtc/issues/detail?id=6484.
|
||||
// RTC_NOTREACHED();
|
||||
// RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user