Make use of new APM statistics interface.
Updates GetStats() function in AudioSendStream to use the new GetStatistics function in APM instead of the corresponding VoE functions. BUG=webrtc:6525 Review-Url: https://codereview.webrtc.org/2463813002 Cr-Commit-Position: refs/heads/master@{#15065}
This commit is contained in:
@ -4,6 +4,7 @@ include_rules = [
|
|||||||
"+webrtc/modules/audio_coding/codecs/mock",
|
"+webrtc/modules/audio_coding/codecs/mock",
|
||||||
"+webrtc/call",
|
"+webrtc/call",
|
||||||
"+webrtc/logging/rtc_event_log",
|
"+webrtc/logging/rtc_event_log",
|
||||||
|
"+webrtc/modules/audio_processing/include",
|
||||||
"+webrtc/modules/bitrate_controller",
|
"+webrtc/modules/bitrate_controller",
|
||||||
"+webrtc/modules/congestion_controller",
|
"+webrtc/modules/congestion_controller",
|
||||||
"+webrtc/modules/pacing",
|
"+webrtc/modules/pacing",
|
||||||
|
|||||||
@ -197,34 +197,16 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats() const {
|
|||||||
stats.audio_level = static_cast<int32_t>(level);
|
stats.audio_level = static_cast<int32_t>(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool echo_metrics_on = false;
|
ScopedVoEInterface<VoEBase> base(voice_engine());
|
||||||
int error = processing->GetEcMetricsStatus(echo_metrics_on);
|
RTC_DCHECK(base->audio_processing());
|
||||||
RTC_DCHECK_EQ(0, error);
|
auto audio_processing_stats = base->audio_processing()->GetStatistics();
|
||||||
if (echo_metrics_on) {
|
stats.echo_delay_median_ms = audio_processing_stats.delay_median;
|
||||||
// These can also be negative, but in practice -1 is only used to signal
|
stats.echo_delay_std_ms = audio_processing_stats.delay_standard_deviation;
|
||||||
// insufficient data, since the resolution is limited to multiples of 4 ms.
|
stats.echo_return_loss = audio_processing_stats.echo_return_loss.instant();
|
||||||
int median = -1;
|
stats.echo_return_loss_enhancement =
|
||||||
int std = -1;
|
audio_processing_stats.echo_return_loss_enhancement.instant();
|
||||||
float dummy = 0.0f;
|
stats.residual_echo_likelihood =
|
||||||
error = processing->GetEcDelayMetrics(median, std, dummy);
|
audio_processing_stats.residual_echo_likelihood;
|
||||||
RTC_DCHECK_EQ(0, error);
|
|
||||||
stats.echo_delay_median_ms = median;
|
|
||||||
stats.echo_delay_std_ms = std;
|
|
||||||
|
|
||||||
// These can take on valid negative values, so use the lowest possible level
|
|
||||||
// as default rather than -1.
|
|
||||||
int erl = -100;
|
|
||||||
int erle = -100;
|
|
||||||
int dummy1 = 0;
|
|
||||||
int dummy2 = 0;
|
|
||||||
error = processing->GetEchoMetrics(erl, erle, dummy1, dummy2);
|
|
||||||
RTC_DCHECK_EQ(0, error);
|
|
||||||
stats.echo_return_loss = erl;
|
|
||||||
stats.echo_return_loss_enhancement = erle;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(ivoc): Hook this up to the residual echo detector.
|
|
||||||
stats.residual_echo_likelihood = 0.0f;
|
|
||||||
|
|
||||||
internal::AudioState* audio_state =
|
internal::AudioState* audio_state =
|
||||||
static_cast<internal::AudioState*>(audio_state_.get());
|
static_cast<internal::AudioState*>(audio_state_.get());
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#include "webrtc/audio/conversion.h"
|
#include "webrtc/audio/conversion.h"
|
||||||
#include "webrtc/base/task_queue.h"
|
#include "webrtc/base/task_queue.h"
|
||||||
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
||||||
|
#include "webrtc/modules/audio_processing/include/mock_audio_processing.h"
|
||||||
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
|
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
|
||||||
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
|
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
|
||||||
#include "webrtc/modules/pacing/paced_sender.h"
|
#include "webrtc/modules/pacing/paced_sender.h"
|
||||||
@ -40,7 +41,7 @@ const int kEchoDelayMedian = 254;
|
|||||||
const int kEchoDelayStdDev = -3;
|
const int kEchoDelayStdDev = -3;
|
||||||
const int kEchoReturnLoss = -65;
|
const int kEchoReturnLoss = -65;
|
||||||
const int kEchoReturnLossEnhancement = 101;
|
const int kEchoReturnLossEnhancement = 101;
|
||||||
const float kResidualEchoLikelihood = 0.0f;
|
const float kResidualEchoLikelihood = -1.0f;
|
||||||
const unsigned int kSpeechInputLevel = 96;
|
const unsigned int kSpeechInputLevel = 96;
|
||||||
const CallStatistics kCallStats = {
|
const CallStatistics kCallStats = {
|
||||||
1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123};
|
1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123};
|
||||||
@ -182,15 +183,21 @@ struct ConfigHelper {
|
|||||||
.WillRepeatedly(DoAll(SetArgReferee<1>(kIsacCodec), Return(0)));
|
.WillRepeatedly(DoAll(SetArgReferee<1>(kIsacCodec), Return(0)));
|
||||||
EXPECT_CALL(voice_engine_, GetSpeechInputLevelFullRange(_))
|
EXPECT_CALL(voice_engine_, GetSpeechInputLevelFullRange(_))
|
||||||
.WillRepeatedly(DoAll(SetArgReferee<0>(kSpeechInputLevel), Return(0)));
|
.WillRepeatedly(DoAll(SetArgReferee<0>(kSpeechInputLevel), Return(0)));
|
||||||
EXPECT_CALL(voice_engine_, GetEcMetricsStatus(_))
|
EXPECT_CALL(voice_engine_, audio_processing())
|
||||||
.WillRepeatedly(DoAll(SetArgReferee<0>(true), Return(0)));
|
.WillRepeatedly(Return(&audio_processing_));
|
||||||
EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _))
|
|
||||||
.WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss),
|
// We have to set the instantaneous value, the average, min and max. We only
|
||||||
SetArgReferee<1>(kEchoReturnLossEnhancement),
|
// care about the instantaneous value, so we set all to the same value.
|
||||||
Return(0)));
|
audio_processing_stats_.echo_return_loss.Set(
|
||||||
EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _))
|
kEchoReturnLoss, kEchoReturnLoss, kEchoReturnLoss, kEchoReturnLoss);
|
||||||
.WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian),
|
audio_processing_stats_.echo_return_loss_enhancement.Set(
|
||||||
SetArgReferee<1>(kEchoDelayStdDev), Return(0)));
|
kEchoReturnLossEnhancement, kEchoReturnLossEnhancement,
|
||||||
|
kEchoReturnLossEnhancement, kEchoReturnLossEnhancement);
|
||||||
|
audio_processing_stats_.delay_median = kEchoDelayMedian;
|
||||||
|
audio_processing_stats_.delay_standard_deviation = kEchoDelayStdDev;
|
||||||
|
|
||||||
|
EXPECT_CALL(audio_processing_, GetStatistics())
|
||||||
|
.WillRepeatedly(Return(audio_processing_stats_));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -201,6 +208,8 @@ struct ConfigHelper {
|
|||||||
testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
|
testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
|
||||||
testing::NiceMock<MockCongestionObserver> bitrate_observer_;
|
testing::NiceMock<MockCongestionObserver> bitrate_observer_;
|
||||||
testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
|
testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
|
||||||
|
MockAudioProcessing audio_processing_;
|
||||||
|
AudioProcessing::AudioProcessingStatistics audio_processing_stats_;
|
||||||
CongestionController congestion_controller_;
|
CongestionController congestion_controller_;
|
||||||
MockRtcEventLog event_log_;
|
MockRtcEventLog event_log_;
|
||||||
testing::NiceMock<MockLimitObserver> limit_observer_;
|
testing::NiceMock<MockLimitObserver> limit_observer_;
|
||||||
|
|||||||
@ -486,10 +486,6 @@ class AudioProcessing {
|
|||||||
Set(other.instant, other.average, other.maximum, other.minimum);
|
Set(other.instant, other.average, other.maximum, other.minimum);
|
||||||
}
|
}
|
||||||
void Set(float instant, float average, float maximum, float minimum) {
|
void Set(float instant, float average, float maximum, float minimum) {
|
||||||
RTC_DCHECK_LE(instant, maximum);
|
|
||||||
RTC_DCHECK_GE(instant, minimum);
|
|
||||||
RTC_DCHECK_LE(average, maximum);
|
|
||||||
RTC_DCHECK_GE(average, minimum);
|
|
||||||
instant_ = instant;
|
instant_ = instant;
|
||||||
average_ = average;
|
average_ = average;
|
||||||
maximum_ = maximum;
|
maximum_ = maximum;
|
||||||
|
|||||||
Reference in New Issue
Block a user