diff --git a/audio/remix_resample.cc b/audio/remix_resample.cc index 3694d34e40..178af622a1 100644 --- a/audio/remix_resample.cc +++ b/audio/remix_resample.cc @@ -56,9 +56,10 @@ void RemixAndResample(const int16_t* src_data, if (resampler->InitializeIfNeeded(sample_rate_hz, dst_frame->sample_rate_hz_, audio_ptr_num_channels) == -1) { - 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; + 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; } // TODO(yujo): for muted input frames, don't resample. Either 1) allow @@ -70,9 +71,10 @@ void RemixAndResample(const int16_t* src_data, resampler->Resample(audio_ptr, src_length, dst_frame->mutable_data(), AudioFrame::kMaxDataSizeSamples); if (out_length == -1) { - FATAL() << "Resample failed: audio_ptr = " << audio_ptr - << ", src_length = " << src_length - << ", dst_frame->mutable_data() = " << dst_frame->mutable_data(); + RTC_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 823c5ad7a1..8bbe7c8728 100644 --- a/common_video/video_frame_buffer.cc +++ b/common_video/video_frame_buffer.cc @@ -266,8 +266,7 @@ rtc::scoped_refptr WrapYuvBuffer( return WrapI444Buffer(width, height, y_plane, y_stride, u_plane, u_stride, v_plane, v_stride, no_longer_used); default: - FATAL() << "Unexpected frame buffer type."; - return nullptr; + RTC_CHECK_NOTREACHED(); } } diff --git a/modules/audio_coding/codecs/cng/audio_encoder_cng.cc b/modules/audio_coding/codecs/cng/audio_encoder_cng.cc index 600cb0c06a..7546ac178f 100644 --- a/modules/audio_coding/codecs/cng/audio_encoder_cng.cc +++ b/modules/audio_coding/codecs/cng/audio_encoder_cng.cc @@ -171,9 +171,8 @@ AudioEncoder::EncodedInfo AudioEncoderCng::EncodeImpl( last_frame_active_ = true; break; } - case Vad::kError: { - FATAL(); // Fails only if fed invalid data. - break; + default: { + RTC_CHECK_NOTREACHED(); } } diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc index 997b034df0..0988d2c8e5 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; - FATAL(); + RTC_FATAL(); } void DefaultNetEqTestErrorCallback::OnGetAudioError() { std::cerr << "GetAudio returned an error." << std::endl; - FATAL(); + RTC_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 f578065578..78523308e3 100644 --- a/modules/audio_coding/neteq/tools/rtp_file_source.cc +++ b/modules/audio_coding/neteq/tools/rtp_file_source.cc @@ -91,8 +91,9 @@ bool RtpFileSource::OpenFile(const std::string& file_name) { return true; rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kPcap, file_name)); if (!rtp_reader_) { - FATAL() << "Couldn't open input file as either a rtpdump or .pcap. Note " - "that .pcapng is not supported."; + RTC_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 62d8ebb84d..bae652e283 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; } } - FATAL() << kErrorMessage; + RTC_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 8536bf13be..6dab469e2b 100644 --- a/modules/audio_processing/test/wav_based_simulator.cc +++ b/modules/audio_processing/test/wav_based_simulator.cc @@ -43,8 +43,9 @@ WavBasedSimulator::GetCustomEventChain(const std::string& filename) { case '\n': break; default: - FATAL() << "Incorrect custom call order file, reverting to using the " - "default call order"; + RTC_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 508de2a577..21fca7e40f 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. // -// - FATAL() aborts unconditionally. +// - RTC_FATAL() aborts unconditionally. namespace rtc { namespace webrtc_checks_impl { @@ -454,8 +454,7 @@ RTC_NORETURN RTC_EXPORT void UnreachableCodeReached(); RTC_UNREACHABLE_FILE_AND_LINE_CALL_ARGS); \ } while (0) -// TODO(bugs.webrtc.org/8454): Add an RTC_ prefix or rename differently. -#define FATAL() \ +#define RTC_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 91e04cf6a1..95deba9f1c 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(FATAL() << "message", + EXPECT_DEATH(RTC_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(FATAL() << "message", + EXPECT_DEATH(RTC_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 336beff1e7..cc5f6f78a2 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) { - FATAL() << "Packet is too large to fit: " << len << " bytes vs " - << packet->length - << " bytes allocated. Consider increasing the buffer " - "size"; + RTC_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;