Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1117)

Unified Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 2964593002: Adding stats that can be used to compute output audio levels. (Closed)
Patch Set: Add test coverage in AudioSendStreamTest. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/call/audio_receive_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/audio/audio_send_stream_unittest.cc
diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc
index efc18d127d4a0ed7025ac80a4280455148dd8b54..5c57269dc9df56c5d511e6bb65d8b26c1277b866 100644
--- a/webrtc/audio/audio_send_stream_unittest.cc
+++ b/webrtc/audio/audio_send_stream_unittest.cc
@@ -55,6 +55,8 @@ const int kEchoReturnLoss = -65;
const int kEchoReturnLossEnhancement = 101;
const float kResidualEchoLikelihood = -1.0f;
const int32_t kSpeechInputLevel = 96;
+const double kTotalInputEnergy = 0.25;
+const double kTotalInputDuration = 0.5;
const CallStatistics kCallStats = {
1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123};
const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354};
@@ -82,6 +84,8 @@ class MockLimitObserver : public BitrateAllocator::LimitObserver {
class MockTransmitMixer : public voe::TransmitMixer {
public:
MOCK_CONST_METHOD0(AudioLevelFullRange, int16_t());
+ MOCK_CONST_METHOD0(GetTotalInputEnergy, double());
+ MOCK_CONST_METHOD0(GetTotalInputDuration, double());
};
std::unique_ptr<MockAudioEncoder> SetupAudioEncoderMock(
@@ -282,6 +286,10 @@ struct ConfigHelper {
EXPECT_CALL(transmit_mixer_, AudioLevelFullRange())
.WillRepeatedly(Return(kSpeechInputLevel));
+ EXPECT_CALL(transmit_mixer_, GetTotalInputEnergy())
+ .WillRepeatedly(Return(kTotalInputEnergy));
+ EXPECT_CALL(transmit_mixer_, GetTotalInputDuration())
+ .WillRepeatedly(Return(kTotalInputDuration));
// We have to set the instantaneous value, the average, min and max. We only
// care about the instantaneous value, so we set all to the same value.
@@ -416,6 +424,8 @@ TEST(AudioSendStreamTest, GetStats) {
stats.jitter_ms);
EXPECT_EQ(kCallStats.rttMs, stats.rtt_ms);
EXPECT_EQ(static_cast<int32_t>(kSpeechInputLevel), stats.audio_level);
+ EXPECT_EQ(kTotalInputEnergy, stats.total_input_energy);
+ EXPECT_EQ(kTotalInputDuration, stats.total_input_duration);
EXPECT_EQ(-1, stats.aec_quality_min);
EXPECT_EQ(kEchoDelayMedian, stats.echo_delay_median_ms);
EXPECT_EQ(kEchoDelayStdDev, stats.echo_delay_std_ms);
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/call/audio_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698