Reduce frequency of high audio delay warning logs.

This will log the warning every 5 seconds instead of every 10 ms.

BUG=b/10674993
TESTED=Ran voe_cmd_test with hard-coded high delay. Observed a log
every 5 seconds.

R=noahric@chromium.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2184009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4729 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2013-09-11 22:35:00 +00:00
parent 256b83146c
commit 8f94013651
2 changed files with 24 additions and 14 deletions

View File

@ -12,6 +12,7 @@
#include "webrtc/modules/audio_device/audio_device_config.h"
#include "webrtc/modules/audio_device/audio_device_utility.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include <assert.h>
@ -22,6 +23,9 @@
namespace webrtc {
static const int kHighDelayThresholdMs = 300;
static const int kLogHighDelayIntervalFrames = 500; // 5 seconds.
// ----------------------------------------------------------------------------
// ctor
// ----------------------------------------------------------------------------
@ -49,7 +53,9 @@ AudioDeviceBuffer::AudioDeviceBuffer() :
_typingStatus(false),
_playDelayMS(0),
_recDelayMS(0),
_clockDrift(0) {
_clockDrift(0),
// Set to the interval in order to log on the first occurrence.
high_delay_counter_(kLogHighDelayIntervalFrames) {
// valid ID will be set later by SetId, use -1 for now
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s created", __FUNCTION__);
memset(_recBuffer, 0, kMaxBufferSizeBytes);
@ -286,18 +292,21 @@ uint32_t AudioDeviceBuffer::NewMicLevel() const
// SetVQEData
// ----------------------------------------------------------------------------
int32_t AudioDeviceBuffer::SetVQEData(uint32_t playDelayMS, uint32_t recDelayMS, int32_t clockDrift)
{
if ((playDelayMS + recDelayMS) > 300)
{
WEBRTC_TRACE(kTraceWarning, kTraceUtility, _id, "too long delay (play:%i rec:%i)", playDelayMS, recDelayMS, clockDrift);
void AudioDeviceBuffer::SetVQEData(uint32_t playDelayMs, uint32_t recDelayMs,
int32_t clockDrift) {
if (high_delay_counter_ < kLogHighDelayIntervalFrames) {
++high_delay_counter_;
} else {
if (playDelayMs + recDelayMs > kHighDelayThresholdMs) {
high_delay_counter_ = 0;
LOG(LS_WARNING) << "High audio device delay reported (render="
<< playDelayMs << " ms, capture=" << recDelayMs << " ms)";
}
}
_playDelayMS = playDelayMS;
_recDelayMS = recDelayMS;
_clockDrift = clockDrift;
return 0;
_playDelayMS = playDelayMs;
_recDelayMS = recDelayMs;
_clockDrift = clockDrift;
}
// ----------------------------------------------------------------------------

View File

@ -54,9 +54,9 @@ public:
int32_t SetRecordedBuffer(const void* audioBuffer, uint32_t nSamples);
int32_t SetCurrentMicLevel(uint32_t level);
int32_t SetVQEData(uint32_t playDelayMS,
uint32_t recDelayMS,
int32_t clockDrift);
void SetVQEData(uint32_t playDelayMS,
uint32_t recDelayMS,
int32_t clockDrift);
int32_t DeliverRecordedData();
uint32_t NewMicLevel() const;
@ -118,6 +118,7 @@ private:
uint32_t _recDelayMS;
int32_t _clockDrift;
int high_delay_counter_;
};
} // namespace webrtc