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

Side by Side Diff: webrtc/audio/audio_receive_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 unified diff | Download patch
« no previous file with comments | « webrtc/audio/audio_receive_stream.cc ('k') | webrtc/audio/audio_send_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const int kChannelId = 2; 50 const int kChannelId = 2;
51 const uint32_t kRemoteSsrc = 1234; 51 const uint32_t kRemoteSsrc = 1234;
52 const uint32_t kLocalSsrc = 5678; 52 const uint32_t kLocalSsrc = 5678;
53 const size_t kOneByteExtensionHeaderLength = 4; 53 const size_t kOneByteExtensionHeaderLength = 4;
54 const size_t kOneByteExtensionLength = 4; 54 const size_t kOneByteExtensionLength = 4;
55 const int kAudioLevelId = 3; 55 const int kAudioLevelId = 3;
56 const int kTransportSequenceNumberId = 4; 56 const int kTransportSequenceNumberId = 4;
57 const int kJitterBufferDelay = -7; 57 const int kJitterBufferDelay = -7;
58 const int kPlayoutBufferDelay = 302; 58 const int kPlayoutBufferDelay = 302;
59 const unsigned int kSpeechOutputLevel = 99; 59 const unsigned int kSpeechOutputLevel = 99;
60 const double kTotalOutputEnergy = 0.25;
61 const double kTotalOutputDuration = 0.5;
62
60 const CallStatistics kCallStats = { 63 const CallStatistics kCallStats = {
61 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123}; 64 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123};
62 const CodecInst kCodecInst = { 65 const CodecInst kCodecInst = {
63 123, "codec_name_recv", 96000, -187, 0, -103}; 66 123, "codec_name_recv", 96000, -187, 0, -103};
64 const NetworkStatistics kNetworkStats = { 67 const NetworkStatistics kNetworkStats = {
65 123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0}; 68 123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0};
66 const AudioDecodingCallStats kAudioDecodeStats = MakeAudioDecodeStatsForTest(); 69 const AudioDecodingCallStats kAudioDecodeStats = MakeAudioDecodeStatsForTest();
67 70
68 struct ConfigHelper { 71 struct ConfigHelper {
69 ConfigHelper() 72 ConfigHelper()
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 using testing::DoAll; 150 using testing::DoAll;
148 using testing::SetArgPointee; 151 using testing::SetArgPointee;
149 152
150 ASSERT_TRUE(channel_proxy_); 153 ASSERT_TRUE(channel_proxy_);
151 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics()) 154 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics())
152 .WillOnce(Return(kCallStats)); 155 .WillOnce(Return(kCallStats));
153 EXPECT_CALL(*channel_proxy_, GetDelayEstimate()) 156 EXPECT_CALL(*channel_proxy_, GetDelayEstimate())
154 .WillOnce(Return(kJitterBufferDelay + kPlayoutBufferDelay)); 157 .WillOnce(Return(kJitterBufferDelay + kPlayoutBufferDelay));
155 EXPECT_CALL(*channel_proxy_, GetSpeechOutputLevelFullRange()) 158 EXPECT_CALL(*channel_proxy_, GetSpeechOutputLevelFullRange())
156 .WillOnce(Return(kSpeechOutputLevel)); 159 .WillOnce(Return(kSpeechOutputLevel));
160 EXPECT_CALL(*channel_proxy_, GetTotalOutputEnergy())
161 .WillOnce(Return(kTotalOutputEnergy));
162 EXPECT_CALL(*channel_proxy_, GetTotalOutputDuration())
163 .WillOnce(Return(kTotalOutputDuration));
157 EXPECT_CALL(*channel_proxy_, GetNetworkStatistics()) 164 EXPECT_CALL(*channel_proxy_, GetNetworkStatistics())
158 .WillOnce(Return(kNetworkStats)); 165 .WillOnce(Return(kNetworkStats));
159 EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics()) 166 EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics())
160 .WillOnce(Return(kAudioDecodeStats)); 167 .WillOnce(Return(kAudioDecodeStats));
161 EXPECT_CALL(*channel_proxy_, GetRecCodec(_)) 168 EXPECT_CALL(*channel_proxy_, GetRecCodec(_))
162 .WillOnce(DoAll(SetArgPointee<0>(kCodecInst), Return(true))); 169 .WillOnce(DoAll(SetArgPointee<0>(kCodecInst), Return(true)));
163 } 170 }
164 171
165 private: 172 private:
166 PacketRouter packet_router_; 173 PacketRouter packet_router_;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 EXPECT_EQ(std::string(kCodecInst.plname), stats.codec_name); 310 EXPECT_EQ(std::string(kCodecInst.plname), stats.codec_name);
304 EXPECT_EQ(kCallStats.extendedMax, stats.ext_seqnum); 311 EXPECT_EQ(kCallStats.extendedMax, stats.ext_seqnum);
305 EXPECT_EQ(kCallStats.jitterSamples / (kCodecInst.plfreq / 1000), 312 EXPECT_EQ(kCallStats.jitterSamples / (kCodecInst.plfreq / 1000),
306 stats.jitter_ms); 313 stats.jitter_ms);
307 EXPECT_EQ(kNetworkStats.currentBufferSize, stats.jitter_buffer_ms); 314 EXPECT_EQ(kNetworkStats.currentBufferSize, stats.jitter_buffer_ms);
308 EXPECT_EQ(kNetworkStats.preferredBufferSize, 315 EXPECT_EQ(kNetworkStats.preferredBufferSize,
309 stats.jitter_buffer_preferred_ms); 316 stats.jitter_buffer_preferred_ms);
310 EXPECT_EQ(static_cast<uint32_t>(kJitterBufferDelay + kPlayoutBufferDelay), 317 EXPECT_EQ(static_cast<uint32_t>(kJitterBufferDelay + kPlayoutBufferDelay),
311 stats.delay_estimate_ms); 318 stats.delay_estimate_ms);
312 EXPECT_EQ(static_cast<int32_t>(kSpeechOutputLevel), stats.audio_level); 319 EXPECT_EQ(static_cast<int32_t>(kSpeechOutputLevel), stats.audio_level);
320 EXPECT_EQ(kTotalOutputEnergy, stats.total_output_energy);
321 EXPECT_EQ(kTotalOutputDuration, stats.total_output_duration);
313 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentExpandRate), stats.expand_rate); 322 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentExpandRate), stats.expand_rate);
314 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentSpeechExpandRate), 323 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentSpeechExpandRate),
315 stats.speech_expand_rate); 324 stats.speech_expand_rate);
316 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentSecondaryDecodedRate), 325 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentSecondaryDecodedRate),
317 stats.secondary_decoded_rate); 326 stats.secondary_decoded_rate);
318 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentAccelerateRate), 327 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentAccelerateRate),
319 stats.accelerate_rate); 328 stats.accelerate_rate);
320 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentPreemptiveRate), 329 EXPECT_EQ(Q14ToFloat(kNetworkStats.currentPreemptiveRate),
321 stats.preemptive_expand_rate); 330 stats.preemptive_expand_rate);
322 EXPECT_EQ(kAudioDecodeStats.calls_to_silence_generator, 331 EXPECT_EQ(kAudioDecodeStats.calls_to_silence_generator,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 374
366 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0)); 375 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0));
367 EXPECT_CALL(helper.voice_engine(), StopPlayout(_)); 376 EXPECT_CALL(helper.voice_engine(), StopPlayout(_));
368 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream)) 377 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream))
369 .WillOnce(Return(true)); 378 .WillOnce(Return(true));
370 379
371 recv_stream.Start(); 380 recv_stream.Start();
372 } 381 }
373 } // namespace test 382 } // namespace test
374 } // namespace webrtc 383 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_receive_stream.cc ('k') | webrtc/audio/audio_send_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698