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:
Artem Titov
2021-11-15 16:57:07 +01:00
committed by WebRTC LUCI CQ
parent f5ea3b96cd
commit d3251968d1
263 changed files with 604 additions and 583 deletions

View File

@ -275,7 +275,7 @@ const char* ChannelLayoutToString(ChannelLayout layout) {
case CHANNEL_LAYOUT_BITSTREAM:
return "BITSTREAM";
}
RTC_NOTREACHED() << "Invalid channel layout provided: " << layout;
RTC_DCHECK_NOTREACHED() << "Invalid channel layout provided: " << layout;
return "";
}

View File

@ -161,7 +161,7 @@ AudioDecoder::SpeechType AudioDecoder::ConvertSpeechType(int16_t type) {
case 2:
return kComfortNoise;
default:
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return kSpeech;
}
}

View File

@ -83,7 +83,7 @@ void AudioEncoder::OnReceivedUplinkPacketLossFraction(
void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
float uplink_recoverable_packet_loss_fraction) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {

View File

@ -203,7 +203,7 @@ class AudioTrackSinkInterface {
int sample_rate,
size_t number_of_channels,
size_t number_of_frames) {
RTC_NOTREACHED() << "This method must be overridden, or not used.";
RTC_DCHECK_NOTREACHED() << "This method must be overridden, or not used.";
}
// In this method, `absolute_capture_timestamp_ms`, when available, is

View File

@ -28,7 +28,7 @@ std::string MediaTypeToString(MediaType type) {
return kMediaTypeData;
case MEDIA_TYPE_UNSUPPORTED:
// Unsupported media stores the m=<mediatype> differently.
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return "";
}
RTC_CHECK_NOTREACHED();

View File

@ -79,7 +79,7 @@ class RTC_EXPORT PacketSocketFactory {
virtual AsyncResolverInterface* CreateAsyncResolver() {
// Default implementation, so that downstream users can remove this
// immediately after changing to CreateAsyncDnsResolver
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return nullptr;
}

View File

@ -34,17 +34,19 @@ void RtpTransceiverInterface::Stop() {
}
RTCError RtpTransceiverInterface::StopStandard() {
RTC_NOTREACHED() << "DEBUG: RtpTransceiverInterface::StopStandard called";
RTC_DCHECK_NOTREACHED()
<< "DEBUG: RtpTransceiverInterface::StopStandard called";
return RTCError::OK();
}
void RtpTransceiverInterface::StopInternal() {
RTC_NOTREACHED() << "DEBUG: RtpTransceiverInterface::StopInternal called";
RTC_DCHECK_NOTREACHED()
<< "DEBUG: RtpTransceiverInterface::StopInternal called";
}
RTCError RtpTransceiverInterface::SetCodecPreferences(
rtc::ArrayView<RtpCodecCapability>) {
RTC_NOTREACHED() << "Not implemented";
RTC_DCHECK_NOTREACHED() << "Not implemented";
return {};
}
@ -78,7 +80,7 @@ void RtpTransceiverInterface::SetDirection(
RTCError RtpTransceiverInterface::SetDirectionWithError(
RtpTransceiverDirection new_direction) {
RTC_NOTREACHED() << "Default implementation called";
RTC_DCHECK_NOTREACHED() << "Default implementation called";
return RTCError::OK();
}

View File

@ -58,7 +58,7 @@ const char* InternalTypeToString(StatsReport::StatsType type) {
case StatsReport::kStatsReportTypeDataChannel:
return "datachannel";
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return nullptr;
}
@ -291,7 +291,7 @@ bool StatsReport::Value::Equals(const Value& other) const {
case kId:
return (*value_.id_)->Equals(*other.value_.id_);
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return false;
}
@ -676,7 +676,7 @@ std::string StatsReport::Value::ToString() const {
case kId:
return (*value_.id_)->ToString();
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return std::string();
}

View File

@ -26,7 +26,7 @@ const char* FrameGeneratorInterface::OutputTypeToString(
case OutputType::kNV12:
return "NV12";
default:
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
}

View File

@ -39,7 +39,7 @@ class FunctionVideoEncoderFactory final : public VideoEncoderFactory {
// Unused by tests.
std::vector<SdpVideoFormat> GetSupportedFormats() const override {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return {};
}

View File

@ -43,7 +43,7 @@ absl::InlinedVector<DecodeTargetIndication, 10> StringToDecodeTargetIndications(
indication = DecodeTargetIndication::kSwitch;
break;
default:
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
dtis.push_back(indication);
}

View File

@ -76,7 +76,7 @@ bool LengthValid(int type, int length) {
// Return an arbitrary restriction for all other types.
return length <= kTheoreticalMaximumAttributeLength;
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return true;
}

View File

@ -117,7 +117,7 @@ rtc::scoped_refptr<I010Buffer> I010Buffer::Rotate(
switch (rotation) {
// This case is covered by the early return.
case webrtc::kVideoRotation_0:
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
break;
case webrtc::kVideoRotation_90:
dest_x = src.height() - y - 1;

View File

@ -51,7 +51,7 @@ std::unique_ptr<VideoRtpDepacketizer> CreateDepacketizer(
case RtpVideoFrameAssembler::kGeneric:
return std::make_unique<VideoRtpDepacketizerGeneric>();
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return nullptr;
}
} // namespace

View File

@ -93,7 +93,7 @@ class PacketBuilder {
return kVideoCodecGeneric;
}
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return absl::nullopt;
}

View File

@ -81,7 +81,7 @@ const char* VideoFrameBufferTypeToString(VideoFrameBuffer::Type type) {
case VideoFrameBuffer::Type::kNV12:
return "kNV12";
default:
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
}

View File

@ -179,13 +179,13 @@ TEST_F(VideoDecoderSoftwareFallbackWrapperTest,
int32_t Decoded(VideoFrame& decodedImage) override { return 0; }
int32_t Decoded(webrtc::VideoFrame& decodedImage,
int64_t decode_time_ms) override {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return -1;
}
void Decoded(webrtc::VideoFrame& decodedImage,
absl::optional<int32_t> decode_time_ms,
absl::optional<uint8_t> qp) override {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
} callback;

View File

@ -215,7 +215,7 @@ int32_t VideoDecoderSoftwareFallbackWrapper::Decode(
return fallback_decoder_->Decode(input_image, missing_frames,
render_time_ms);
default:
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return WEBRTC_VIDEO_CODEC_ERROR;
}
}
@ -240,7 +240,7 @@ int32_t VideoDecoderSoftwareFallbackWrapper::Release() {
status = WEBRTC_VIDEO_CODEC_OK;
break;
default:
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
status = WEBRTC_VIDEO_CODEC_ERROR;
}

View File

@ -97,23 +97,24 @@ void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings(
} else if (codec->codecType == kVideoCodecVP9) {
FillVideoCodecVp9(codec->VP9());
} else {
RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type.";
RTC_DCHECK_NOTREACHED()
<< "Encoder specifics set/used for unknown codec type.";
}
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecH264(
VideoCodecH264* h264_settings) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp8(
VideoCodecVP8* vp8_settings) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp9(
VideoCodecVP9* vp9_settings) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
VideoEncoderConfig::H264EncoderSpecificSettings::H264EncoderSpecificSettings(

View File

@ -56,7 +56,7 @@ bool Vp8FrameConfig::References(Buffer buffer) const {
case Buffer::kCount:
break;
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return false;
}
@ -71,7 +71,7 @@ bool Vp8FrameConfig::Updates(Buffer buffer) const {
case Buffer::kCount:
break;
}
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return false;
}