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:
@ -12,6 +12,7 @@
|
|||||||
#include "webrtc/modules/audio_device/audio_device_config.h"
|
#include "webrtc/modules/audio_device/audio_device_config.h"
|
||||||
#include "webrtc/modules/audio_device/audio_device_utility.h"
|
#include "webrtc/modules/audio_device/audio_device_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.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 "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -22,6 +23,9 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
static const int kHighDelayThresholdMs = 300;
|
||||||
|
static const int kLogHighDelayIntervalFrames = 500; // 5 seconds.
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// ctor
|
// ctor
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -49,7 +53,9 @@ AudioDeviceBuffer::AudioDeviceBuffer() :
|
|||||||
_typingStatus(false),
|
_typingStatus(false),
|
||||||
_playDelayMS(0),
|
_playDelayMS(0),
|
||||||
_recDelayMS(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
|
// valid ID will be set later by SetId, use -1 for now
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s created", __FUNCTION__);
|
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s created", __FUNCTION__);
|
||||||
memset(_recBuffer, 0, kMaxBufferSizeBytes);
|
memset(_recBuffer, 0, kMaxBufferSizeBytes);
|
||||||
@ -286,18 +292,21 @@ uint32_t AudioDeviceBuffer::NewMicLevel() const
|
|||||||
// SetVQEData
|
// SetVQEData
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int32_t AudioDeviceBuffer::SetVQEData(uint32_t playDelayMS, uint32_t recDelayMS, int32_t clockDrift)
|
void AudioDeviceBuffer::SetVQEData(uint32_t playDelayMs, uint32_t recDelayMs,
|
||||||
{
|
int32_t clockDrift) {
|
||||||
if ((playDelayMS + recDelayMS) > 300)
|
if (high_delay_counter_ < kLogHighDelayIntervalFrames) {
|
||||||
{
|
++high_delay_counter_;
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceUtility, _id, "too long delay (play:%i rec:%i)", playDelayMS, recDelayMS, clockDrift);
|
} 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;
|
_playDelayMS = playDelayMs;
|
||||||
_recDelayMS = recDelayMS;
|
_recDelayMS = recDelayMs;
|
||||||
_clockDrift = clockDrift;
|
_clockDrift = clockDrift;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -54,9 +54,9 @@ public:
|
|||||||
|
|
||||||
int32_t SetRecordedBuffer(const void* audioBuffer, uint32_t nSamples);
|
int32_t SetRecordedBuffer(const void* audioBuffer, uint32_t nSamples);
|
||||||
int32_t SetCurrentMicLevel(uint32_t level);
|
int32_t SetCurrentMicLevel(uint32_t level);
|
||||||
int32_t SetVQEData(uint32_t playDelayMS,
|
void SetVQEData(uint32_t playDelayMS,
|
||||||
uint32_t recDelayMS,
|
uint32_t recDelayMS,
|
||||||
int32_t clockDrift);
|
int32_t clockDrift);
|
||||||
int32_t DeliverRecordedData();
|
int32_t DeliverRecordedData();
|
||||||
uint32_t NewMicLevel() const;
|
uint32_t NewMicLevel() const;
|
||||||
|
|
||||||
@ -118,6 +118,7 @@ private:
|
|||||||
uint32_t _recDelayMS;
|
uint32_t _recDelayMS;
|
||||||
|
|
||||||
int32_t _clockDrift;
|
int32_t _clockDrift;
|
||||||
|
int high_delay_counter_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
Reference in New Issue
Block a user