Remove logging in audio/* from release builds.

This makes the binary around 8000 bytes smaller.

Bug: webrtc:8529
Change-Id: Ic59b16e300dd4dd5471e1079103982300cb5d660
Reviewed-on: https://webrtc-review.googlesource.com/43300
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21762}
This commit is contained in:
Jonas Olsson 2018-01-25 10:14:29 +01:00 committed by Commit Bot
parent e994058eb1
commit 24ea822dcb
5 changed files with 52 additions and 49 deletions

View File

@ -102,7 +102,7 @@ AudioReceiveStream::AudioReceiveStream(
std::unique_ptr<voe::ChannelProxy> channel_proxy)
: audio_state_(audio_state),
channel_proxy_(std::move(channel_proxy)) {
RTC_LOG(LS_INFO) << "AudioReceiveStream: " << config.ToString();
RTC_LOG(LS_INFO) << "AudioReceiveStream: " << config.rtp.remote_ssrc;
RTC_DCHECK(receiver_controller);
RTC_DCHECK(packet_router);
RTC_DCHECK(config.decoder_factory);
@ -127,7 +127,7 @@ AudioReceiveStream::AudioReceiveStream(
AudioReceiveStream::~AudioReceiveStream() {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
RTC_LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString();
RTC_LOG(LS_INFO) << "~AudioReceiveStream: " << config_.rtp.remote_ssrc;
Stop();
channel_proxy_->DisassociateSendChannel();
channel_proxy_->RegisterTransport(nullptr);
@ -138,7 +138,6 @@ AudioReceiveStream::~AudioReceiveStream() {
void AudioReceiveStream::Reconfigure(
const webrtc::AudioReceiveStream::Config& config) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
RTC_LOG(LS_INFO) << "AudioReceiveStream::Reconfigure: " << config_.ToString();
ConfigureStream(this, config, false);
}
@ -348,6 +347,8 @@ internal::AudioState* AudioReceiveStream::audio_state() const {
void AudioReceiveStream::ConfigureStream(AudioReceiveStream* stream,
const Config& new_config,
bool first_time) {
RTC_LOG(LS_INFO) << "AudioReceiveStream::ConfigureStream: "
<< new_config.ToString();
RTC_DCHECK(stream);
const auto& channel_proxy = stream->channel_proxy_;
const auto& old_config = stream->config_;

View File

@ -129,7 +129,7 @@ AudioSendStream::AudioSendStream(
kRecoverablePacketLossRateMinNumAckedPairs),
rtp_rtcp_module_(nullptr),
suspended_rtp_state_(suspended_rtp_state) {
RTC_LOG(LS_INFO) << "AudioSendStream: " << config.ToString();
RTC_LOG(LS_INFO) << "AudioSendStream: " << config.rtp.ssrc;
RTC_DCHECK(worker_queue_);
RTC_DCHECK(audio_state_);
RTC_DCHECK(channel_proxy_);
@ -153,7 +153,7 @@ AudioSendStream::AudioSendStream(
AudioSendStream::~AudioSendStream() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
RTC_LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString();
RTC_LOG(LS_INFO) << "~AudioSendStream: " << config_.rtp.ssrc;
RTC_DCHECK(!sending_);
transport_->send_side_cc()->DeRegisterPacketFeedbackObserver(this);
channel_proxy_->RegisterTransport(nullptr);
@ -190,7 +190,8 @@ void AudioSendStream::ConfigureStream(
webrtc::internal::AudioSendStream* stream,
const webrtc::AudioSendStream::Config& new_config,
bool first_time) {
RTC_LOG(LS_INFO) << "AudioSendStream::Configuring: " << new_config.ToString();
RTC_LOG(LS_INFO) << "AudioSendStream::ConfigureStream: "
<< new_config.ToString();
const auto& channel_proxy = stream->channel_proxy_;
const auto& old_config = stream->config_;
@ -501,7 +502,7 @@ bool AudioSendStream::SetupSendCodec(AudioSendStream* stream,
spec.format);
if (!encoder) {
RTC_LOG(LS_ERROR) << "Unable to create encoder for " << spec.format;
RTC_DLOG(LS_ERROR) << "Unable to create encoder for " << spec.format;
return false;
}
// If a bitrate has been specified for the codec, use it over the
@ -514,8 +515,8 @@ bool AudioSendStream::SetupSendCodec(AudioSendStream* stream,
if (new_config.audio_network_adaptor_config) {
if (encoder->EnableAudioNetworkAdaptor(
*new_config.audio_network_adaptor_config, stream->event_log_)) {
RTC_LOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
<< new_config.rtp.ssrc;
RTC_DLOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
<< new_config.rtp.ssrc;
} else {
RTC_NOTREACHED();
}
@ -597,8 +598,8 @@ void AudioSendStream::ReconfigureANA(AudioSendStream* stream,
CallEncoder(stream->channel_proxy_, [&](AudioEncoder* encoder) {
if (encoder->EnableAudioNetworkAdaptor(
*new_config.audio_network_adaptor_config, stream->event_log_)) {
RTC_LOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
<< new_config.rtp.ssrc;
RTC_DLOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
<< new_config.rtp.ssrc;
} else {
RTC_NOTREACHED();
}
@ -607,8 +608,8 @@ void AudioSendStream::ReconfigureANA(AudioSendStream* stream,
CallEncoder(stream->channel_proxy_, [&](AudioEncoder* encoder) {
encoder->DisableAudioNetworkAdaptor();
});
RTC_LOG(LS_INFO) << "Audio network adaptor disabled on SSRC "
<< new_config.rtp.ssrc;
RTC_DLOG(LS_INFO) << "Audio network adaptor disabled on SSRC "
<< new_config.rtp.ssrc;
}
}
@ -719,8 +720,8 @@ void AudioSendStream::RegisterCngPayloadType(int payload_type,
if (rtp_rtcp_module_->RegisterSendPayload(codec) != 0) {
rtp_rtcp_module_->DeRegisterSendPayload(codec.pltype);
if (rtp_rtcp_module_->RegisterSendPayload(codec) != 0) {
RTC_LOG(LS_ERROR) << "RegisterCngPayloadType() failed to register CN to "
"RTP/RTCP module";
RTC_DLOG(LS_ERROR) << "RegisterCngPayloadType() failed to register CN to "
"RTP/RTCP module";
}
}
}

View File

@ -51,7 +51,7 @@ void AudioState::AddReceivingStream(webrtc::AudioReceiveStream* stream) {
receiving_streams_.insert(stream);
if (!config_.audio_mixer->AddSource(
static_cast<internal::AudioReceiveStream*>(stream))) {
RTC_LOG(LS_ERROR) << "Failed to add source to mixer.";
RTC_DLOG(LS_ERROR) << "Failed to add source to mixer.";
}
// Make sure playback is initialized; start playing if enabled.

View File

@ -345,7 +345,7 @@ int32_t Channel::SendData(FrameType frameType,
// received from the capture device as
// undefined for voice for now.
-1, payloadData, payloadSize, fragmentation, nullptr, nullptr)) {
RTC_LOG(LS_ERROR)
RTC_DLOG(LS_ERROR)
<< "Channel::SendData() failed to send data to RTP/RTCP module";
return -1;
}
@ -359,14 +359,14 @@ bool Channel::SendRtp(const uint8_t* data,
rtc::CritScope cs(&_callbackCritSect);
if (_transportPtr == NULL) {
RTC_LOG(LS_ERROR)
RTC_DLOG(LS_ERROR)
<< "Channel::SendPacket() failed to send RTP packet due to"
<< " invalid transport object";
return false;
}
if (!_transportPtr->SendRtp(data, len, options)) {
RTC_LOG(LS_ERROR) << "Channel::SendPacket() RTP transmission failed";
RTC_DLOG(LS_ERROR) << "Channel::SendPacket() RTP transmission failed";
return false;
}
return true;
@ -375,14 +375,15 @@ bool Channel::SendRtp(const uint8_t* data,
bool Channel::SendRtcp(const uint8_t* data, size_t len) {
rtc::CritScope cs(&_callbackCritSect);
if (_transportPtr == NULL) {
RTC_LOG(LS_ERROR) << "Channel::SendRtcp() failed to send RTCP packet due to"
<< " invalid transport object";
RTC_DLOG(LS_ERROR)
<< "Channel::SendRtcp() failed to send RTCP packet due to"
<< " invalid transport object";
return false;
}
int n = _transportPtr->SendRtcp(data, len);
if (n < 0) {
RTC_LOG(LS_ERROR) << "Channel::SendRtcp() transmission failed";
RTC_DLOG(LS_ERROR) << "Channel::SendRtcp() transmission failed";
return false;
}
return true;
@ -401,9 +402,9 @@ int32_t Channel::OnInitializeDecoder(int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) {
if (!audio_coding_->RegisterReceiveCodec(payload_type, audio_format)) {
RTC_LOG(LS_WARNING) << "Channel::OnInitializeDecoder() invalid codec (pt="
<< payload_type << ", " << audio_format
<< ") received -1";
RTC_DLOG(LS_WARNING) << "Channel::OnInitializeDecoder() invalid codec (pt="
<< payload_type << ", " << audio_format
<< ") received -1";
return -1;
}
@ -422,7 +423,7 @@ int32_t Channel::OnReceivedPayloadData(const uint8_t* payloadData,
// Push the incoming payload (parsed and ready for decoding) into the ACM
if (audio_coding_->IncomingPacket(payloadData, payloadSize, *rtpHeader) !=
0) {
RTC_LOG(LS_ERROR)
RTC_DLOG(LS_ERROR)
<< "Channel::OnReceivedPayloadData() unable to push data to the ACM";
return -1;
}
@ -452,7 +453,7 @@ AudioMixer::Source::AudioFrameInfo Channel::GetAudioFrameWithInfo(
bool muted;
if (audio_coding_->PlayoutData10Ms(audio_frame->sample_rate_hz_, audio_frame,
&muted) == -1) {
RTC_LOG(LS_ERROR) << "Channel::GetAudioFrame() PlayoutData10Ms() failed!";
RTC_DLOG(LS_ERROR) << "Channel::GetAudioFrame() PlayoutData10Ms() failed!";
// In all likelihood, the audio in this frame is garbage. We return an
// error so that the audio mixer module doesn't add it to the mix. As
// a result, it won't be played out and the actions skipped here are
@ -736,7 +737,7 @@ int32_t Channel::StartSend() {
}
_rtpRtcpModule->SetSendingMediaStatus(true);
if (_rtpRtcpModule->SetSendingStatus(true) != 0) {
RTC_LOG(LS_ERROR) << "StartSend() RTP/RTCP failed to start sending";
RTC_DLOG(LS_ERROR) << "StartSend() RTP/RTCP failed to start sending";
_rtpRtcpModule->SetSendingMediaStatus(false);
rtc::CritScope cs(&_callbackCritSect);
channel_state_.SetSending(false);
@ -785,7 +786,7 @@ void Channel::StopSend() {
// Reset sending SSRC and sequence number and triggers direct transmission
// of RTCP BYE
if (_rtpRtcpModule->SetSendingStatus(false) == -1) {
RTC_LOG(LS_ERROR) << "StartSend() RTP/RTCP failed to stop sending";
RTC_DLOG(LS_ERROR) << "StartSend() RTP/RTCP failed to stop sending";
}
_rtpRtcpModule->SetSendingMediaStatus(false);
}
@ -816,7 +817,7 @@ bool Channel::SetEncoder(int payload_type,
if (_rtpRtcpModule->RegisterSendPayload(rtp_codec) != 0) {
_rtpRtcpModule->DeRegisterSendPayload(payload_type);
if (_rtpRtcpModule->RegisterSendPayload(rtp_codec) != 0) {
RTC_LOG(LS_ERROR)
RTC_DLOG(LS_ERROR)
<< "SetEncoder() failed to register codec to RTP/RTCP module";
return false;
}
@ -1051,7 +1052,7 @@ int Channel::SendTelephoneEventOutband(int event, int duration_ms) {
}
if (_rtpRtcpModule->SendTelephoneEventOutband(
event, duration_ms, kTelephoneEventAttenuationdB) != 0) {
RTC_LOG(LS_ERROR) << "SendTelephoneEventOutband() failed to send event";
RTC_DLOG(LS_ERROR) << "SendTelephoneEventOutband() failed to send event";
return -1;
}
return 0;
@ -1068,7 +1069,7 @@ int Channel::SetSendTelephoneEventPayloadType(int payload_type,
if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) {
_rtpRtcpModule->DeRegisterSendPayload(codec.pltype);
if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) {
RTC_LOG(LS_ERROR)
RTC_DLOG(LS_ERROR)
<< "SetSendTelephoneEventPayloadType() failed to register "
"send payload type";
return -1;
@ -1079,7 +1080,7 @@ int Channel::SetSendTelephoneEventPayloadType(int payload_type,
int Channel::SetLocalSSRC(unsigned int ssrc) {
if (channel_state_.Get().sending) {
RTC_LOG(LS_ERROR) << "SetLocalSSRC() already sending";
RTC_DLOG(LS_ERROR) << "SetLocalSSRC() already sending";
return -1;
}
_rtpRtcpModule->SetSSRC(ssrc);
@ -1157,7 +1158,7 @@ void Channel::SetRTCPStatus(bool enable) {
int Channel::SetRTCP_CNAME(const char cName[256]) {
if (_rtpRtcpModule->SetCNAME(cName) != 0) {
RTC_LOG(LS_ERROR) << "SetRTCP_CNAME() failed to set RTCP CNAME";
RTC_DLOG(LS_ERROR) << "SetRTCP_CNAME() failed to set RTCP CNAME";
return -1;
}
return 0;
@ -1166,7 +1167,7 @@ int Channel::SetRTCP_CNAME(const char cName[256]) {
int Channel::GetRemoteRTCPReportBlocks(
std::vector<ReportBlock>* report_blocks) {
if (report_blocks == NULL) {
RTC_LOG(LS_ERROR) << "GetRemoteRTCPReportBlock()s invalid report_blocks.";
RTC_DLOG(LS_ERROR) << "GetRemoteRTCPReportBlock()s invalid report_blocks.";
return -1;
}
@ -1231,7 +1232,7 @@ int Channel::GetRTPStatistics(CallStatistics& stats) {
}
if (_rtpRtcpModule->DataCountersRTP(&bytesSent, &packetsSent) != 0) {
RTC_LOG(LS_WARNING)
RTC_DLOG(LS_WARNING)
<< "GetRTPStatistics() failed to retrieve RTP datacounters"
<< " => output will not be complete";
}
@ -1314,7 +1315,7 @@ void Channel::ProcessAndEncodeAudioOnTaskQueue(AudioFrame* audio_input) {
// is done and payload is ready for packetization and transmission.
// Otherwise, it will return without invoking the callback.
if (audio_coding_->Add10MsData(*audio_input) < 0) {
RTC_LOG(LS_ERROR) << "ACM::Add10MsData() failed.";
RTC_DLOG(LS_ERROR) << "ACM::Add10MsData() failed.";
return;
}
@ -1378,11 +1379,11 @@ uint32_t Channel::GetDelayEstimate() const {
int Channel::SetMinimumPlayoutDelay(int delayMs) {
if ((delayMs < kVoiceEngineMinMinPlayoutDelayMs) ||
(delayMs > kVoiceEngineMaxMinPlayoutDelayMs)) {
RTC_LOG(LS_ERROR) << "SetMinimumPlayoutDelay() invalid min delay";
RTC_DLOG(LS_ERROR) << "SetMinimumPlayoutDelay() invalid min delay";
return -1;
}
if (audio_coding_->SetMinimumPlayoutDelay(delayMs) != 0) {
RTC_LOG(LS_ERROR)
RTC_DLOG(LS_ERROR)
<< "SetMinimumPlayoutDelay() failed to set min playout delay";
return -1;
}
@ -1396,7 +1397,7 @@ int Channel::GetPlayoutTimestamp(unsigned int& timestamp) {
playout_timestamp_rtp = playout_timestamp_rtp_;
}
if (playout_timestamp_rtp == 0) {
RTC_LOG(LS_ERROR) << "GetPlayoutTimestamp() failed to retrieve timestamp";
RTC_DLOG(LS_ERROR) << "GetPlayoutTimestamp() failed to retrieve timestamp";
return -1;
}
timestamp = playout_timestamp_rtp;
@ -1421,8 +1422,8 @@ void Channel::UpdatePlayoutTimestamp(bool rtcp) {
uint16_t delay_ms = 0;
if (_audioDeviceModulePtr->PlayoutDelay(&delay_ms) == -1) {
RTC_LOG(LS_WARNING) << "Channel::UpdatePlayoutTimestamp() failed to read"
<< " playout delay from the ADM";
RTC_DLOG(LS_WARNING) << "Channel::UpdatePlayoutTimestamp() failed to read"
<< " playout delay from the ADM";
return;
}

View File

@ -279,7 +279,7 @@ class LogMessageVoidify {
rtc::LogMessage(__FILE__, __LINE__, rtc::sev).stream()
// The _V version is for when a variable is passed in. It doesn't do the
// namespace concatination.
// namespace concatenation.
#define RTC_LOG_V(sev) \
RTC_LOG_SEVERITY_PRECONDITION(sev) \
rtc::LogMessage(__FILE__, __LINE__, sev).stream()
@ -354,13 +354,13 @@ inline bool LogCheckLevel(LoggingSeverity sev) {
#define RTC_DLOG_F(sev) RTC_LOG_F(sev)
#else
#define RTC_DLOG_EAT_STREAM_PARAMS(sev) \
(true ? true : ((void)(rtc::sev), true)) \
? static_cast<void>(0) \
: rtc::LogMessageVoidify() & \
rtc::LogMessage(__FILE__, __LINE__, rtc::sev).stream()
#define RTC_DLOG(sev) RTC_DLOG_EAT_STREAM_PARAMS(sev)
(true ? true : ((void)(sev), true)) \
? static_cast<void>(0) \
: rtc::LogMessageVoidify() & \
rtc::LogMessage(__FILE__, __LINE__, sev).stream()
#define RTC_DLOG(sev) RTC_DLOG_EAT_STREAM_PARAMS(rtc::sev)
#define RTC_DLOG_V(sev) RTC_DLOG_EAT_STREAM_PARAMS(sev)
#define RTC_DLOG_F(sev) RTC_DLOG_EAT_STREAM_PARAMS(sev)
#define RTC_DLOG_F(sev) RTC_DLOG_EAT_STREAM_PARAMS(rtc::sev)
#endif
} // namespace rtc