Rename FATAL() into RTC_FATAL().

No-Try: True
Bug: webrtc:8454
Change-Id: I9130487a92463a2128cf1493e6c5117b2fab313a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193703
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32620}
This commit is contained in:
Mirko Bonadei
2020-11-17 14:50:54 +01:00
committed by Commit Bot
parent 11ab77d14f
commit 9653d26f8e
10 changed files with 28 additions and 27 deletions

View File

@ -56,8 +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) {
FATAL() << "InitializeIfNeeded failed: sample_rate_hz = " << sample_rate_hz
<< ", dst_frame->sample_rate_hz_ = " << dst_frame->sample_rate_hz_
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;
}
@ -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
RTC_FATAL() << "Resample failed: audio_ptr = " << audio_ptr
<< ", src_length = " << src_length
<< ", dst_frame->mutable_data() = " << dst_frame->mutable_data();
<< ", dst_frame->mutable_data() = "
<< dst_frame->mutable_data();
}
dst_frame->samples_per_channel_ = out_length / audio_ptr_num_channels;

View File

@ -266,8 +266,7 @@ rtc::scoped_refptr<PlanarYuvBuffer> 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();
}
}

View File

@ -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();
}
}

View File

@ -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,

View File

@ -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;
}

View File

@ -43,7 +43,7 @@ int main(int argc, char* argv[]) {
return 0;
}
}
FATAL() << kErrorMessage;
RTC_FATAL() << kErrorMessage;
}
} // namespace test

View File

@ -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();
}

View File

@ -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<false>(__FILE__, __LINE__, \
"FATAL()") & \
::rtc::webrtc_checks_impl::LogStreamer<>()

View File

@ -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"

View File

@ -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 "
RTC_FATAL() << "Packet is too large to fit: " << len << " bytes vs "
<< packet->length
<< " bytes allocated. Consider increasing the buffer "
"size";
<< "size";
}
if (fread(packet->data, 1, len, file_) != len)
return false;