Disable all LS_VERBOSE logging in NetEq4
This reduces exectution time of NetEqDecodingTest.TestBitExactness
with almost 30% and reduces the allocation count (from valgrind)
with almost 50% for the same test.
An issue has been created to re-enable logs when logging performance
is improved; see https://code.google.com/p/webrtc/issues/detail?id=2317.
BUG=1363
TEST=out/Release/modules_unittests --gtest_filter=NetEqDecodingTest.TestBitExactness
R=turaj@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2136004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4652 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq4/decision_logic.cc b/webrtc/modules/audio_coding/neteq4/decision_logic.cc
index ce2c45e..a4b0d45 100644
--- a/webrtc/modules/audio_coding/neteq4/decision_logic.cc
+++ b/webrtc/modules/audio_coding/neteq4/decision_logic.cc
@@ -127,7 +127,7 @@
const int cur_size_samples =
samples_left + packet_buffer_.NumSamplesInBuffer(decoder_database_,
decoder_frame_length);
- LOG(LS_VERBOSE) << "Buffers: " << packet_buffer_.NumPacketsInBuffer() <<
+ NETEQ_LOG_VERBOSE << "Buffers: " << packet_buffer_.NumPacketsInBuffer() <<
" packets * " << decoder_frame_length << " samples/packet + " <<
samples_left << " samples in sync buffer = " << cur_size_samples;
diff --git a/webrtc/modules/audio_coding/neteq4/defines.h b/webrtc/modules/audio_coding/neteq4/defines.h
index b6f9eb2..67b7cde 100644
--- a/webrtc/modules/audio_coding/neteq4/defines.h
+++ b/webrtc/modules/audio_coding/neteq4/defines.h
@@ -47,5 +47,11 @@
kModeUndefined = -1
};
+#ifdef NETEQ4_VERBOSE_LOGGING
+#define NETEQ_LOG_VERBOSE LOG(LS_VERBOSE)
+#else
+#define NETEQ_LOG_VERBOSE while(false)LOG(LS_VERBOSE)
+#endif
+
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ4_DEFINES_H_
diff --git a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
index 1124f8b..64addf8 100644
--- a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
@@ -126,7 +126,7 @@
int length_bytes,
uint32_t receive_timestamp) {
CriticalSectionScoped lock(crit_sect_);
- LOG(LS_VERBOSE) << "InsertPacket: ts=" << rtp_header.header.timestamp <<
+ NETEQ_LOG_VERBOSE << "InsertPacket: ts=" << rtp_header.header.timestamp <<
", sn=" << rtp_header.header.sequenceNumber <<
", pt=" << static_cast<int>(rtp_header.header.payloadType) <<
", ssrc=" << rtp_header.header.ssrc <<
@@ -145,10 +145,10 @@
int* samples_per_channel, int* num_channels,
NetEqOutputType* type) {
CriticalSectionScoped lock(crit_sect_);
- LOG(LS_VERBOSE) << "GetAudio";
+ NETEQ_LOG_VERBOSE << "GetAudio";
int error = GetAudioInternal(max_length, output_audio, samples_per_channel,
num_channels);
- LOG(LS_VERBOSE) << "Produced " << *samples_per_channel <<
+ NETEQ_LOG_VERBOSE << "Produced " << *samples_per_channel <<
" samples/channel for " << *num_channels << " channel(s)";
if (error != 0) {
LOG_FERR1(LS_WARNING, GetAudioInternal, error);
@@ -608,7 +608,7 @@
last_mode_ = kModeError;
return return_value;
}
- LOG(LS_VERBOSE) << "GetDecision returned operation=" << operation <<
+ NETEQ_LOG_VERBOSE << "GetDecision returned operation=" << operation <<
" and " << packet_list.size() << " packet(s)";
AudioDecoder::SpeechType speech_type;
@@ -718,7 +718,7 @@
int samples_from_sync = sync_buffer_->GetNextAudioInterleaved(
num_output_samples_per_channel, output);
*num_channels = sync_buffer_->Channels();
- LOG(LS_VERBOSE) << "Sync buffer (" << *num_channels << " channel(s)):" <<
+ NETEQ_LOG_VERBOSE << "Sync buffer (" << *num_channels << " channel(s)):" <<
" insert " << algorithm_buffer_->Size() << " samples, extract " <<
samples_from_sync << " samples";
if (samples_from_sync != output_size_samples_) {
@@ -1145,7 +1145,7 @@
int16_t decode_length;
if (!packet->primary) {
// This is a redundant payload; call the special decoder method.
- LOG(LS_VERBOSE) << "Decoding packet (redundant):" <<
+ NETEQ_LOG_VERBOSE << "Decoding packet (redundant):" <<
" ts=" << packet->header.timestamp <<
", sn=" << packet->header.sequenceNumber <<
", pt=" << static_cast<int>(packet->header.payloadType) <<
@@ -1155,7 +1155,7 @@
packet->payload, packet->payload_length,
&decoded_buffer_[*decoded_length], speech_type);
} else {
- LOG(LS_VERBOSE) << "Decoding packet: ts=" << packet->header.timestamp <<
+ NETEQ_LOG_VERBOSE << "Decoding packet: ts=" << packet->header.timestamp <<
", sn=" << packet->header.sequenceNumber <<
", pt=" << static_cast<int>(packet->header.payloadType) <<
", ssrc=" << packet->header.ssrc <<
@@ -1172,7 +1172,7 @@
*decoded_length += decode_length;
// Update |decoder_frame_length_| with number of samples per channel.
decoder_frame_length_ = decode_length / decoder->channels();
- LOG(LS_VERBOSE) << "Decoded " << decode_length << " samples (" <<
+ NETEQ_LOG_VERBOSE << "Decoded " << decode_length << " samples (" <<
decoder->channels() << " channel(s) -> " << decoder_frame_length_ <<
" samples per channel)";
} else if (decode_length < 0) {
diff --git a/webrtc/modules/audio_coding/neteq4/timestamp_scaler.cc b/webrtc/modules/audio_coding/neteq4/timestamp_scaler.cc
index d58d5dd..423edee 100644
--- a/webrtc/modules/audio_coding/neteq4/timestamp_scaler.cc
+++ b/webrtc/modules/audio_coding/neteq4/timestamp_scaler.cc
@@ -11,6 +11,7 @@
#include "webrtc/modules/audio_coding/neteq4/timestamp_scaler.h"
#include "webrtc/modules/audio_coding/neteq4/decoder_database.h"
+#include "webrtc/modules/audio_coding/neteq4/defines.h"
#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
@@ -84,7 +85,7 @@
assert(denominator_ > 0); // Should not be possible.
external_ref_ = external_timestamp;
internal_ref_ += (external_diff * numerator_) / denominator_;
- LOG(LS_VERBOSE) << "Converting timestamp: " << external_timestamp <<
+ NETEQ_LOG_VERBOSE << "Converting timestamp: " << external_timestamp <<
" -> " << internal_ref_;
return internal_ref_;
} else {