mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
Introduce RTC_CHECK_NOTREACHED(), an always-checking RTC_NOTREACHED()
And use it in a few places that were using RTC_CHECK(false) or FATAL() to do the exact same job. There should be no change in behavior. Bug: none Change-Id: I36d5e6bcf35fd41534e08a8c879fa0811b4f1967 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191963 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32567}
This commit is contained in:
parent
9dfe2fce9a
commit
c95b939667
42 changed files with 168 additions and 177 deletions
|
@ -21,7 +21,7 @@ const char* ResourceUsageStateToString(ResourceUsageState usage_state) {
|
||||||
case ResourceUsageState::kUnderuse:
|
case ResourceUsageState::kUnderuse:
|
||||||
return "kUnderuse";
|
return "kUnderuse";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceListener::~ResourceListener() {}
|
ResourceListener::~ResourceListener() {}
|
||||||
|
|
|
@ -32,7 +32,7 @@ int GetIlbcBitrate(int ptime) {
|
||||||
// 50 bytes per frame of 30 ms => (approx) 13333 bits/s.
|
// 50 bytes per frame of 30 ms => (approx) 13333 bits/s.
|
||||||
return 13333;
|
return 13333;
|
||||||
default:
|
default:
|
||||||
FATAL();
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -31,7 +31,7 @@ std::string MediaTypeToString(MediaType type) {
|
||||||
RTC_NOTREACHED();
|
RTC_NOTREACHED();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cricket
|
} // namespace cricket
|
||||||
|
|
|
@ -30,7 +30,7 @@ const char* DegradationPreferenceToString(
|
||||||
case DegradationPreference::BALANCED:
|
case DegradationPreference::BALANCED:
|
||||||
return "balanced";
|
return "balanced";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
const double kDefaultBitratePriority = 1.0;
|
const double kDefaultBitratePriority = 1.0;
|
||||||
|
|
|
@ -36,7 +36,7 @@ class DummyPeerConnection : public PeerConnectionInterface {
|
||||||
|
|
||||||
bool AddStream(MediaStreamInterface* stream) override { return false; }
|
bool AddStream(MediaStreamInterface* stream) override { return false; }
|
||||||
void RemoveStream(MediaStreamInterface* stream) override {
|
void RemoveStream(MediaStreamInterface* stream) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack(
|
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack(
|
||||||
|
@ -100,17 +100,17 @@ class DummyPeerConnection : public PeerConnectionInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStats(RTCStatsCollectorCallback* callback) override {
|
void GetStats(RTCStatsCollectorCallback* callback) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
void GetStats(
|
void GetStats(
|
||||||
rtc::scoped_refptr<RtpSenderInterface> selector,
|
rtc::scoped_refptr<RtpSenderInterface> selector,
|
||||||
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override {
|
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
void GetStats(
|
void GetStats(
|
||||||
rtc::scoped_refptr<RtpReceiverInterface> selector,
|
rtc::scoped_refptr<RtpReceiverInterface> selector,
|
||||||
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override {
|
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
void ClearStatsCache() override {}
|
void ClearStatsCache() override {}
|
||||||
|
|
||||||
|
@ -145,33 +145,33 @@ class DummyPeerConnection : public PeerConnectionInterface {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestartIce() override { FATAL() << "Not implemented"; }
|
void RestartIce() override { RTC_CHECK_NOTREACHED(); }
|
||||||
|
|
||||||
// Create a new offer.
|
// Create a new offer.
|
||||||
// The CreateSessionDescriptionObserver callback will be called when done.
|
// The CreateSessionDescriptionObserver callback will be called when done.
|
||||||
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) override {
|
const RTCOfferAnswerOptions& options) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) override {
|
const RTCOfferAnswerOptions& options) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
||||||
SessionDescriptionInterface* desc) override {
|
SessionDescriptionInterface* desc) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
void SetRemoteDescription(SetSessionDescriptionObserver* observer,
|
void SetRemoteDescription(SetSessionDescriptionObserver* observer,
|
||||||
SessionDescriptionInterface* desc) override {
|
SessionDescriptionInterface* desc) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
void SetRemoteDescription(
|
void SetRemoteDescription(
|
||||||
std::unique_ptr<SessionDescriptionInterface> desc,
|
std::unique_ptr<SessionDescriptionInterface> desc,
|
||||||
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer)
|
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer)
|
||||||
override {
|
override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerConnectionInterface::RTCConfiguration GetConfiguration() override {
|
PeerConnectionInterface::RTCConfiguration GetConfiguration() override {
|
||||||
|
@ -194,10 +194,8 @@ class DummyPeerConnection : public PeerConnectionInterface {
|
||||||
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented");
|
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAudioPlayout(bool playout) override { FATAL() << "Not implemented"; }
|
void SetAudioPlayout(bool playout) override { RTC_CHECK_NOTREACHED(); }
|
||||||
void SetAudioRecording(bool recording) override {
|
void SetAudioRecording(bool recording) override { RTC_CHECK_NOTREACHED(); }
|
||||||
FATAL() << "Not implemented";
|
|
||||||
}
|
|
||||||
|
|
||||||
rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid(
|
rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid(
|
||||||
const std::string& mid) override {
|
const std::string& mid) override {
|
||||||
|
@ -235,7 +233,7 @@ class DummyPeerConnection : public PeerConnectionInterface {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopRtcEventLog() { FATAL() << "Not implemented"; }
|
void StopRtcEventLog() { RTC_CHECK_NOTREACHED(); }
|
||||||
|
|
||||||
void Close() override {}
|
void Close() override {}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ const char* CodecTypeToPayloadString(VideoCodecType type) {
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
return kPayloadNameGeneric;
|
return kPayloadNameGeneric;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCodecType PayloadStringToCodecType(const std::string& name) {
|
VideoCodecType PayloadStringToCodecType(const std::string& name) {
|
||||||
|
|
|
@ -162,7 +162,7 @@ class VideoEncoderSoftwareFallbackWrapper final : public VideoEncoder {
|
||||||
case EncoderState::kForcedFallback:
|
case EncoderState::kForcedFallback:
|
||||||
return fallback_encoder_.get();
|
return fallback_encoder_.get();
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates encoder with last observed parameters, such as callbacks, rates,
|
// Updates encoder with last observed parameters, such as callbacks, rates,
|
||||||
|
@ -346,7 +346,7 @@ int32_t VideoEncoderSoftwareFallbackWrapper::Encode(
|
||||||
case EncoderState::kForcedFallback:
|
case EncoderState::kForcedFallback:
|
||||||
return fallback_encoder_->Encode(frame, frame_types);
|
return fallback_encoder_->Encode(frame, frame_types);
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t VideoEncoderSoftwareFallbackWrapper::EncodeWithMainEncoder(
|
int32_t VideoEncoderSoftwareFallbackWrapper::EncodeWithMainEncoder(
|
||||||
|
|
|
@ -162,7 +162,7 @@ const char* Adaptation::StatusToString(Adaptation::Status status) {
|
||||||
case Status::kRejectedByConstraint:
|
case Status::kRejectedByConstraint:
|
||||||
return "kRejectedByConstraint";
|
return "kRejectedByConstraint";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Adaptation::Adaptation(int validation_id,
|
Adaptation::Adaptation(int validation_id,
|
||||||
|
@ -382,7 +382,7 @@ VideoStreamAdapter::RestrictionsOrState VideoStreamAdapter::GetAdaptationUpStep(
|
||||||
case DegradationPreference::DISABLED:
|
case DegradationPreference::DISABLED:
|
||||||
return Adaptation::Status::kAdaptationDisabled;
|
return Adaptation::Status::kAdaptationDisabled;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Adaptation VideoStreamAdapter::GetAdaptationDown() {
|
Adaptation VideoStreamAdapter::GetAdaptationDown() {
|
||||||
|
@ -462,7 +462,7 @@ VideoStreamAdapter::GetAdaptationDownStep(
|
||||||
case DegradationPreference::DISABLED:
|
case DegradationPreference::DISABLED:
|
||||||
return Adaptation::Status::kAdaptationDisabled;
|
return Adaptation::Status::kAdaptationDisabled;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoStreamAdapter::RestrictionsOrState VideoStreamAdapter::DecreaseResolution(
|
VideoStreamAdapter::RestrictionsOrState VideoStreamAdapter::DecreaseResolution(
|
||||||
|
@ -601,7 +601,7 @@ Adaptation VideoStreamAdapter::GetAdaptDownResolution() {
|
||||||
GetAdaptDownResolutionStepForBalanced(input_state), input_state);
|
GetAdaptDownResolutionStepForBalanced(input_state), input_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoStreamAdapter::RestrictionsOrState
|
VideoStreamAdapter::RestrictionsOrState
|
||||||
|
|
|
@ -77,7 +77,7 @@ bool CoDelSimulation::DropDequeuedPacket(Timestamp now,
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulatedNetwork::SimulatedNetwork(Config config, uint64_t random_seed)
|
SimulatedNetwork::SimulatedNetwork(Config config, uint64_t random_seed)
|
||||||
|
|
|
@ -28,7 +28,7 @@ const char* StreamTypeToString(VideoSendStream::StreamStats::StreamType type) {
|
||||||
case VideoSendStream::StreamStats::StreamType::kFlexfec:
|
case VideoSendStream::StreamStats::StreamType::kFlexfec:
|
||||||
return "flexfec";
|
return "flexfec";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -132,7 +132,7 @@ uint16_t MapWavFormatToHeaderField(WavFormat format) {
|
||||||
case WavFormat::kWavFormatMuLaw:
|
case WavFormat::kWavFormatMuLaw:
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
WavFormat MapHeaderFieldToWavFormat(uint16_t format_header_value) {
|
WavFormat MapHeaderFieldToWavFormat(uint16_t format_header_value) {
|
||||||
|
@ -278,10 +278,8 @@ size_t GetFormatBytesPerSample(WavFormat format) {
|
||||||
return 1;
|
return 1;
|
||||||
case WavFormat::kWavFormatIeeeFloat:
|
case WavFormat::kWavFormatIeeeFloat:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
|
||||||
RTC_CHECK(false);
|
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckWavParameters(size_t num_channels,
|
bool CheckWavParameters(size_t num_channels,
|
||||||
|
|
|
@ -323,7 +323,7 @@ absl::string_view RtpPacketTypeToString(RtpPacketType packet_type) {
|
||||||
case RtpPacketType::kUnknown:
|
case RtpPacketType::kUnknown:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
RtpPacketType InferRtpPacketType(rtc::ArrayView<const char> packet) {
|
RtpPacketType InferRtpPacketType(rtc::ArrayView<const char> packet) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ int GetIlbcBitrate(int ptime) {
|
||||||
// 50 bytes per frame of 30 ms => (approx) 13333 bits/s.
|
// 50 bytes per frame of 30 ms => (approx) 13333 bits/s.
|
||||||
return 13333;
|
return 13333;
|
||||||
default:
|
default:
|
||||||
FATAL();
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ size_t AudioEncoderIlbcImpl::RequiredOutputSizeBytes() const {
|
||||||
case 6:
|
case 6:
|
||||||
return 2 * 50;
|
return 2 * 50;
|
||||||
default:
|
default:
|
||||||
FATAL();
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,15 +103,13 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||||
int32_t PlayoutDeviceName(uint16_t index,
|
int32_t PlayoutDeviceName(uint16_t index,
|
||||||
char name[kAdmMaxDeviceNameSize],
|
char name[kAdmMaxDeviceNameSize],
|
||||||
char guid[kAdmMaxGuidSize]) override {
|
char guid[kAdmMaxGuidSize]) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t RecordingDeviceName(uint16_t index,
|
int32_t RecordingDeviceName(uint16_t index,
|
||||||
char name[kAdmMaxDeviceNameSize],
|
char name[kAdmMaxDeviceNameSize],
|
||||||
char guid[kAdmMaxGuidSize]) override {
|
char guid[kAdmMaxGuidSize]) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetPlayoutDevice(uint16_t index) override {
|
int32_t SetPlayoutDevice(uint16_t index) override {
|
||||||
|
@ -123,8 +121,7 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||||
|
|
||||||
int32_t SetPlayoutDevice(
|
int32_t SetPlayoutDevice(
|
||||||
AudioDeviceModule::WindowsDeviceType device) override {
|
AudioDeviceModule::WindowsDeviceType device) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetRecordingDevice(uint16_t index) override {
|
int32_t SetRecordingDevice(uint16_t index) override {
|
||||||
|
@ -136,8 +133,7 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||||
|
|
||||||
int32_t SetRecordingDevice(
|
int32_t SetRecordingDevice(
|
||||||
AudioDeviceModule::WindowsDeviceType device) override {
|
AudioDeviceModule::WindowsDeviceType device) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PlayoutIsAvailable(bool& available) override {
|
int32_t PlayoutIsAvailable(bool& available) override {
|
||||||
|
@ -266,53 +262,38 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetMicrophoneVolume(uint32_t volume) override {
|
int32_t SetMicrophoneVolume(uint32_t volume) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MicrophoneVolume(uint32_t& volume) const override {
|
int32_t MicrophoneVolume(uint32_t& volume) const override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override {
|
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const override {
|
int32_t MinMicrophoneVolume(uint32_t& minVolume) const override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SpeakerMuteIsAvailable(bool& available) override {
|
int32_t SpeakerMuteIsAvailable(bool& available) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetSpeakerMute(bool enable) override {
|
int32_t SetSpeakerMute(bool enable) override { RTC_CHECK_NOTREACHED(); }
|
||||||
FATAL() << "Should never be called";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t SpeakerMute(bool& enabled) const override {
|
int32_t SpeakerMute(bool& enabled) const override { RTC_CHECK_NOTREACHED(); }
|
||||||
FATAL() << "Should never be called";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t MicrophoneMuteIsAvailable(bool& available) override {
|
int32_t MicrophoneMuteIsAvailable(bool& available) override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetMicrophoneMute(bool enable) override {
|
int32_t SetMicrophoneMute(bool enable) override { RTC_CHECK_NOTREACHED(); }
|
||||||
FATAL() << "Not implemented";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t MicrophoneMute(bool& enabled) const override {
|
int32_t MicrophoneMute(bool& enabled) const override {
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the audio manager has been configured to support stereo
|
// Returns true if the audio manager has been configured to support stereo
|
||||||
|
|
|
@ -219,8 +219,7 @@ int32_t AudioRecordJni::EnableBuiltInAEC(bool enable) {
|
||||||
|
|
||||||
int32_t AudioRecordJni::EnableBuiltInAGC(bool enable) {
|
int32_t AudioRecordJni::EnableBuiltInAGC(bool enable) {
|
||||||
// TODO(henrika): possibly remove when no longer used by any client.
|
// TODO(henrika): possibly remove when no longer used by any client.
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AudioRecordJni::EnableBuiltInNS(bool enable) {
|
int32_t AudioRecordJni::EnableBuiltInNS(bool enable) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ float GetLevel(const VadLevelAnalyzer::Result& vad_level,
|
||||||
return vad_level.peak_dbfs;
|
return vad_level.peak_dbfs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -114,7 +114,7 @@ GainControl::Mode Agc1ConfigModeToInterfaceMode(
|
||||||
case Agc1Config::kFixedDigital:
|
case Agc1Config::kFixedDigital:
|
||||||
return GainControl::kFixedDigital;
|
return GainControl::kFixedDigital;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maximum lengths that frame of samples being passed from the render side to
|
// Maximum lengths that frame of samples being passed from the render side to
|
||||||
|
@ -1830,7 +1830,7 @@ void AudioProcessingImpl::InitializeNoiseSuppressor() {
|
||||||
case NoiseSuppresionConfig::kVeryHigh:
|
case NoiseSuppresionConfig::kVeryHigh:
|
||||||
return NsConfig::SuppressionLevel::k21dB;
|
return NsConfig::SuppressionLevel::k21dB;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
};
|
};
|
||||||
|
|
||||||
NsConfig cfg;
|
NsConfig cfg;
|
||||||
|
|
|
@ -31,7 +31,7 @@ std::string NoiseSuppressionLevelToString(
|
||||||
case AudioProcessing::Config::NoiseSuppression::Level::kVeryHigh:
|
case AudioProcessing::Config::NoiseSuppression::Level::kVeryHigh:
|
||||||
return "VeryHigh";
|
return "VeryHigh";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GainController1ModeToString(const Agc1Config::Mode& mode) {
|
std::string GainController1ModeToString(const Agc1Config::Mode& mode) {
|
||||||
|
@ -43,7 +43,7 @@ std::string GainController1ModeToString(const Agc1Config::Mode& mode) {
|
||||||
case Agc1Config::Mode::kFixedDigital:
|
case Agc1Config::Mode::kFixedDigital:
|
||||||
return "FixedDigital";
|
return "FixedDigital";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GainController2LevelEstimatorToString(
|
std::string GainController2LevelEstimatorToString(
|
||||||
|
@ -54,7 +54,7 @@ std::string GainController2LevelEstimatorToString(
|
||||||
case Agc2Config::LevelEstimator::kPeak:
|
case Agc2Config::LevelEstimator::kPeak:
|
||||||
return "Peak";
|
return "Peak";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetDefaultMaxInternalRate() {
|
int GetDefaultMaxInternalRate() {
|
||||||
|
|
|
@ -269,8 +269,7 @@ void AecDumpBasedSimulator::HandleEvent(
|
||||||
HandleMessage(event_msg.runtime_setting());
|
HandleMessage(event_msg.runtime_setting());
|
||||||
break;
|
break;
|
||||||
case webrtc::audioproc::Event::UNKNOWN_EVENT:
|
case webrtc::audioproc::Event::UNKNOWN_EVENT:
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ EchoCanceller3Config ReadAec3ConfigFromJsonFile(const std::string& filename) {
|
||||||
std::ifstream f(filename.c_str());
|
std::ifstream f(filename.c_str());
|
||||||
if (f.fail()) {
|
if (f.fail()) {
|
||||||
std::cout << "Failed to open the file " << filename << std::endl;
|
std::cout << "Failed to open the file " << filename << std::endl;
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
while (std::getline(f, s)) {
|
while (std::getline(f, s)) {
|
||||||
json_string += s;
|
json_string += s;
|
||||||
|
@ -52,7 +52,7 @@ EchoCanceller3Config ReadAec3ConfigFromJsonFile(const std::string& filename) {
|
||||||
if (!parsing_successful) {
|
if (!parsing_successful) {
|
||||||
std::cout << "Parsing of json string failed: " << std::endl
|
std::cout << "Parsing of json string failed: " << std::endl
|
||||||
<< json_string << std::endl;
|
<< json_string << std::endl;
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
RTC_CHECK(EchoCanceller3Config::Validate(&cfg));
|
RTC_CHECK(EchoCanceller3Config::Validate(&cfg));
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,7 @@ bool DebugDumpReplayer::RunNextEvent() {
|
||||||
break;
|
break;
|
||||||
case audioproc::Event::UNKNOWN_EVENT:
|
case audioproc::Event::UNKNOWN_EVENT:
|
||||||
// We do not expect to receive UNKNOWN event.
|
// We do not expect to receive UNKNOWN event.
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
LoadNextMessage();
|
LoadNextMessage();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -146,8 +146,7 @@ AudioProcessing::ChannelLayout LayoutFromChannels(size_t num_channels) {
|
||||||
case 2:
|
case 2:
|
||||||
return AudioProcessing::kStereo;
|
return AudioProcessing::kStereo;
|
||||||
default:
|
default:
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
return AudioProcessing::kMono;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ void WavBasedSimulator::Process() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
call_chain_index = (call_chain_index + 1) % call_chain_.size();
|
call_chain_index = (call_chain_index + 1) % call_chain_.size();
|
||||||
|
|
|
@ -84,7 +84,7 @@ int GetPriorityForType(RtpPacketMediaType type) {
|
||||||
// BWE high.
|
// BWE high.
|
||||||
return kFirstPriority + 4;
|
return kFirstPriority + 4;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -37,7 +37,7 @@ std::unique_ptr<VideoRtpDepacketizer> CreateVideoRtpDepacketizer(
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecMultiplex:
|
||||||
return std::make_unique<VideoRtpDepacketizerGeneric>();
|
return std::make_unique<VideoRtpDepacketizerGeneric>();
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -128,7 +128,7 @@ bool IsNonVolatile(RTPExtensionType type) {
|
||||||
RTC_NOTREACHED();
|
RTC_NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasBweExtension(const RtpHeaderExtensionMap& extensions_map) {
|
bool HasBweExtension(const RtpHeaderExtensionMap& extensions_map) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ const char* FrameTypeToString(AudioFrameType frame_type) {
|
||||||
case AudioFrameType::kAudioFrameCN:
|
case AudioFrameType::kAudioFrameCN:
|
||||||
return "audio_cn";
|
return "audio_cn";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ TemporalLayersChecker::CreateTemporalLayersChecker(Vp8TemporalLayersType type,
|
||||||
// Conference mode temporal layering for screen content in base stream.
|
// Conference mode temporal layering for screen content in base stream.
|
||||||
return std::make_unique<TemporalLayersChecker>(num_temporal_layers);
|
return std::make_unique<TemporalLayersChecker>(num_temporal_layers);
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
TemporalLayersChecker::TemporalLayersChecker(int num_temporal_layers)
|
TemporalLayersChecker::TemporalLayersChecker(int num_temporal_layers)
|
||||||
|
|
|
@ -31,7 +31,7 @@ DtlsTransportState TranslateState(cricket::DtlsTransportState internal_state) {
|
||||||
case cricket::DTLS_TRANSPORT_FAILED:
|
case cricket::DTLS_TRANSPORT_FAILED:
|
||||||
return DtlsTransportState::kFailed;
|
return DtlsTransportState::kFailed;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -1818,7 +1818,7 @@ const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForOffer(
|
||||||
case RtpTransceiverDirection::kRecvOnly:
|
case RtpTransceiverDirection::kRecvOnly:
|
||||||
return audio_recv_codecs_;
|
return audio_recv_codecs_;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer(
|
const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer(
|
||||||
|
@ -1837,7 +1837,7 @@ const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer(
|
||||||
case RtpTransceiverDirection::kRecvOnly:
|
case RtpTransceiverDirection::kRecvOnly:
|
||||||
return audio_recv_codecs_;
|
return audio_recv_codecs_;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForOffer(
|
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForOffer(
|
||||||
|
@ -1853,7 +1853,7 @@ const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForOffer(
|
||||||
case RtpTransceiverDirection::kRecvOnly:
|
case RtpTransceiverDirection::kRecvOnly:
|
||||||
return video_recv_codecs_;
|
return video_recv_codecs_;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForAnswer(
|
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForAnswer(
|
||||||
|
@ -1872,7 +1872,7 @@ const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForAnswer(
|
||||||
case RtpTransceiverDirection::kRecvOnly:
|
case RtpTransceiverDirection::kRecvOnly:
|
||||||
return video_recv_codecs_;
|
return video_recv_codecs_;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MergeCodecsFromDescription(
|
void MergeCodecsFromDescription(
|
||||||
|
|
|
@ -2408,7 +2408,7 @@ void PeerConnection::ReportBestConnectionState(
|
||||||
GetIceCandidatePairCounter(local, remote),
|
GetIceCandidatePairCounter(local, remote),
|
||||||
kIceCandidatePairMax);
|
kIceCandidatePairMax);
|
||||||
} else {
|
} else {
|
||||||
RTC_CHECK(0);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment the counter for IP type.
|
// Increment the counter for IP type.
|
||||||
|
|
|
@ -141,7 +141,7 @@ RtpCapabilities PeerConnectionFactory::GetRtpSenderCapabilities(
|
||||||
case cricket::MEDIA_TYPE_UNSUPPORTED:
|
case cricket::MEDIA_TYPE_UNSUPPORTED:
|
||||||
return RtpCapabilities();
|
return RtpCapabilities();
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
RtpCapabilities PeerConnectionFactory::GetRtpReceiverCapabilities(
|
RtpCapabilities PeerConnectionFactory::GetRtpReceiverCapabilities(
|
||||||
|
@ -167,7 +167,7 @@ RtpCapabilities PeerConnectionFactory::GetRtpReceiverCapabilities(
|
||||||
case cricket::MEDIA_TYPE_UNSUPPORTED:
|
case cricket::MEDIA_TYPE_UNSUPPORTED:
|
||||||
return RtpCapabilities();
|
return RtpCapabilities();
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::scoped_refptr<AudioSourceInterface>
|
rtc::scoped_refptr<AudioSourceInterface>
|
||||||
|
|
|
@ -216,7 +216,7 @@ const char* QualityLimitationReasonToRTCQualityLimitationReason(
|
||||||
case QualityLimitationReason::kOther:
|
case QualityLimitationReason::kOther:
|
||||||
return RTCQualityLimitationReason::kOther;
|
return RTCQualityLimitationReason::kOther;
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
double DoubleAudioLevelFromIntAudioLevel(int audio_level) {
|
double DoubleAudioLevelFromIntAudioLevel(int audio_level) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ RTCErrorOr<cricket::FeedbackParam> ToCricketFeedbackParam(
|
||||||
}
|
}
|
||||||
return cricket::FeedbackParam(cricket::kRtcpFbParamTransportCc);
|
return cricket::FeedbackParam(cricket::kRtcpFbParamTransportCc);
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename C>
|
template <typename C>
|
||||||
|
|
|
@ -36,6 +36,21 @@
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
RTC_NORETURN void WriteFatalLogAndAbort(const std::string& output) {
|
||||||
|
const char* output_c = output.c_str();
|
||||||
|
#if defined(WEBRTC_ANDROID)
|
||||||
|
__android_log_print(ANDROID_LOG_ERROR, RTC_LOG_TAG_ANDROID, "%s\n", output_c);
|
||||||
|
#endif
|
||||||
|
fflush(stdout);
|
||||||
|
fprintf(stderr, "%s", output_c);
|
||||||
|
fflush(stderr);
|
||||||
|
#if defined(WEBRTC_WIN)
|
||||||
|
DebugBreak();
|
||||||
|
#endif
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
__attribute__((__format__(__printf__, 2, 3)))
|
__attribute__((__format__(__printf__, 2, 3)))
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,19 +164,7 @@ RTC_NORETURN void FatalLog(const char* file,
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
const char* output = s.c_str();
|
WriteFatalLogAndAbort(s);
|
||||||
|
|
||||||
#if defined(WEBRTC_ANDROID)
|
|
||||||
__android_log_print(ANDROID_LOG_ERROR, RTC_LOG_TAG_ANDROID, "%s\n", output);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
fprintf(stderr, "%s", output);
|
|
||||||
fflush(stderr);
|
|
||||||
#if defined(WEBRTC_WIN)
|
|
||||||
DebugBreak();
|
|
||||||
#endif
|
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
#else // RTC_CHECK_MSG_ENABLED
|
#else // RTC_CHECK_MSG_ENABLED
|
||||||
RTC_NORETURN void FatalLog(const char* file, int line) {
|
RTC_NORETURN void FatalLog(const char* file, int line) {
|
||||||
|
@ -174,22 +177,40 @@ RTC_NORETURN void FatalLog(const char* file, int line) {
|
||||||
"# Check failed.\n"
|
"# Check failed.\n"
|
||||||
"# ",
|
"# ",
|
||||||
file, line, LAST_SYSTEM_ERROR);
|
file, line, LAST_SYSTEM_ERROR);
|
||||||
const char* output = s.c_str();
|
WriteFatalLogAndAbort(s);
|
||||||
|
|
||||||
#if defined(WEBRTC_ANDROID)
|
|
||||||
__android_log_print(ANDROID_LOG_ERROR, RTC_LOG_TAG_ANDROID, "%s\n", output);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
fprintf(stderr, "%s", output);
|
|
||||||
fflush(stderr);
|
|
||||||
#if defined(WEBRTC_WIN)
|
|
||||||
DebugBreak();
|
|
||||||
#endif
|
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
#endif // RTC_CHECK_MSG_ENABLED
|
#endif // RTC_CHECK_MSG_ENABLED
|
||||||
|
|
||||||
|
#if RTC_DCHECK_IS_ON
|
||||||
|
|
||||||
|
RTC_NORETURN void UnreachableCodeReached(const char* file, int line) {
|
||||||
|
std::string s;
|
||||||
|
AppendFormat(&s,
|
||||||
|
"\n\n"
|
||||||
|
"#\n"
|
||||||
|
"# Unreachable code reached: %s, line %d\n"
|
||||||
|
"# last system error: %u\n"
|
||||||
|
"# ",
|
||||||
|
file, line, LAST_SYSTEM_ERROR);
|
||||||
|
WriteFatalLogAndAbort(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // !RTC_DCHECK_IS_ON
|
||||||
|
|
||||||
|
RTC_NORETURN void UnreachableCodeReached() {
|
||||||
|
std::string s;
|
||||||
|
AppendFormat(&s,
|
||||||
|
"\n\n"
|
||||||
|
"#\n"
|
||||||
|
"# Unreachable code reached (file and line unknown)\n"
|
||||||
|
"# last system error: %u\n"
|
||||||
|
"# ",
|
||||||
|
LAST_SYSTEM_ERROR);
|
||||||
|
WriteFatalLogAndAbort(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !RTC_DCHECK_IS_ON
|
||||||
|
|
||||||
} // namespace webrtc_checks_impl
|
} // namespace webrtc_checks_impl
|
||||||
} // namespace rtc
|
} // namespace rtc
|
||||||
|
|
||||||
|
|
|
@ -338,6 +338,22 @@ class FatalLogCall final {
|
||||||
const char* message_;
|
const char* message_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if RTC_DCHECK_IS_ON
|
||||||
|
|
||||||
|
// Be helpful, and include file and line in the RTC_CHECK_NOTREACHED error
|
||||||
|
// message.
|
||||||
|
#define RTC_UNREACHABLE_FILE_AND_LINE_CALL_ARGS __FILE__, __LINE__
|
||||||
|
RTC_NORETURN RTC_EXPORT void UnreachableCodeReached(const char* file, int line);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// Be mindful of binary size, and don't include file and line in the
|
||||||
|
// RTC_CHECK_NOTREACHED error message.
|
||||||
|
#define RTC_UNREACHABLE_FILE_AND_LINE_CALL_ARGS
|
||||||
|
RTC_NORETURN RTC_EXPORT void UnreachableCodeReached();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace webrtc_checks_impl
|
} // namespace webrtc_checks_impl
|
||||||
|
|
||||||
// The actual stream used isn't important. We reference |ignored| in the code
|
// The actual stream used isn't important. We reference |ignored| in the code
|
||||||
|
@ -430,6 +446,14 @@ class FatalLogCall final {
|
||||||
#define RTC_UNREACHABLE_CODE_HIT false
|
#define RTC_UNREACHABLE_CODE_HIT false
|
||||||
#define RTC_NOTREACHED() RTC_DCHECK(RTC_UNREACHABLE_CODE_HIT)
|
#define RTC_NOTREACHED() RTC_DCHECK(RTC_UNREACHABLE_CODE_HIT)
|
||||||
|
|
||||||
|
// Kills the process with an error message. Never returns. Use when you wish to
|
||||||
|
// assert that a point in the code is never reached.
|
||||||
|
#define RTC_CHECK_NOTREACHED() \
|
||||||
|
do { \
|
||||||
|
::rtc::webrtc_checks_impl::UnreachableCodeReached( \
|
||||||
|
RTC_UNREACHABLE_FILE_AND_LINE_CALL_ARGS); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
// TODO(bugs.webrtc.org/8454): Add an RTC_ prefix or rename differently.
|
// TODO(bugs.webrtc.org/8454): Add an RTC_ prefix or rename differently.
|
||||||
#define FATAL() \
|
#define FATAL() \
|
||||||
::rtc::webrtc_checks_impl::FatalLogCall<false>(__FILE__, __LINE__, \
|
::rtc::webrtc_checks_impl::FatalLogCall<false>(__FILE__, __LINE__, \
|
||||||
|
|
|
@ -21,7 +21,7 @@ const char* NetworkPreferenceToString(NetworkPreference preference) {
|
||||||
case NetworkPreference::NOT_PREFERRED:
|
case NetworkPreference::NOT_PREFERRED:
|
||||||
return "NOT_PREFERRED";
|
return "NOT_PREFERRED";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMonitorInterface::NetworkMonitorInterface() {}
|
NetworkMonitorInterface::NetworkMonitorInterface() {}
|
||||||
|
|
|
@ -63,12 +63,10 @@ inline constexpr Dst saturated_cast(Src value) {
|
||||||
|
|
||||||
// Should fail only on attempting to assign NaN to a saturated integer.
|
// Should fail only on attempting to assign NaN to a saturated integer.
|
||||||
case internal::TYPE_INVALID:
|
case internal::TYPE_INVALID:
|
||||||
FATAL();
|
RTC_CHECK_NOTREACHED();
|
||||||
return std::numeric_limits<Dst>::max();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FATAL();
|
RTC_CHECK_NOTREACHED();
|
||||||
return static_cast<Dst>(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace rtc
|
} // namespace rtc
|
||||||
|
|
|
@ -244,13 +244,8 @@ std::unique_ptr<SSLCertificate> OpenSSLCertificate::Clone() const {
|
||||||
|
|
||||||
std::string OpenSSLCertificate::ToPEMString() const {
|
std::string OpenSSLCertificate::ToPEMString() const {
|
||||||
BIO* bio = BIO_new(BIO_s_mem());
|
BIO* bio = BIO_new(BIO_s_mem());
|
||||||
if (!bio) {
|
RTC_CHECK(bio);
|
||||||
FATAL() << "Unreachable code.";
|
RTC_CHECK(PEM_write_bio_X509(bio, x509_));
|
||||||
}
|
|
||||||
if (!PEM_write_bio_X509(bio, x509_)) {
|
|
||||||
BIO_free(bio);
|
|
||||||
FATAL() << "Unreachable code.";
|
|
||||||
}
|
|
||||||
BIO_write(bio, "\0", 1);
|
BIO_write(bio, "\0", 1);
|
||||||
char* buffer;
|
char* buffer;
|
||||||
BIO_get_mem_data(bio, &buffer);
|
BIO_get_mem_data(bio, &buffer);
|
||||||
|
@ -264,13 +259,8 @@ void OpenSSLCertificate::ToDER(Buffer* der_buffer) const {
|
||||||
der_buffer->SetSize(0);
|
der_buffer->SetSize(0);
|
||||||
// Calculates the DER representation of the certificate, from scratch.
|
// Calculates the DER representation of the certificate, from scratch.
|
||||||
BIO* bio = BIO_new(BIO_s_mem());
|
BIO* bio = BIO_new(BIO_s_mem());
|
||||||
if (!bio) {
|
RTC_CHECK(bio);
|
||||||
FATAL() << "Unreachable code.";
|
RTC_CHECK(i2d_X509_bio(bio, x509_));
|
||||||
}
|
|
||||||
if (!i2d_X509_bio(bio, x509_)) {
|
|
||||||
BIO_free(bio);
|
|
||||||
FATAL() << "Unreachable code.";
|
|
||||||
}
|
|
||||||
char* data = nullptr;
|
char* data = nullptr;
|
||||||
size_t length = BIO_get_mem_data(bio, &data);
|
size_t length = BIO_get_mem_data(bio, &data);
|
||||||
der_buffer->SetData(data, length);
|
der_buffer->SetData(data, length);
|
||||||
|
|
|
@ -110,7 +110,7 @@ void DataRace() {
|
||||||
thread2.Join();
|
thread2.Join();
|
||||||
// TSan seems to mess with gtest's death detection.
|
// TSan seems to mess with gtest's death detection.
|
||||||
// Fail intentionally, and rely on detecting the error message.
|
// Fail intentionally, and rely on detecting the error message.
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SanitizersDeathTest, ThreadSanitizer) {
|
TEST(SanitizersDeathTest, ThreadSanitizer) {
|
||||||
|
|
|
@ -151,15 +151,13 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
||||||
int32_t PlayoutDeviceName(uint16_t index,
|
int32_t PlayoutDeviceName(uint16_t index,
|
||||||
char name[kAdmMaxDeviceNameSize],
|
char name[kAdmMaxDeviceNameSize],
|
||||||
char guid[kAdmMaxGuidSize]) override {
|
char guid[kAdmMaxGuidSize]) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t RecordingDeviceName(uint16_t index,
|
int32_t RecordingDeviceName(uint16_t index,
|
||||||
char name[kAdmMaxDeviceNameSize],
|
char name[kAdmMaxDeviceNameSize],
|
||||||
char guid[kAdmMaxGuidSize]) override {
|
char guid[kAdmMaxGuidSize]) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetPlayoutDevice(uint16_t index) override {
|
int32_t SetPlayoutDevice(uint16_t index) override {
|
||||||
|
@ -171,8 +169,7 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
||||||
|
|
||||||
int32_t SetPlayoutDevice(
|
int32_t SetPlayoutDevice(
|
||||||
AudioDeviceModule::WindowsDeviceType device) override {
|
AudioDeviceModule::WindowsDeviceType device) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetRecordingDevice(uint16_t index) override {
|
int32_t SetRecordingDevice(uint16_t index) override {
|
||||||
|
@ -184,8 +181,7 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
||||||
|
|
||||||
int32_t SetRecordingDevice(
|
int32_t SetRecordingDevice(
|
||||||
AudioDeviceModule::WindowsDeviceType device) override {
|
AudioDeviceModule::WindowsDeviceType device) override {
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PlayoutIsAvailable(bool* available) override {
|
int32_t PlayoutIsAvailable(bool* available) override {
|
||||||
|
@ -396,62 +392,52 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
||||||
|
|
||||||
int32_t SetMicrophoneVolume(uint32_t volume) override {
|
int32_t SetMicrophoneVolume(uint32_t volume) override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__ << "(" << volume << ")";
|
RTC_LOG(INFO) << __FUNCTION__ << "(" << volume << ")";
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MicrophoneVolume(uint32_t* volume) const override {
|
int32_t MicrophoneVolume(uint32_t* volume) const override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const override {
|
int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MinMicrophoneVolume(uint32_t* minVolume) const override {
|
int32_t MinMicrophoneVolume(uint32_t* minVolume) const override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SpeakerMuteIsAvailable(bool* available) override {
|
int32_t SpeakerMuteIsAvailable(bool* available) override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetSpeakerMute(bool enable) override {
|
int32_t SetSpeakerMute(bool enable) override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SpeakerMute(bool* enabled) const override {
|
int32_t SpeakerMute(bool* enabled) const override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
FATAL() << "Should never be called";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MicrophoneMuteIsAvailable(bool* available) override {
|
int32_t MicrophoneMuteIsAvailable(bool* available) override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SetMicrophoneMute(bool enable) override {
|
int32_t SetMicrophoneMute(bool enable) override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MicrophoneMute(bool* enabled) const override {
|
int32_t MicrophoneMute(bool* enabled) const override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
FATAL() << "Not implemented";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t StereoPlayoutIsAvailable(bool* available) const override {
|
int32_t StereoPlayoutIsAvailable(bool* available) const override {
|
||||||
|
@ -569,8 +555,7 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
||||||
|
|
||||||
int32_t EnableBuiltInAGC(bool enable) override {
|
int32_t EnableBuiltInAGC(bool enable) override {
|
||||||
RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
||||||
FATAL() << "HW AGC is not available";
|
RTC_CHECK_NOTREACHED();
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(henrika): add implementation for OpenSL ES based audio as well.
|
// TODO(henrika): add implementation for OpenSL ES based audio as well.
|
||||||
|
|
|
@ -55,7 +55,7 @@ std::string ToString(VideoAdaptationReason reason) {
|
||||||
case VideoAdaptationReason::kCpu:
|
case VideoAdaptationReason::kCpu:
|
||||||
return "cpu";
|
return "cpu";
|
||||||
}
|
}
|
||||||
RTC_CHECK(false);
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue