Replace RTC_DCHECK(false) with RTC_NOTREACHED().

Bulk of changes done using

  git grep -l 'RTC_DCHECK(false)' | \
    xargs sed -i 's/RTC_DCHECK(false)/RTC_NOTREACHED()/'

peerconnection.cc also used RTC_DCHECK(false && "msg") in two places,
which were updated manually.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2623313004
Cr-Commit-Position: refs/heads/master@{#16026}
This commit is contained in:
nisse 2017-01-12 02:24:27 -08:00 committed by Commit bot
parent 295760daa1
commit eb4ca4e823
26 changed files with 44 additions and 44 deletions

View File

@ -327,7 +327,7 @@ RTCErrorType ParseIceServerUrl(
default:
// We shouldn't get to this point with an invalid service_type, we should
// have returned an error already.
RTC_DCHECK(false) << "Unexpected service type";
RTC_NOTREACHED() << "Unexpected service type";
return RTCErrorType::INTERNAL_ERROR;
}
return RTCErrorType::NONE;
@ -548,7 +548,7 @@ std::string GenerateRtcpCname() {
std::string cname;
if (!rtc::CreateRandomString(kRtcpCnameLength, &cname)) {
LOG(LS_ERROR) << "Failed to generate CNAME.";
RTC_DCHECK(false);
RTC_NOTREACHED();
}
return cname;
}
@ -1617,7 +1617,7 @@ void PeerConnection::OnMessage(rtc::Message* msg) {
break;
}
default:
RTC_DCHECK(false && "Not implemented");
RTC_NOTREACHED() << "Not implemented";
break;
}
}
@ -2042,7 +2042,7 @@ void PeerConnection::OnRemoteTrackSeen(const std::string& stream_label,
} else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
CreateVideoReceiver(stream, track_id, ssrc);
} else {
RTC_DCHECK(false && "Invalid media type");
RTC_NOTREACHED() << "Invalid media type";
}
}

View File

@ -173,7 +173,7 @@ void QuicDataChannel::OnQueuedBytesWritten(net::QuicStreamId stream_id,
SetBufferedAmount_w(buffered_amount_ - queued_bytes_written);
const auto& kv = write_blocked_quic_streams_.find(stream_id);
if (kv == write_blocked_quic_streams_.end()) {
RTC_DCHECK(false);
RTC_NOTREACHED();
return;
}
cricket::ReliableQuicStream* stream = kv->second;
@ -301,7 +301,7 @@ void QuicDataChannel::OnDataReceived(net::QuicStreamId stream_id,
RTC_DCHECK(data);
const auto& kv = incoming_quic_messages_.find(stream_id);
if (kv == incoming_quic_messages_.end()) {
RTC_DCHECK(false);
RTC_NOTREACHED();
return;
}
Message& message = kv->second;

View File

@ -134,7 +134,7 @@ void QuicDataTransport::OnDataReceived(net::QuicStreamId id,
size_t len) {
const auto& quic_stream_kv = quic_stream_by_id_.find(id);
if (quic_stream_kv == quic_stream_by_id_.end()) {
RTC_DCHECK(false);
RTC_NOTREACHED();
return;
}
cricket::ReliableQuicStream* stream = quic_stream_kv->second;

View File

@ -66,7 +66,7 @@ void AudioRtpReceiver::OnSetVolume(double volume) {
// setting the volume to the source when the track is disabled.
if (!stopped_ && track_->enabled()) {
if (!channel_->SetOutputVolume(ssrc_, cached_volume_)) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
}
}
@ -107,7 +107,7 @@ void AudioRtpReceiver::Reconfigure() {
}
if (!channel_->SetOutputVolume(ssrc_,
track_->enabled() ? cached_volume_ : 0)) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
}
@ -161,7 +161,7 @@ VideoRtpReceiver::VideoRtpReceiver(MediaStreamInterface* stream,
<< "VideoRtpReceiver::VideoRtpReceiver: No video channel exists.";
} else {
if (!channel_->SetSink(ssrc_, &broadcaster_)) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
}
stream->AddTrack(track_);
@ -225,7 +225,7 @@ void VideoRtpReceiver::SetChannel(cricket::VideoChannel* channel) {
channel_ = channel;
if (channel_) {
if (!channel_->SetSink(ssrc_, &broadcaster_)) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
channel_->SignalFirstPacketReceived.connect(
this, &VideoRtpReceiver::OnFirstPacketReceived);

View File

@ -388,7 +388,7 @@ void VideoRtpSender::SetVideoSend() {
break;
}
if (!channel_->SetVideoSend(ssrc_, track_->enabled(), &options, track_)) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
}

View File

@ -351,7 +351,7 @@ const char* IceCandidateTypeToStatsType(const std::string& candidate_type) {
if (candidate_type == cricket::RELAY_PORT_TYPE) {
return STATSREPORT_RELAY_PORT_TYPE;
}
RTC_DCHECK(false);
RTC_NOTREACHED();
return "unknown";
}
@ -370,7 +370,7 @@ const char* AdapterTypeToStatsType(rtc::AdapterType type) {
case rtc::ADAPTER_TYPE_LOOPBACK:
return STATSREPORT_ADAPTER_TYPE_LOOPBACK;
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
return "";
}
}

View File

@ -57,7 +57,7 @@ const char* InternalTypeToString(StatsReport::StatsType type) {
case StatsReport::kStatsReportTypeDataChannel:
return "datachannel";
}
RTC_DCHECK(false);
RTC_NOTREACHED();
return nullptr;
}

View File

@ -411,7 +411,7 @@ static std::string GetErrorCodeString(webrtc::WebRtcSession::Error err) {
GET_STRING_OF_ERROR_CODE(ERROR_CONTENT)
GET_STRING_OF_ERROR_CODE(ERROR_TRANSPORT)
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
break;
}
return result;
@ -1192,7 +1192,7 @@ cricket::IceConfig WebRtcSession::ParseIceConfig(
gathering_policy = cricket::GATHER_CONTINUALLY;
break;
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
gathering_policy = cricket::GATHER_ONCE;
}
cricket::IceConfig ice_config;

View File

@ -111,7 +111,7 @@ std::string AdapterTypeToString(AdapterType type) {
case ADAPTER_TYPE_LOOPBACK:
return "Loopback";
default:
RTC_DCHECK(false) << "Invalid type " << type;
RTC_NOTREACHED() << "Invalid type " << type;
return std::string();
}
}

View File

@ -119,7 +119,7 @@ const char* unsafe_filename_characters() {
return "\\/:*?\"<>|";
#else // !WEBRTC_WIN
// TODO(grunell): Should this never be reached?
RTC_DCHECK(false);
RTC_NOTREACHED();
return "";
#endif // !WEBRTC_WIN
}
@ -274,7 +274,7 @@ size_t html_encode(char * buffer, size_t buflen,
case '\'': escseq = "&#39;"; esclen = 5; break;
case '\"': escseq = "&quot;"; esclen = 6; break;
case '&': escseq = "&amp;"; esclen = 5; break;
default: RTC_DCHECK(false);
default: RTC_NOTREACHED();
}
if (bufpos + esclen >= buflen) {
break;
@ -331,7 +331,7 @@ size_t xml_encode(char * buffer, size_t buflen,
case '\'': escseq = "&apos;"; esclen = 6; break;
case '\"': escseq = "&quot;"; esclen = 6; break;
case '&': escseq = "&amp;"; esclen = 5; break;
default: RTC_DCHECK(false);
default: RTC_NOTREACHED();
}
if (bufpos + esclen >= buflen) {
break;

View File

@ -47,7 +47,7 @@ int64_t SystemTimeNanos() {
// Get the timebase if this is the first time we run.
// Recommended by Apple's QA1398.
if (mach_timebase_info(&timebase) != KERN_SUCCESS) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
}
// Use timebase to convert absolute time tick units into nanoseconds.

View File

@ -430,7 +430,7 @@ void VirtualSocket::OnMessage(Message* pmsg) {
} else if (pmsg->message_id == MSG_ID_ADDRESS_BOUND) {
SignalAddressReady(this, GetLocalAddress());
} else {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
}
@ -689,7 +689,7 @@ int VirtualSocketServer::Bind(VirtualSocket* socket, SocketAddress* addr) {
if (!IPIsUnspec(addr->ipaddr())) {
addr->SetIP(addr->ipaddr().Normalized());
} else {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
if (addr->port() == 0) {

View File

@ -37,7 +37,7 @@ class VadImpl final : public Vad {
case 1:
return kActive;
default:
RTC_DCHECK(false) << "WebRtcVad_Process returned an error.";
RTC_NOTREACHED() << "WebRtcVad_Process returned an error.";
return kError;
}
}

View File

@ -1743,7 +1743,7 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoder(
// This shouldn't happen, we should not be trying to create something we don't
// support.
RTC_DCHECK(false);
RTC_NOTREACHED();
return AllocatedEncoder(NULL, cricket::VideoCodec(), false);
}

View File

@ -33,7 +33,7 @@ int16_t MapSetting(EchoControlMobile::RoutingMode mode) {
case EchoControlMobile::kLoudSpeakerphone:
return 4;
}
RTC_DCHECK(false);
RTC_NOTREACHED();
return -1;
}

View File

@ -30,7 +30,7 @@ int16_t MapSetting(GainControl::Mode mode) {
case GainControl::kFixedDigital:
return kAgcModeFixedDigital;
}
RTC_DCHECK(false);
RTC_NOTREACHED();
return -1;
}

View File

@ -1545,7 +1545,7 @@ void WebRtcNsx_ProcessCore(NoiseSuppressionFixedC* inst,
#ifdef NS_FILEDEBUG
if (fwrite(spframe, sizeof(short),
inst->blockLen10ms, inst->infile) != inst->blockLen10ms) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
#endif
@ -2025,7 +2025,7 @@ void WebRtcNsx_ProcessCore(NoiseSuppressionFixedC* inst,
#ifdef NS_FILEDEBUG
if (fwrite(outframe, sizeof(short),
inst->blockLen10ms, inst->outfile) != inst->blockLen10ms) {
RTC_DCHECK(false);
RTC_NOTREACHED();
}
#endif

View File

@ -32,7 +32,7 @@ std::string GetApmRenderTestVectorFileName(int sample_rate_hz) {
case 48000:
return ResourcePath("far48_stereo", "pcm");
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
}
return "";
}
@ -48,7 +48,7 @@ std::string GetApmCaptureTestVectorFileName(int sample_rate_hz) {
case 48000:
return ResourcePath("near48_stereo", "pcm");
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
}
return "";
}

View File

@ -83,7 +83,7 @@ ScreenDrawerLinux::ScreenDrawerLinux() {
if (!XGetWindowAttributes(display_->display(),
RootWindow(display_->display(), screen_num_),
&root_attributes)) {
RTC_DCHECK(false) << "Failed to get root window size.";
RTC_NOTREACHED() << "Failed to get root window size.";
}
window_ = XCreateSimpleWindow(
display_->display(), RootWindow(display_->display(), screen_num_), 0, 0,
@ -105,7 +105,7 @@ ScreenDrawerLinux::ScreenDrawerLinux() {
if (!XTranslateCoordinates(display_->display(), window_,
RootWindow(display_->display(), screen_num_), 0, 0,
&x, &y, &child)) {
RTC_DCHECK(false) << "Failed to get window position.";
RTC_NOTREACHED() << "Failed to get window position.";
}
// Some window manager does not allow a window to cover two or more monitors.
// So if the window is on the first monitor of a two-monitor system, the

View File

@ -633,7 +633,7 @@ void DtlsTransportChannelWrapper::MaybeStartDtls() {
// packets in this state, the incoming queue must be empty. We
// ignore write errors, thus any errors must be because of
// configuration and therefore are our fault.
RTC_DCHECK(false) << "StartSSL failed.";
RTC_NOTREACHED() << "StartSSL failed.";
LOG_J(LS_ERROR, this) << "Couldn't start DTLS handshake";
set_dtls_state(DTLS_TRANSPORT_FAILED);
return;

View File

@ -1420,7 +1420,7 @@ void P2PTransportChannel::UpdateState() {
RTC_DCHECK(state == STATE_CONNECTING || state == STATE_COMPLETED);
break;
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
break;
}
state_ = state;
@ -1759,7 +1759,7 @@ bool P2PTransportChannel::GetUseCandidateAttr(Connection* conn,
return selected || better_than_selected;
}
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
return false;
}
}

View File

@ -759,7 +759,7 @@ void TransportController::OnChannelCandidateGathered_n(
// We should never signal peer-reflexive candidates.
if (candidate.type() == PRFLX_PORT_TYPE) {
RTC_DCHECK(false);
RTC_NOTREACHED();
return;
}
std::vector<Candidate> candidates;

View File

@ -58,7 +58,7 @@ int GetProtocolPriority(cricket::ProtocolType protocol) {
case cricket::PROTO_SSLTCP:
return 0;
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
return 0;
}
}
@ -70,7 +70,7 @@ int GetAddressFamilyPriority(int ip_family) {
case AF_INET:
return 1;
default:
RTC_DCHECK(false);
RTC_NOTREACHED();
return 0;
}
}

View File

@ -738,7 +738,7 @@ bool BaseChannel::SendPacket(bool rtcp,
// (and SetSend(true) is called).
LOG(LS_ERROR) << "Can't send outgoing RTP packet when SRTP is inactive"
<< " and crypto is required";
RTC_DCHECK(false);
RTC_NOTREACHED();
return false;
}
@ -998,7 +998,7 @@ bool BaseChannel::SetupDtlsSrtp_n(bool rtcp_channel) {
NULL, 0, false,
&dtls_buffer[0], dtls_buffer.size())) {
LOG(LS_WARNING) << "DTLS-SRTP key export failed";
RTC_DCHECK(false); // This should never happen
RTC_NOTREACHED(); // This should never happen
return false;
}

View File

@ -84,7 +84,7 @@ static rtc::AdapterType AdapterTypeFromNetworkType(NetworkType network_type) {
// Map it to VPN for now.
return rtc::ADAPTER_TYPE_VPN;
default:
RTC_DCHECK(false) << "Invalid network type " << network_type;
RTC_NOTREACHED() << "Invalid network type " << network_type;
return rtc::ADAPTER_TYPE_UNKNOWN;
}
}

View File

@ -475,7 +475,7 @@ OutputMixer::DoOperationsOnCombinedSignal(bool feed_data_to_apm)
if (_audioProcessingModulePtr->ProcessReverseStream(&_audioFrame) != 0) {
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
"AudioProcessingModule::ProcessReverseStream() => error");
RTC_DCHECK(false);
RTC_NOTREACHED();
}
}