
To more easily determine if for example the AEC is not working properly one could monitor how often the estimated delay is out of bounds. With out of bounds we mean either being negative or too large, where both cases will break the AEC. A new delay metric is added telling the user how often poor delay values were estimated. This is measured in percentage since last time the metrics were calculated. All APIs have been updated with a third parameter with EchoCancellation::GetDelayMetrics() giving the option to exclude the new metric not to break existing code. The new metric has been added to audio_processing_unittests with an additional protobuf member, and reference files accordingly updated. voe_auto_test has not been updated to display the new metric. BUG=4246 TESTED=audioproc on files R=aluebs@webrtc.org, andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/39739004 Cr-Commit-Position: refs/heads/master@{#8230} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8230 4adac7df-926f-26a2-2b94-8c16560cd09d
83 lines
3.1 KiB
C++
83 lines
3.1 KiB
C++
/*
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
|
|
#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
|
|
|
|
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
|
#include "webrtc/modules/audio_processing/processing_component.h"
|
|
|
|
namespace webrtc {
|
|
|
|
class AudioBuffer;
|
|
class CriticalSectionWrapper;
|
|
|
|
class EchoCancellationImpl : public EchoCancellation,
|
|
public ProcessingComponent {
|
|
public:
|
|
EchoCancellationImpl(const AudioProcessing* apm,
|
|
CriticalSectionWrapper* crit);
|
|
virtual ~EchoCancellationImpl();
|
|
|
|
int ProcessRenderAudio(const AudioBuffer* audio);
|
|
int ProcessCaptureAudio(AudioBuffer* audio);
|
|
|
|
// EchoCancellation implementation.
|
|
virtual bool is_enabled() const OVERRIDE;
|
|
virtual int stream_drift_samples() const OVERRIDE;
|
|
|
|
// ProcessingComponent implementation.
|
|
virtual int Initialize() OVERRIDE;
|
|
virtual void SetExtraOptions(const Config& config) OVERRIDE;
|
|
|
|
private:
|
|
// EchoCancellation implementation.
|
|
virtual int Enable(bool enable) OVERRIDE;
|
|
virtual int enable_drift_compensation(bool enable) OVERRIDE;
|
|
virtual bool is_drift_compensation_enabled() const OVERRIDE;
|
|
virtual void set_stream_drift_samples(int drift) OVERRIDE;
|
|
virtual int set_suppression_level(SuppressionLevel level) OVERRIDE;
|
|
virtual SuppressionLevel suppression_level() const OVERRIDE;
|
|
virtual int enable_metrics(bool enable) OVERRIDE;
|
|
virtual bool are_metrics_enabled() const OVERRIDE;
|
|
virtual bool stream_has_echo() const OVERRIDE;
|
|
virtual int GetMetrics(Metrics* metrics) OVERRIDE;
|
|
virtual int enable_delay_logging(bool enable) OVERRIDE;
|
|
virtual bool is_delay_logging_enabled() const OVERRIDE;
|
|
virtual int GetDelayMetrics(int* median, int* std) OVERRIDE;
|
|
virtual int GetDelayMetrics(int* median, int* std,
|
|
float* fraction_poor_delays) OVERRIDE;
|
|
virtual struct AecCore* aec_core() const OVERRIDE;
|
|
|
|
// ProcessingComponent implementation.
|
|
virtual void* CreateHandle() const OVERRIDE;
|
|
virtual int InitializeHandle(void* handle) const OVERRIDE;
|
|
virtual int ConfigureHandle(void* handle) const OVERRIDE;
|
|
virtual void DestroyHandle(void* handle) const OVERRIDE;
|
|
virtual int num_handles_required() const OVERRIDE;
|
|
virtual int GetHandleError(void* handle) const OVERRIDE;
|
|
|
|
const AudioProcessing* apm_;
|
|
CriticalSectionWrapper* crit_;
|
|
bool drift_compensation_enabled_;
|
|
bool metrics_enabled_;
|
|
SuppressionLevel suppression_level_;
|
|
int stream_drift_samples_;
|
|
bool was_stream_drift_set_;
|
|
bool stream_has_echo_;
|
|
bool delay_logging_enabled_;
|
|
bool delay_correction_enabled_;
|
|
bool reported_delay_enabled_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
|