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}
diff --git a/api/audio/channel_layout.cc b/api/audio/channel_layout.cc
index 567f4d9..e4ae356 100644
--- a/api/audio/channel_layout.cc
+++ b/api/audio/channel_layout.cc
@@ -275,7 +275,7 @@
     case CHANNEL_LAYOUT_BITSTREAM:
       return "BITSTREAM";
   }
-  RTC_NOTREACHED() << "Invalid channel layout provided: " << layout;
+  RTC_DCHECK_NOTREACHED() << "Invalid channel layout provided: " << layout;
   return "";
 }
 
diff --git a/api/audio_codecs/audio_decoder.cc b/api/audio_codecs/audio_decoder.cc
index 4fc9951..d5c1cfe 100644
--- a/api/audio_codecs/audio_decoder.cc
+++ b/api/audio_codecs/audio_decoder.cc
@@ -161,7 +161,7 @@
     case 2:
       return kComfortNoise;
     default:
-      RTC_NOTREACHED();
+      RTC_DCHECK_NOTREACHED();
       return kSpeech;
   }
 }
diff --git a/api/audio_codecs/audio_encoder.cc b/api/audio_codecs/audio_encoder.cc
index cd4d200..81cfbe3 100644
--- a/api/audio_codecs/audio_encoder.cc
+++ b/api/audio_codecs/audio_encoder.cc
@@ -83,7 +83,7 @@
 
 void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
     float uplink_recoverable_packet_loss_fraction) {
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
 }
 
 void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
diff --git a/api/media_stream_interface.h b/api/media_stream_interface.h
index ad497d9..d61dd98 100644
--- a/api/media_stream_interface.h
+++ b/api/media_stream_interface.h
@@ -203,7 +203,7 @@
                       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
diff --git a/api/media_types.cc b/api/media_types.cc
index 3453ce3..5c7d55b 100644
--- a/api/media_types.cc
+++ b/api/media_types.cc
@@ -28,7 +28,7 @@
       return kMediaTypeData;
     case MEDIA_TYPE_UNSUPPORTED:
       // Unsupported media stores the m=<mediatype> differently.
-      RTC_NOTREACHED();
+      RTC_DCHECK_NOTREACHED();
       return "";
   }
   RTC_CHECK_NOTREACHED();
diff --git a/api/packet_socket_factory.h b/api/packet_socket_factory.h
index a46ba27..29d2606 100644
--- a/api/packet_socket_factory.h
+++ b/api/packet_socket_factory.h
@@ -79,7 +79,7 @@
   virtual AsyncResolverInterface* CreateAsyncResolver() {
     // Default implementation, so that downstream users can remove this
     // immediately after changing to CreateAsyncDnsResolver
-    RTC_NOTREACHED();
+    RTC_DCHECK_NOTREACHED();
     return nullptr;
   }
 
diff --git a/api/rtp_transceiver_interface.cc b/api/rtp_transceiver_interface.cc
index fd5085c..454e450 100644
--- a/api/rtp_transceiver_interface.cc
+++ b/api/rtp_transceiver_interface.cc
@@ -34,17 +34,19 @@
 }
 
 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 @@
 
 RTCError RtpTransceiverInterface::SetDirectionWithError(
     RtpTransceiverDirection new_direction) {
-  RTC_NOTREACHED() << "Default implementation called";
+  RTC_DCHECK_NOTREACHED() << "Default implementation called";
   return RTCError::OK();
 }
 
diff --git a/api/stats_types.cc b/api/stats_types.cc
index ddba593..60818ee 100644
--- a/api/stats_types.cc
+++ b/api/stats_types.cc
@@ -58,7 +58,7 @@
     case StatsReport::kStatsReportTypeDataChannel:
       return "datachannel";
   }
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
   return nullptr;
 }
 
@@ -291,7 +291,7 @@
     case kId:
       return (*value_.id_)->Equals(*other.value_.id_);
   }
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
   return false;
 }
 
@@ -676,7 +676,7 @@
     case kId:
       return (*value_.id_)->ToString();
   }
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
   return std::string();
 }
 
diff --git a/api/test/frame_generator_interface.cc b/api/test/frame_generator_interface.cc
index 356fe3a..fe7b1e8 100644
--- a/api/test/frame_generator_interface.cc
+++ b/api/test/frame_generator_interface.cc
@@ -26,7 +26,7 @@
     case OutputType::kNV12:
       return "NV12";
     default:
-      RTC_NOTREACHED();
+      RTC_DCHECK_NOTREACHED();
   }
 }
 
diff --git a/api/test/video/function_video_encoder_factory.h b/api/test/video/function_video_encoder_factory.h
index a452eee..9ae9719 100644
--- a/api/test/video/function_video_encoder_factory.h
+++ b/api/test/video/function_video_encoder_factory.h
@@ -39,7 +39,7 @@
 
   // Unused by tests.
   std::vector<SdpVideoFormat> GetSupportedFormats() const override {
-    RTC_NOTREACHED();
+    RTC_DCHECK_NOTREACHED();
     return {};
   }
 
diff --git a/api/transport/rtp/dependency_descriptor.cc b/api/transport/rtp/dependency_descriptor.cc
index 2a9b6d9..e784853 100644
--- a/api/transport/rtp/dependency_descriptor.cc
+++ b/api/transport/rtp/dependency_descriptor.cc
@@ -43,7 +43,7 @@
         indication = DecodeTargetIndication::kSwitch;
         break;
       default:
-        RTC_NOTREACHED();
+        RTC_DCHECK_NOTREACHED();
     }
     dtis.push_back(indication);
   }
diff --git a/api/transport/stun.cc b/api/transport/stun.cc
index f774e98..87da005 100644
--- a/api/transport/stun.cc
+++ b/api/transport/stun.cc
@@ -76,7 +76,7 @@
       // Return an arbitrary restriction for all other types.
       return length <= kTheoreticalMaximumAttributeLength;
   }
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
   return true;
 }
 
diff --git a/api/video/i010_buffer.cc b/api/video/i010_buffer.cc
index aeea050..b98e586 100644
--- a/api/video/i010_buffer.cc
+++ b/api/video/i010_buffer.cc
@@ -117,7 +117,7 @@
       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;
diff --git a/api/video/rtp_video_frame_assembler.cc b/api/video/rtp_video_frame_assembler.cc
index 271ac22..81c0838 100644
--- a/api/video/rtp_video_frame_assembler.cc
+++ b/api/video/rtp_video_frame_assembler.cc
@@ -51,7 +51,7 @@
     case RtpVideoFrameAssembler::kGeneric:
       return std::make_unique<VideoRtpDepacketizerGeneric>();
   }
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
   return nullptr;
 }
 }  // namespace
diff --git a/api/video/rtp_video_frame_assembler_unittests.cc b/api/video/rtp_video_frame_assembler_unittests.cc
index 74e4906..82defb8 100644
--- a/api/video/rtp_video_frame_assembler_unittests.cc
+++ b/api/video/rtp_video_frame_assembler_unittests.cc
@@ -93,7 +93,7 @@
         return kVideoCodecGeneric;
       }
     }
-    RTC_NOTREACHED();
+    RTC_DCHECK_NOTREACHED();
     return absl::nullopt;
   }
 
diff --git a/api/video/video_frame_buffer.cc b/api/video/video_frame_buffer.cc
index 7085010..2b493dc 100644
--- a/api/video/video_frame_buffer.cc
+++ b/api/video/video_frame_buffer.cc
@@ -81,7 +81,7 @@
     case VideoFrameBuffer::Type::kNV12:
       return "kNV12";
     default:
-      RTC_NOTREACHED();
+      RTC_DCHECK_NOTREACHED();
   }
 }
 
diff --git a/api/video_codecs/test/video_decoder_software_fallback_wrapper_unittest.cc b/api/video_codecs/test/video_decoder_software_fallback_wrapper_unittest.cc
index 3d0e56e..73dedc8 100644
--- a/api/video_codecs/test/video_decoder_software_fallback_wrapper_unittest.cc
+++ b/api/video_codecs/test/video_decoder_software_fallback_wrapper_unittest.cc
@@ -179,13 +179,13 @@
     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;
 
diff --git a/api/video_codecs/video_decoder_software_fallback_wrapper.cc b/api/video_codecs/video_decoder_software_fallback_wrapper.cc
index 9d58388..6b8211c 100644
--- a/api/video_codecs/video_decoder_software_fallback_wrapper.cc
+++ b/api/video_codecs/video_decoder_software_fallback_wrapper.cc
@@ -215,7 +215,7 @@
       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 @@
       status = WEBRTC_VIDEO_CODEC_OK;
       break;
     default:
-      RTC_NOTREACHED();
+      RTC_DCHECK_NOTREACHED();
       status = WEBRTC_VIDEO_CODEC_ERROR;
   }
 
diff --git a/api/video_codecs/video_encoder_config.cc b/api/video_codecs/video_encoder_config.cc
index 0321da2..206a1d3 100644
--- a/api/video_codecs/video_encoder_config.cc
+++ b/api/video_codecs/video_encoder_config.cc
@@ -97,23 +97,24 @@
   } 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(
diff --git a/api/video_codecs/vp8_frame_config.cc b/api/video_codecs/vp8_frame_config.cc
index 7253206..05e1911 100644
--- a/api/video_codecs/vp8_frame_config.cc
+++ b/api/video_codecs/vp8_frame_config.cc
@@ -56,7 +56,7 @@
     case Buffer::kCount:
       break;
   }
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
   return false;
 }
 
@@ -71,7 +71,7 @@
     case Buffer::kCount:
       break;
   }
-  RTC_NOTREACHED();
+  RTC_DCHECK_NOTREACHED();
   return false;
 }