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

Side by Side Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 2463813002: Make use of new APM statistics interface. (Closed)
Patch Set: Remove DCHECKs on values of stats. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "webrtc/audio/audio_send_stream.h" 14 #include "webrtc/audio/audio_send_stream.h"
15 #include "webrtc/audio/audio_state.h" 15 #include "webrtc/audio/audio_state.h"
16 #include "webrtc/audio/conversion.h" 16 #include "webrtc/audio/conversion.h"
17 #include "webrtc/base/task_queue.h" 17 #include "webrtc/base/task_queue.h"
18 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" 18 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
19 #include "webrtc/modules/audio_processing/include/mock_audio_processing.h"
19 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" 20 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
20 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont roller.h" 21 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont roller.h"
21 #include "webrtc/modules/pacing/paced_sender.h" 22 #include "webrtc/modules/pacing/paced_sender.h"
22 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h" 23 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h"
23 #include "webrtc/test/gtest.h" 24 #include "webrtc/test/gtest.h"
24 #include "webrtc/test/mock_voe_channel_proxy.h" 25 #include "webrtc/test/mock_voe_channel_proxy.h"
25 #include "webrtc/test/mock_voice_engine.h" 26 #include "webrtc/test/mock_voice_engine.h"
26 27
27 namespace webrtc { 28 namespace webrtc {
28 namespace test { 29 namespace test {
29 namespace { 30 namespace {
30 31
31 using testing::_; 32 using testing::_;
32 using testing::Return; 33 using testing::Return;
33 34
34 const int kChannelId = 1; 35 const int kChannelId = 1;
35 const uint32_t kSsrc = 1234; 36 const uint32_t kSsrc = 1234;
36 const char* kCName = "foo_name"; 37 const char* kCName = "foo_name";
37 const int kAudioLevelId = 2; 38 const int kAudioLevelId = 2;
38 const int kTransportSequenceNumberId = 4; 39 const int kTransportSequenceNumberId = 4;
39 const int kEchoDelayMedian = 254; 40 const int kEchoDelayMedian = 254;
40 const int kEchoDelayStdDev = -3; 41 const int kEchoDelayStdDev = -3;
41 const int kEchoReturnLoss = -65; 42 const int kEchoReturnLoss = -65;
42 const int kEchoReturnLossEnhancement = 101; 43 const int kEchoReturnLossEnhancement = 101;
43 const float kResidualEchoLikelihood = 0.0f; 44 const float kResidualEchoLikelihood = -1.0f;
44 const unsigned int kSpeechInputLevel = 96; 45 const unsigned int kSpeechInputLevel = 96;
45 const CallStatistics kCallStats = { 46 const CallStatistics kCallStats = {
46 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; 47 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123};
47 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; 48 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354};
48 const int kTelephoneEventPayloadType = 123; 49 const int kTelephoneEventPayloadType = 123;
49 const int kTelephoneEventCode = 45; 50 const int kTelephoneEventCode = 45;
50 const int kTelephoneEventDuration = 6789; 51 const int kTelephoneEventDuration = 6789;
51 const CodecInst kIsacCodec = {103, "isac", 16000, 320, 1, 32000}; 52 const CodecInst kIsacCodec = {103, "isac", 16000, 320, 1, 32000};
52 53
53 class MockLimitObserver : public BitrateAllocator::LimitObserver { 54 class MockLimitObserver : public BitrateAllocator::LimitObserver {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 EXPECT_TRUE(channel_proxy_); 175 EXPECT_TRUE(channel_proxy_);
175 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics()) 176 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics())
176 .WillRepeatedly(Return(kCallStats)); 177 .WillRepeatedly(Return(kCallStats));
177 EXPECT_CALL(*channel_proxy_, GetRemoteRTCPReportBlocks()) 178 EXPECT_CALL(*channel_proxy_, GetRemoteRTCPReportBlocks())
178 .WillRepeatedly(Return(report_blocks)); 179 .WillRepeatedly(Return(report_blocks));
179 180
180 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) 181 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _))
181 .WillRepeatedly(DoAll(SetArgReferee<1>(kIsacCodec), Return(0))); 182 .WillRepeatedly(DoAll(SetArgReferee<1>(kIsacCodec), Return(0)));
182 EXPECT_CALL(voice_engine_, GetSpeechInputLevelFullRange(_)) 183 EXPECT_CALL(voice_engine_, GetSpeechInputLevelFullRange(_))
183 .WillRepeatedly(DoAll(SetArgReferee<0>(kSpeechInputLevel), Return(0))); 184 .WillRepeatedly(DoAll(SetArgReferee<0>(kSpeechInputLevel), Return(0)));
184 EXPECT_CALL(voice_engine_, GetEcMetricsStatus(_)) 185 EXPECT_CALL(voice_engine_, audio_processing())
185 .WillRepeatedly(DoAll(SetArgReferee<0>(true), Return(0))); 186 .WillRepeatedly(Return(&audio_processing_));
186 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _)) 187
187 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss), 188 // We have to set the instantaneous value, the average, min and max. We only
188 SetArgReferee<1>(kEchoReturnLossEnhancement), 189 // care about the instantaneous value, so we set all to the same value.
189 Return(0))); 190 audio_processing_stats_.echo_return_loss.Set(
190 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) 191 kEchoReturnLoss, kEchoReturnLoss, kEchoReturnLoss, kEchoReturnLoss);
191 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), 192 audio_processing_stats_.echo_return_loss_enhancement.Set(
192 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); 193 kEchoReturnLossEnhancement, kEchoReturnLossEnhancement,
194 kEchoReturnLossEnhancement, kEchoReturnLossEnhancement);
195 audio_processing_stats_.delay_median = kEchoDelayMedian;
196 audio_processing_stats_.delay_standard_deviation = kEchoDelayStdDev;
197
198 EXPECT_CALL(audio_processing_, GetStatistics())
199 .WillRepeatedly(Return(audio_processing_stats_));
193 } 200 }
194 201
195 private: 202 private:
196 SimulatedClock simulated_clock_; 203 SimulatedClock simulated_clock_;
197 testing::StrictMock<MockVoiceEngine> voice_engine_; 204 testing::StrictMock<MockVoiceEngine> voice_engine_;
198 rtc::scoped_refptr<AudioState> audio_state_; 205 rtc::scoped_refptr<AudioState> audio_state_;
199 AudioSendStream::Config stream_config_; 206 AudioSendStream::Config stream_config_;
200 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 207 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
201 testing::NiceMock<MockCongestionObserver> bitrate_observer_; 208 testing::NiceMock<MockCongestionObserver> bitrate_observer_;
202 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; 209 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
210 MockAudioProcessing audio_processing_;
211 AudioProcessing::AudioProcessingStatistics audio_processing_stats_;
203 CongestionController congestion_controller_; 212 CongestionController congestion_controller_;
204 MockRtcEventLog event_log_; 213 MockRtcEventLog event_log_;
205 testing::NiceMock<MockLimitObserver> limit_observer_; 214 testing::NiceMock<MockLimitObserver> limit_observer_;
206 BitrateAllocator bitrate_allocator_; 215 BitrateAllocator bitrate_allocator_;
207 // |worker_queue| is defined last to ensure all pending tasks are cancelled 216 // |worker_queue| is defined last to ensure all pending tasks are cancelled
208 // and deleted before any other members. 217 // and deleted before any other members.
209 rtc::TaskQueue worker_queue_; 218 rtc::TaskQueue worker_queue_;
210 }; 219 };
211 } // namespace 220 } // namespace
212 221
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) 385 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _))
377 .WillOnce(Return(0)); 386 .WillOnce(Return(0));
378 internal::AudioSendStream send_stream( 387 internal::AudioSendStream send_stream(
379 stream_config, helper.audio_state(), helper.worker_queue(), 388 stream_config, helper.audio_state(), helper.worker_queue(),
380 helper.congestion_controller(), helper.bitrate_allocator(), 389 helper.congestion_controller(), helper.bitrate_allocator(),
381 helper.event_log()); 390 helper.event_log());
382 } 391 }
383 392
384 } // namespace test 393 } // namespace test
385 } // namespace webrtc 394 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/modules/audio_processing/include/audio_processing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698