diff --git a/audio/remix_resample.cc b/audio/remix_resample.cc index 178af622a1..3694d34e40 100644 --- a/audio/remix_resample.cc +++ b/audio/remix_resample.cc @@ -56,10 +56,9 @@ void RemixAndResample(const int16_t* src_data, if (resampler->InitializeIfNeeded(sample_rate_hz, dst_frame->sample_rate_hz_, audio_ptr_num_channels) == -1) { - RTC_FATAL() << "InitializeIfNeeded failed: sample_rate_hz = " - << sample_rate_hz << ", dst_frame->sample_rate_hz_ = " - << dst_frame->sample_rate_hz_ - << ", audio_ptr_num_channels = " << audio_ptr_num_channels; + FATAL() << "InitializeIfNeeded failed: sample_rate_hz = " << sample_rate_hz + << ", dst_frame->sample_rate_hz_ = " << dst_frame->sample_rate_hz_ + << ", audio_ptr_num_channels = " << audio_ptr_num_channels; } // TODO(yujo): for muted input frames, don't resample. Either 1) allow @@ -71,10 +70,9 @@ void RemixAndResample(const int16_t* src_data, resampler->Resample(audio_ptr, src_length, dst_frame->mutable_data(), AudioFrame::kMaxDataSizeSamples); if (out_length == -1) { - RTC_FATAL() << "Resample failed: audio_ptr = " << audio_ptr - << ", src_length = " << src_length - << ", dst_frame->mutable_data() = " - << dst_frame->mutable_data(); + FATAL() << "Resample failed: audio_ptr = " << audio_ptr + << ", src_length = " << src_length + << ", dst_frame->mutable_data() = " << dst_frame->mutable_data(); } dst_frame->samples_per_channel_ = out_length / audio_ptr_num_channels; diff --git a/common_video/video_frame_buffer.cc b/common_video/video_frame_buffer.cc index 8bbe7c8728..823c5ad7a1 100644 --- a/common_video/video_frame_buffer.cc +++ b/common_video/video_frame_buffer.cc @@ -266,7 +266,8 @@ rtc::scoped_refptr WrapYuvBuffer( return WrapI444Buffer(width, height, y_plane, y_stride, u_plane, u_stride, v_plane, v_stride, no_longer_used); default: - RTC_CHECK_NOTREACHED(); + FATAL() << "Unexpected frame buffer type."; + return nullptr; } } diff --git a/modules/audio_coding/codecs/cng/audio_encoder_cng.cc b/modules/audio_coding/codecs/cng/audio_encoder_cng.cc index 7546ac178f..600cb0c06a 100644 --- a/modules/audio_coding/codecs/cng/audio_encoder_cng.cc +++ b/modules/audio_coding/codecs/cng/audio_encoder_cng.cc @@ -171,8 +171,9 @@ AudioEncoder::EncodedInfo AudioEncoderCng::EncodeImpl( last_frame_active_ = true; break; } - default: { - RTC_CHECK_NOTREACHED(); + case Vad::kError: { + FATAL(); // Fails only if fed invalid data. + break; } } diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc index 0988d2c8e5..997b034df0 100644 --- a/modules/audio_coding/neteq/tools/neteq_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_test.cc @@ -51,12 +51,12 @@ void DefaultNetEqTestErrorCallback::OnInsertPacketError( const NetEqInput::PacketData& packet) { std::cerr << "InsertPacket returned an error." << std::endl; std::cerr << "Packet data: " << packet.ToString() << std::endl; - RTC_FATAL(); + FATAL(); } void DefaultNetEqTestErrorCallback::OnGetAudioError() { std::cerr << "GetAudio returned an error." << std::endl; - RTC_FATAL(); + FATAL(); } NetEqTest::NetEqTest(const NetEq::Config& config, diff --git a/modules/audio_coding/neteq/tools/rtp_file_source.cc b/modules/audio_coding/neteq/tools/rtp_file_source.cc index 78523308e3..f578065578 100644 --- a/modules/audio_coding/neteq/tools/rtp_file_source.cc +++ b/modules/audio_coding/neteq/tools/rtp_file_source.cc @@ -91,9 +91,8 @@ bool RtpFileSource::OpenFile(const std::string& file_name) { return true; rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kPcap, file_name)); if (!rtp_reader_) { - RTC_FATAL() - << "Couldn't open input file as either a rtpdump or .pcap. Note " - << "that .pcapng is not supported."; + FATAL() << "Couldn't open input file as either a rtpdump or .pcap. Note " + "that .pcapng is not supported."; } return true; } diff --git a/modules/audio_processing/test/py_quality_assessment/quality_assessment/fake_polqa.cc b/modules/audio_processing/test/py_quality_assessment/quality_assessment/fake_polqa.cc index bae652e283..62d8ebb84d 100644 --- a/modules/audio_processing/test/py_quality_assessment/quality_assessment/fake_polqa.cc +++ b/modules/audio_processing/test/py_quality_assessment/quality_assessment/fake_polqa.cc @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) { return 0; } } - RTC_FATAL() << kErrorMessage; + FATAL() << kErrorMessage; } } // namespace test diff --git a/modules/audio_processing/test/wav_based_simulator.cc b/modules/audio_processing/test/wav_based_simulator.cc index 6dab469e2b..8536bf13be 100644 --- a/modules/audio_processing/test/wav_based_simulator.cc +++ b/modules/audio_processing/test/wav_based_simulator.cc @@ -43,9 +43,8 @@ WavBasedSimulator::GetCustomEventChain(const std::string& filename) { case '\n': break; default: - RTC_FATAL() - << "Incorrect custom call order file, reverting to using the " - << "default call order"; + FATAL() << "Incorrect custom call order file, reverting to using the " + "default call order"; return WavBasedSimulator::GetDefaultEventChain(); } diff --git a/rtc_base/checks.h b/rtc_base/checks.h index 21fca7e40f..508de2a577 100644 --- a/rtc_base/checks.h +++ b/rtc_base/checks.h @@ -95,7 +95,7 @@ RTC_NORETURN void rtc_FatalMessage(const char* file, int line, const char* msg); // messages if the condition doesn't hold. Prefer them to raw RTC_CHECK and // RTC_DCHECK. // -// - RTC_FATAL() aborts unconditionally. +// - FATAL() aborts unconditionally. namespace rtc { namespace webrtc_checks_impl { @@ -454,7 +454,8 @@ RTC_NORETURN RTC_EXPORT void UnreachableCodeReached(); RTC_UNREACHABLE_FILE_AND_LINE_CALL_ARGS); \ } while (0) -#define RTC_FATAL() \ +// TODO(bugs.webrtc.org/8454): Add an RTC_ prefix or rename differently. +#define FATAL() \ ::rtc::webrtc_checks_impl::FatalLogCall(__FILE__, __LINE__, \ "FATAL()") & \ ::rtc::webrtc_checks_impl::LogStreamer<>() diff --git a/rtc_base/checks_unittest.cc b/rtc_base/checks_unittest.cc index 95deba9f1c..91e04cf6a1 100644 --- a/rtc_base/checks_unittest.cc +++ b/rtc_base/checks_unittest.cc @@ -21,7 +21,7 @@ TEST(ChecksTest, ExpressionNotEvaluatedWhenCheckPassing) { #if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) TEST(ChecksDeathTest, Checks) { #if RTC_CHECK_MSG_ENABLED - EXPECT_DEATH(RTC_FATAL() << "message", + EXPECT_DEATH(FATAL() << "message", "\n\n#\n" "# Fatal error in: \\S+, line \\w+\n" "# last system error: \\w+\n" @@ -45,7 +45,7 @@ TEST(ChecksDeathTest, Checks) { "# Check failed: false\n" "# Hi there!"); #else - EXPECT_DEATH(RTC_FATAL() << "message", + EXPECT_DEATH(FATAL() << "message", "\n\n#\n" "# Fatal error in: \\S+, line \\w+\n" "# last system error: \\w+\n" diff --git a/test/rtp_file_reader.cc b/test/rtp_file_reader.cc index cc5f6f78a2..336beff1e7 100644 --- a/test/rtp_file_reader.cc +++ b/test/rtp_file_reader.cc @@ -87,10 +87,10 @@ class InterleavedRtpFileReader : public RtpFileReaderImpl { uint32_t len = 0; TRY(ReadUint32(&len, file_)); if (packet->length < len) { - RTC_FATAL() << "Packet is too large to fit: " << len << " bytes vs " - << packet->length - << " bytes allocated. Consider increasing the buffer " - << "size"; + FATAL() << "Packet is too large to fit: " << len << " bytes vs " + << packet->length + << " bytes allocated. Consider increasing the buffer " + "size"; } if (fread(packet->data, 1, len, file_) != len) return false;