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}
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 45ffe34..c5e2b16 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -102,7 +102,7 @@
     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() {
   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 @@
 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 @@
 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_;
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 80c2c6b..b39f9cd 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -129,7 +129,7 @@
                            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() {
   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 @@
     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 @@
                                                    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 @@
   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 @@
     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 @@
     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 @@
   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";
     }
   }
 }
diff --git a/audio/audio_state.cc b/audio/audio_state.cc
index 06a686331..3d38c89 100644
--- a/audio/audio_state.cc
+++ b/audio/audio_state.cc
@@ -51,7 +51,7 @@
   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.
diff --git a/audio/channel.cc b/audio/channel.cc
index 1799e7a..ac4b917 100644
--- a/audio/channel.cc
+++ b/audio/channel.cc
@@ -345,7 +345,7 @@
           // 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 @@
   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::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 @@
                                      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 @@
   // 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 @@
   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 @@
   }
   _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 @@
   // 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 @@
   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 @@
   }
   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 @@
   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::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 @@
 
 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::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 @@
   }
 
   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 @@
   // 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 @@
 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 @@
     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 @@
 
   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;
   }
 
diff --git a/rtc_base/logging.h b/rtc_base/logging.h
index e3879fc..91b71a6 100644
--- a/rtc_base/logging.h
+++ b/rtc_base/logging.h
@@ -279,7 +279,7 @@
     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 @@
 #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