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

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine_unittest.cc

Issue 1414743004: Implement AudioSendStream::GetStats(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: TODOs Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2008 Google Inc. 3 * Copyright 2008 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const cricket::AudioCodec kG722CodecSdp(9, "G722", 8000, 64000, 1, 0); 50 const cricket::AudioCodec kG722CodecSdp(9, "G722", 8000, 64000, 1, 0);
51 const cricket::AudioCodec kRedCodec(117, "red", 8000, 0, 1, 0); 51 const cricket::AudioCodec kRedCodec(117, "red", 8000, 0, 1, 0);
52 const cricket::AudioCodec kCn8000Codec(13, "CN", 8000, 0, 1, 0); 52 const cricket::AudioCodec kCn8000Codec(13, "CN", 8000, 0, 1, 0);
53 const cricket::AudioCodec kCn16000Codec(105, "CN", 16000, 0, 1, 0); 53 const cricket::AudioCodec kCn16000Codec(105, "CN", 16000, 0, 1, 0);
54 const cricket::AudioCodec kTelephoneEventCodec(106, "telephone-event", 8000, 0, 54 const cricket::AudioCodec kTelephoneEventCodec(106, "telephone-event", 8000, 0,
55 1, 0); 55 1, 0);
56 const cricket::AudioCodec* const kAudioCodecs[] = { 56 const cricket::AudioCodec* const kAudioCodecs[] = {
57 &kPcmuCodec, &kIsacCodec, &kOpusCodec, &kG722CodecVoE, &kRedCodec, 57 &kPcmuCodec, &kIsacCodec, &kOpusCodec, &kG722CodecVoE, &kRedCodec,
58 &kCn8000Codec, &kCn16000Codec, &kTelephoneEventCodec, 58 &kCn8000Codec, &kCn16000Codec, &kTelephoneEventCodec,
59 }; 59 };
60 static uint32_t kSsrc1 = 0x99; 60 const uint32_t kSsrc1 = 0x99;
61 static uint32_t kSsrc2 = 0x98; 61 const uint32_t kSsrc2 = 0x98;
62 static const uint32_t kSsrcs4[] = {1, 2, 3, 4}; 62 const uint32_t kSsrcs4[] = { 1, 2, 3, 4 };
63 63
64 class FakeVoEWrapper : public cricket::VoEWrapper { 64 class FakeVoEWrapper : public cricket::VoEWrapper {
65 public: 65 public:
66 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine) 66 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine)
67 : cricket::VoEWrapper(engine, // processing 67 : cricket::VoEWrapper(engine, // processing
68 engine, // base 68 engine, // base
69 engine, // codec 69 engine, // codec
70 engine, // dtmf 70 engine, // dtmf
71 engine, // hw 71 engine, // hw
72 engine, // network 72 engine, // network
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (!SetupEngine()) { 117 if (!SetupEngine()) {
118 return false; 118 return false;
119 } 119 }
120 return channel_->AddSendStream( 120 return channel_->AddSendStream(
121 cricket::StreamParams::CreateLegacy(kSsrc1)); 121 cricket::StreamParams::CreateLegacy(kSsrc1));
122 } 122 }
123 void SetupForMultiSendStream() { 123 void SetupForMultiSendStream() {
124 EXPECT_TRUE(SetupEngineWithSendStream()); 124 EXPECT_TRUE(SetupEngineWithSendStream());
125 // Remove stream added in Setup. 125 // Remove stream added in Setup.
126 int default_channel_num = voe_.GetLastChannel(); 126 int default_channel_num = voe_.GetLastChannel();
127 uint32_t default_send_ssrc = 0u; 127 EXPECT_EQ(kSsrc1, voe_.GetLocalSSRC(default_channel_num));
128 EXPECT_EQ(0, voe_.GetLocalSSRC(default_channel_num, default_send_ssrc)); 128 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc1));
129 EXPECT_EQ(kSsrc1, default_send_ssrc);
130 EXPECT_TRUE(channel_->RemoveSendStream(default_send_ssrc));
131 129
132 // Verify the channel does not exist. 130 // Verify the channel does not exist.
133 EXPECT_EQ(-1, voe_.GetLocalSSRC(default_channel_num, default_send_ssrc)); 131 EXPECT_EQ(-1, voe_.GetChannelFromLocalSsrc(kSsrc1));
134 } 132 }
135 void DeliverPacket(const void* data, int len) { 133 void DeliverPacket(const void* data, int len) {
136 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len); 134 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len);
137 channel_->OnPacketReceived(&packet, rtc::PacketTime()); 135 channel_->OnPacketReceived(&packet, rtc::PacketTime());
138 } 136 }
139 void TearDown() override { 137 void TearDown() override {
140 delete channel_; 138 delete channel_;
141 engine_.Terminate(); 139 engine_.Terminate();
142 } 140 }
143 141
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 EXPECT_NE(channel_num, new_channel_num); 281 EXPECT_NE(channel_num, new_channel_num);
284 EXPECT_EQ(id, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); 282 EXPECT_EQ(id, voe_.GetReceiveRtpExtensionId(new_channel_num, ext));
285 283
286 // Ensure all extensions go back off with an empty list. 284 // Ensure all extensions go back off with an empty list.
287 parameters.extensions.clear(); 285 parameters.extensions.clear();
288 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 286 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
289 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(channel_num, ext)); 287 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(channel_num, ext));
290 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); 288 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(new_channel_num, ext));
291 } 289 }
292 290
291 const webrtc::AudioSendStream::Stats& GetAudioSendStreamStats() const {
292 static webrtc::AudioSendStream::Stats stats;
tommi 2015/10/23 12:50:37 can you add a comment why this is static and not e
the sun 2015/10/23 15:14:17 Nah, if that's required I rather return by value.
293 if (stats.local_ssrc == 0) {
294 stats.local_ssrc = 12;
295 stats.bytes_sent = 345;
296 stats.packets_sent = 678;
297 stats.packets_lost = 9012;
298 stats.fraction_lost = 34.56f;
299 stats.codec_name = "codec_name_send";
300 stats.ext_seqnum = 789;
301 stats.jitter_ms = 12;
302 stats.rtt_ms = 345;
303 stats.audio_level = 678;
304 stats.aec_quality_min = 9.01f;
305 stats.echo_delay_median_ms = 234;
306 stats.echo_delay_std_ms = 567;
307 stats.echo_return_loss = 890;
308 stats.echo_return_loss_enhancement = 1234;
309 stats.typing_noise_detected = true;
310 }
311 return stats;
312 }
313 void SetAudioSendStreamStats() {
314 for (auto* s : call_.GetAudioSendStreams()) {
315 s->SetStats(GetAudioSendStreamStats());
316 }
317 }
318 void VerifyVoiceSenderInfo(const cricket::VoiceSenderInfo& info) {
319 const auto& kStats = GetAudioSendStreamStats();
tommi 2015/10/23 12:50:37 kStats -> stats since this is not a compile time c
the sun 2015/10/23 15:14:17 Done.
320 EXPECT_EQ(info.ssrc(), kStats.local_ssrc);
321 EXPECT_EQ(info.bytes_sent, kStats.bytes_sent);
322 EXPECT_EQ(info.packets_sent, kStats.packets_sent);
323 EXPECT_EQ(info.packets_lost, kStats.packets_lost);
324 EXPECT_EQ(info.fraction_lost, kStats.fraction_lost);
325 EXPECT_EQ(info.codec_name, kStats.codec_name);
326 EXPECT_EQ(info.ext_seqnum, kStats.ext_seqnum);
327 EXPECT_EQ(info.jitter_ms, kStats.jitter_ms);
328 EXPECT_EQ(info.rtt_ms, kStats.rtt_ms);
329 EXPECT_EQ(info.audio_level, kStats.audio_level);
330 EXPECT_EQ(info.aec_quality_min, kStats.aec_quality_min);
331 EXPECT_EQ(info.echo_delay_median_ms, kStats.echo_delay_median_ms);
332 EXPECT_EQ(info.echo_delay_std_ms, kStats.echo_delay_std_ms);
333 EXPECT_EQ(info.echo_return_loss, kStats.echo_return_loss);
334 EXPECT_EQ(info.echo_return_loss_enhancement,
335 kStats.echo_return_loss_enhancement);
336 // TODO(solenberg): Move typing noise detection into AudioSendStream.
337 // EXPECT_EQ(info.typing_noise_detected, kStats.typing_noise_detected);
338 }
339
293 const webrtc::AudioReceiveStream::Stats& GetAudioReceiveStreamStats() const { 340 const webrtc::AudioReceiveStream::Stats& GetAudioReceiveStreamStats() const {
294 static webrtc::AudioReceiveStream::Stats stats; 341 static webrtc::AudioReceiveStream::Stats stats;
295 if (stats.remote_ssrc == 0) { 342 if (stats.remote_ssrc == 0) {
296 stats.remote_ssrc = 123; 343 stats.remote_ssrc = 123;
297 stats.bytes_rcvd = 456; 344 stats.bytes_rcvd = 456;
298 stats.packets_rcvd = 768; 345 stats.packets_rcvd = 768;
299 stats.packets_lost = 101; 346 stats.packets_lost = 101;
300 stats.fraction_lost = 23.45f; 347 stats.fraction_lost = 23.45f;
301 stats.codec_name = "codec_name"; 348 stats.codec_name = "codec_name_recv";
302 stats.ext_seqnum = 678; 349 stats.ext_seqnum = 678;
303 stats.jitter_ms = 901; 350 stats.jitter_ms = 901;
304 stats.jitter_buffer_ms = 234; 351 stats.jitter_buffer_ms = 234;
305 stats.jitter_buffer_preferred_ms = 567; 352 stats.jitter_buffer_preferred_ms = 567;
306 stats.delay_estimate_ms = 890; 353 stats.delay_estimate_ms = 890;
307 stats.audio_level = 1234; 354 stats.audio_level = 1234;
308 stats.expand_rate = 5.67f; 355 stats.expand_rate = 5.67f;
309 stats.speech_expand_rate = 8.90f; 356 stats.speech_expand_rate = 8.90f;
310 stats.secondary_decoded_rate = 1.23f; 357 stats.secondary_decoded_rate = 1.23f;
311 stats.accelerate_rate = 4.56f; 358 stats.accelerate_rate = 4.56f;
312 stats.preemptive_expand_rate = 7.89f; 359 stats.preemptive_expand_rate = 7.89f;
313 stats.decoding_calls_to_silence_generator = 012; 360 stats.decoding_calls_to_silence_generator = 012;
314 stats.decoding_calls_to_neteq = 345; 361 stats.decoding_calls_to_neteq = 345;
315 stats.decoding_normal = 67890; 362 stats.decoding_normal = 67890;
316 stats.decoding_plc = 1234; 363 stats.decoding_plc = 1234;
317 stats.decoding_cng = 5678; 364 stats.decoding_cng = 5678;
318 stats.decoding_plc_cng = 9012; 365 stats.decoding_plc_cng = 9012;
319 stats.capture_start_ntp_time_ms = 3456; 366 stats.capture_start_ntp_time_ms = 3456;
320 } 367 }
321 return stats; 368 return stats;
322 } 369 }
323 void SetAudioReceiveStreamStats() { 370 void SetAudioReceiveStreamStats() {
324 for (auto* s : call_.GetAudioReceiveStreams()) { 371 for (auto* s : call_.GetAudioReceiveStreams()) {
325 s->SetStats(GetAudioReceiveStreamStats()); 372 s->SetStats(GetAudioReceiveStreamStats());
326 } 373 }
327 } 374 }
328 void VerifyVoiceReceiverInfo(const cricket::VoiceReceiverInfo& info) { 375 void VerifyVoiceReceiverInfo(const cricket::VoiceReceiverInfo& info) {
329 const auto& kStats = GetAudioReceiveStreamStats(); 376 const auto& kStats = GetAudioReceiveStreamStats();
330 EXPECT_EQ(info.local_stats.front().ssrc, kStats.remote_ssrc); 377 EXPECT_EQ(info.ssrc(), kStats.remote_ssrc);
331 EXPECT_EQ(info.bytes_rcvd, kStats.bytes_rcvd); 378 EXPECT_EQ(info.bytes_rcvd, kStats.bytes_rcvd);
332 EXPECT_EQ(info.packets_rcvd, kStats.packets_rcvd); 379 EXPECT_EQ(info.packets_rcvd, kStats.packets_rcvd);
333 EXPECT_EQ(info.packets_lost, kStats.packets_lost); 380 EXPECT_EQ(info.packets_lost, kStats.packets_lost);
334 EXPECT_EQ(info.fraction_lost, kStats.fraction_lost); 381 EXPECT_EQ(info.fraction_lost, kStats.fraction_lost);
335 EXPECT_EQ(info.codec_name, kStats.codec_name); 382 EXPECT_EQ(info.codec_name, kStats.codec_name);
336 EXPECT_EQ(info.ext_seqnum, kStats.ext_seqnum); 383 EXPECT_EQ(info.ext_seqnum, kStats.ext_seqnum);
337 EXPECT_EQ(info.jitter_ms, kStats.jitter_ms); 384 EXPECT_EQ(info.jitter_ms, kStats.jitter_ms);
338 EXPECT_EQ(info.jitter_buffer_ms, kStats.jitter_buffer_ms); 385 EXPECT_EQ(info.jitter_buffer_ms, kStats.jitter_buffer_ms);
339 EXPECT_EQ(info.jitter_buffer_preferred_ms, 386 EXPECT_EQ(info.jitter_buffer_preferred_ms,
340 kStats.jitter_buffer_preferred_ms); 387 kStats.jitter_buffer_preferred_ms);
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 2068
2022 // Test we can set the correct statistics on all send streams. 2069 // Test we can set the correct statistics on all send streams.
2023 TEST_F(WebRtcVoiceEngineTestFake, GetStatsWithMultipleSendStreams) { 2070 TEST_F(WebRtcVoiceEngineTestFake, GetStatsWithMultipleSendStreams) {
2024 SetupForMultiSendStream(); 2071 SetupForMultiSendStream();
2025 2072
2026 // Create send streams. 2073 // Create send streams.
2027 for (uint32_t ssrc : kSsrcs4) { 2074 for (uint32_t ssrc : kSsrcs4) {
2028 EXPECT_TRUE(channel_->AddSendStream( 2075 EXPECT_TRUE(channel_->AddSendStream(
2029 cricket::StreamParams::CreateLegacy(ssrc))); 2076 cricket::StreamParams::CreateLegacy(ssrc)));
2030 } 2077 }
2078 SetAudioSendStreamStats();
2079
2031 // Create a receive stream to check that none of the send streams end up in 2080 // Create a receive stream to check that none of the send streams end up in
2032 // the receive stream stats. 2081 // the receive stream stats.
2033 EXPECT_TRUE(channel_->AddRecvStream( 2082 EXPECT_TRUE(channel_->AddRecvStream(
2034 cricket::StreamParams::CreateLegacy(kSsrc2))); 2083 cricket::StreamParams::CreateLegacy(kSsrc2)));
2035 // We need send codec to be set to get all stats. 2084 // We need send codec to be set to get all stats.
2036 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 2085 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2037 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 2086 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
2038 2087
2039 cricket::VoiceMediaInfo info; 2088 cricket::VoiceMediaInfo info;
2040 EXPECT_EQ(true, channel_->GetStats(&info)); 2089 EXPECT_EQ(true, channel_->GetStats(&info));
2041 EXPECT_EQ(static_cast<size_t>(ARRAY_SIZE(kSsrcs4)), info.senders.size()); 2090 {
2091 // We have added 4 send streams. We should see empty stats for all.
2092 EXPECT_EQ(static_cast<size_t>(ARRAY_SIZE(kSsrcs4)), info.senders.size());
2093 for (const auto& sender : info.senders) {
2094 VerifyVoiceSenderInfo(sender);
2095 }
2042 2096
2043 // Verify the statistic information is correct. 2097 // We have added one receive stream. We should see empty stats.
2044 // TODO(solenberg): Make this loop ordering independent. 2098 EXPECT_EQ(info.receivers.size(), 1u);
2045 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs4); ++i) { 2099 EXPECT_EQ(info.receivers[0].ssrc(), 0);
2046 EXPECT_EQ(kSsrcs4[i], info.senders[i].ssrc());
2047 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name);
2048 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].bytes_sent);
2049 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_sent);
2050 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_lost);
2051 EXPECT_EQ(cricket::kFractionLostStatValue, info.senders[i].fraction_lost);
2052 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].ext_seqnum);
2053 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].rtt_ms);
2054 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].jitter_ms);
2055 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name);
2056 } 2100 }
2057 2101
2058 // We have added one receive stream. We should see empty stats.
2059 EXPECT_EQ(info.receivers.size(), 1u);
2060 EXPECT_EQ(info.receivers[0].local_stats.front().ssrc, 0);
2061
2062 // Remove the kSsrc2 stream. No receiver stats. 2102 // Remove the kSsrc2 stream. No receiver stats.
2063 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); 2103 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2));
2064 EXPECT_EQ(true, channel_->GetStats(&info)); 2104 EXPECT_EQ(true, channel_->GetStats(&info));
2105 EXPECT_EQ(static_cast<size_t>(ARRAY_SIZE(kSsrcs4)), info.senders.size());
2065 EXPECT_EQ(0u, info.receivers.size()); 2106 EXPECT_EQ(0u, info.receivers.size());
2066 2107
2067 // Deliver a new packet - a default receive stream should be created and we 2108 // Deliver a new packet - a default receive stream should be created and we
2068 // should see stats again. 2109 // should see stats again.
2069 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 2110 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2070 SetAudioReceiveStreamStats(); 2111 SetAudioReceiveStreamStats();
2071 EXPECT_EQ(true, channel_->GetStats(&info)); 2112 EXPECT_EQ(true, channel_->GetStats(&info));
2113 EXPECT_EQ(static_cast<size_t>(ARRAY_SIZE(kSsrcs4)), info.senders.size());
2072 EXPECT_EQ(1u, info.receivers.size()); 2114 EXPECT_EQ(1u, info.receivers.size());
2073 VerifyVoiceReceiverInfo(info.receivers[0]); 2115 VerifyVoiceReceiverInfo(info.receivers[0]);
2074 } 2116 }
2075 2117
2076 // Test that we can add and remove receive streams, and do proper send/playout. 2118 // Test that we can add and remove receive streams, and do proper send/playout.
2077 // We can receive on multiple streams while sending one stream. 2119 // We can receive on multiple streams while sending one stream.
2078 TEST_F(WebRtcVoiceEngineTestFake, PlayoutWithMultipleStreams) { 2120 TEST_F(WebRtcVoiceEngineTestFake, PlayoutWithMultipleStreams) {
2079 EXPECT_TRUE(SetupEngineWithSendStream()); 2121 EXPECT_TRUE(SetupEngineWithSendStream());
2080 int channel_num1 = voe_.GetLastChannel(); 2122 int channel_num1 = voe_.GetLastChannel();
2081 2123
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 "tracefilter " + rtc::ToString(webrtc::kTraceDefault); 2327 "tracefilter " + rtc::ToString(webrtc::kTraceDefault);
2286 engine_.SetLogging(rtc::LS_VERBOSE, filter.c_str()); 2328 engine_.SetLogging(rtc::LS_VERBOSE, filter.c_str());
2287 EXPECT_EQ(static_cast<unsigned int>(webrtc::kTraceDefault), 2329 EXPECT_EQ(static_cast<unsigned int>(webrtc::kTraceDefault),
2288 trace_wrapper_->filter_); 2330 trace_wrapper_->filter_);
2289 } 2331 }
2290 2332
2291 // Test that we can set the outgoing SSRC properly. 2333 // Test that we can set the outgoing SSRC properly.
2292 // SSRC is set in SetupEngine by calling AddSendStream. 2334 // SSRC is set in SetupEngine by calling AddSendStream.
2293 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) { 2335 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) {
2294 EXPECT_TRUE(SetupEngineWithSendStream()); 2336 EXPECT_TRUE(SetupEngineWithSendStream());
2295 int channel_num = voe_.GetLastChannel(); 2337 EXPECT_EQ(kSsrc1, voe_.GetLocalSSRC(voe_.GetLastChannel()));
2296 unsigned int send_ssrc;
2297 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num, send_ssrc));
2298 EXPECT_NE(0U, send_ssrc);
2299 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num, send_ssrc));
2300 EXPECT_EQ(kSsrc1, send_ssrc);
2301 } 2338 }
2302 2339
2303 TEST_F(WebRtcVoiceEngineTestFake, GetStats) { 2340 TEST_F(WebRtcVoiceEngineTestFake, GetStats) {
2304 // Setup. We need send codec to be set to get all stats. 2341 // Setup. We need send codec to be set to get all stats.
2305 EXPECT_TRUE(SetupEngineWithSendStream()); 2342 EXPECT_TRUE(SetupEngineWithSendStream());
2343 SetAudioSendStreamStats();
2306 // SetupEngineWithSendStream adds a send stream with kSsrc1, so the receive 2344 // SetupEngineWithSendStream adds a send stream with kSsrc1, so the receive
2307 // stream has to use a different SSRC. 2345 // stream has to use a different SSRC.
2308 EXPECT_TRUE(channel_->AddRecvStream( 2346 EXPECT_TRUE(channel_->AddRecvStream(
2309 cricket::StreamParams::CreateLegacy(kSsrc2))); 2347 cricket::StreamParams::CreateLegacy(kSsrc2)));
2310 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 2348 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2311 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 2349 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
2312 2350
2313 cricket::VoiceMediaInfo info; 2351 cricket::VoiceMediaInfo info;
2314 EXPECT_EQ(true, channel_->GetStats(&info)); 2352 EXPECT_EQ(true, channel_->GetStats(&info));
2315 EXPECT_EQ(1u, info.senders.size()); 2353 {
2316 EXPECT_EQ(kSsrc1, info.senders[0].ssrc()); 2354 // We have added one send stream. We should see the stats we've set.
2317 EXPECT_EQ(kPcmuCodec.name, info.senders[0].codec_name); 2355 EXPECT_EQ(1u, info.senders.size());
2318 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].bytes_sent); 2356 VerifyVoiceSenderInfo(info.senders[0]);
2319 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].packets_sent); 2357 // We have added one receive stream. We should see empty stats.
2320 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].packets_lost); 2358 EXPECT_EQ(info.receivers.size(), 1u);
2321 EXPECT_EQ(cricket::kFractionLostStatValue, info.senders[0].fraction_lost); 2359 EXPECT_EQ(info.receivers[0].ssrc(), 0);
2322 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].ext_seqnum); 2360 }
2323 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].rtt_ms);
2324 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].jitter_ms);
2325 EXPECT_EQ(kPcmuCodec.name, info.senders[0].codec_name);
2326 // TODO(sriniv): Add testing for more fields. These are not populated
2327 // in FakeWebrtcVoiceEngine yet.
2328 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].audio_level);
2329 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_median_ms);
2330 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_std_ms);
2331 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_return_loss);
2332 // EXPECT_EQ(cricket::kIntStatValue,
2333 // info.senders[0].echo_return_loss_enhancement);
2334 // We have added one receive stream. We should see empty stats.
2335 EXPECT_EQ(info.receivers.size(), 1u);
2336 EXPECT_EQ(info.receivers[0].local_stats.front().ssrc, 0);
2337 2361
2338 // Remove the kSsrc2 stream. No receiver stats. 2362 // Remove the kSsrc2 stream. No receiver stats.
2339 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); 2363 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2));
2340 EXPECT_EQ(true, channel_->GetStats(&info)); 2364 EXPECT_EQ(true, channel_->GetStats(&info));
2365 EXPECT_EQ(1u, info.senders.size());
2341 EXPECT_EQ(0u, info.receivers.size()); 2366 EXPECT_EQ(0u, info.receivers.size());
2342 2367
2343 // Deliver a new packet - a default receive stream should be created and we 2368 // Deliver a new packet - a default receive stream should be created and we
2344 // should see stats again. 2369 // should see stats again.
2345 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 2370 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2346 SetAudioReceiveStreamStats(); 2371 SetAudioReceiveStreamStats();
2347 EXPECT_EQ(true, channel_->GetStats(&info)); 2372 EXPECT_EQ(true, channel_->GetStats(&info));
2373 EXPECT_EQ(1u, info.senders.size());
2348 EXPECT_EQ(1u, info.receivers.size()); 2374 EXPECT_EQ(1u, info.receivers.size());
2349 VerifyVoiceReceiverInfo(info.receivers[0]); 2375 VerifyVoiceReceiverInfo(info.receivers[0]);
2350 } 2376 }
2351 2377
2352 // Test that we can set the outgoing SSRC properly with multiple streams. 2378 // Test that we can set the outgoing SSRC properly with multiple streams.
2353 // SSRC is set in SetupEngine by calling AddSendStream. 2379 // SSRC is set in SetupEngine by calling AddSendStream.
2354 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcWithMultipleStreams) { 2380 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcWithMultipleStreams) {
2355 EXPECT_TRUE(SetupEngineWithSendStream()); 2381 EXPECT_TRUE(SetupEngineWithSendStream());
2356 int channel_num1 = voe_.GetLastChannel(); 2382 EXPECT_EQ(kSsrc1, voe_.GetLocalSSRC(voe_.GetLastChannel()));
2357 unsigned int send_ssrc;
2358 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num1, send_ssrc));
2359 EXPECT_EQ(kSsrc1, send_ssrc);
2360
2361 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2))); 2383 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2)));
2362 int channel_num2 = voe_.GetLastChannel(); 2384 EXPECT_EQ(kSsrc1, voe_.GetLocalSSRC(voe_.GetLastChannel()));
2363 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num2, send_ssrc));
2364 EXPECT_EQ(kSsrc1, send_ssrc);
2365 } 2385 }
2366 2386
2367 // Test that the local SSRC is the same on sending and receiving channels if the 2387 // Test that the local SSRC is the same on sending and receiving channels if the
2368 // receive channel is created before the send channel. 2388 // receive channel is created before the send channel.
2369 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) { 2389 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) {
2370 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 2390 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
2371 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 2391 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
2372 2392
2373 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); 2393 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
2374 int receive_channel_num = voe_.GetLastChannel(); 2394 int receive_channel_num = voe_.GetLastChannel();
2375 EXPECT_TRUE(channel_->AddSendStream( 2395 EXPECT_TRUE(channel_->AddSendStream(
2376 cricket::StreamParams::CreateLegacy(1234))); 2396 cricket::StreamParams::CreateLegacy(1234)));
2377 int send_channel_num = voe_.GetLastChannel(); 2397 int send_channel_num = voe_.GetLastChannel();
2378 2398
2379 unsigned int ssrc = 0; 2399 EXPECT_EQ(1234U, voe_.GetLocalSSRC(send_channel_num));
2380 EXPECT_EQ(0, voe_.GetLocalSSRC(send_channel_num, ssrc)); 2400 EXPECT_EQ(1234U, voe_.GetLocalSSRC(receive_channel_num));
2381 EXPECT_EQ(1234U, ssrc);
2382 ssrc = 0;
2383 EXPECT_EQ(0, voe_.GetLocalSSRC(receive_channel_num, ssrc));
2384 EXPECT_EQ(1234U, ssrc);
2385 } 2401 }
2386 2402
2387 // Test that we can properly receive packets. 2403 // Test that we can properly receive packets.
2388 TEST_F(WebRtcVoiceEngineTestFake, Recv) { 2404 TEST_F(WebRtcVoiceEngineTestFake, Recv) {
2389 EXPECT_TRUE(SetupEngine()); 2405 EXPECT_TRUE(SetupEngine());
2390 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 2406 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2391 int channel_num = voe_.GetLastChannel(); 2407 int channel_num = voe_.GetLastChannel();
2392 EXPECT_TRUE(voe_.CheckPacket(channel_num, kPcmuFrame, 2408 EXPECT_TRUE(voe_.CheckPacket(channel_num, kPcmuFrame,
2393 sizeof(kPcmuFrame))); 2409 sizeof(kPcmuFrame)));
2394 } 2410 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 voe_.set_playout_fail_channel(voe_.GetLastChannel() - 1); 2554 voe_.set_playout_fail_channel(voe_.GetLastChannel() - 1);
2539 EXPECT_TRUE(channel_->SetPlayout(false)); 2555 EXPECT_TRUE(channel_->SetPlayout(false));
2540 EXPECT_FALSE(channel_->SetPlayout(true)); 2556 EXPECT_FALSE(channel_->SetPlayout(true));
2541 } 2557 }
2542 2558
2543 TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) { 2559 TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) {
2544 EXPECT_TRUE(SetupEngineWithSendStream()); 2560 EXPECT_TRUE(SetupEngineWithSendStream());
2545 2561
2546 bool ec_enabled; 2562 bool ec_enabled;
2547 webrtc::EcModes ec_mode; 2563 webrtc::EcModes ec_mode;
2548 bool ec_metrics_enabled;
2549 webrtc::AecmModes aecm_mode; 2564 webrtc::AecmModes aecm_mode;
2550 bool cng_enabled; 2565 bool cng_enabled;
2551 bool agc_enabled; 2566 bool agc_enabled;
2552 webrtc::AgcModes agc_mode; 2567 webrtc::AgcModes agc_mode;
2553 webrtc::AgcConfig agc_config; 2568 webrtc::AgcConfig agc_config;
2554 bool ns_enabled; 2569 bool ns_enabled;
2555 webrtc::NsModes ns_mode; 2570 webrtc::NsModes ns_mode;
2556 bool highpass_filter_enabled; 2571 bool highpass_filter_enabled;
2557 bool stereo_swapping_enabled; 2572 bool stereo_swapping_enabled;
2558 bool typing_detection_enabled; 2573 bool typing_detection_enabled;
2559 voe_.GetEcStatus(ec_enabled, ec_mode); 2574 voe_.GetEcStatus(ec_enabled, ec_mode);
2560 voe_.GetEcMetricsStatus(ec_metrics_enabled);
2561 voe_.GetAecmMode(aecm_mode, cng_enabled); 2575 voe_.GetAecmMode(aecm_mode, cng_enabled);
2562 voe_.GetAgcStatus(agc_enabled, agc_mode); 2576 voe_.GetAgcStatus(agc_enabled, agc_mode);
2563 voe_.GetAgcConfig(agc_config); 2577 voe_.GetAgcConfig(agc_config);
2564 voe_.GetNsStatus(ns_enabled, ns_mode); 2578 voe_.GetNsStatus(ns_enabled, ns_mode);
2565 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); 2579 highpass_filter_enabled = voe_.IsHighPassFilterEnabled();
2566 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); 2580 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled();
2567 voe_.GetTypingDetectionStatus(typing_detection_enabled); 2581 voe_.GetTypingDetectionStatus(typing_detection_enabled);
2568 EXPECT_TRUE(ec_enabled); 2582 EXPECT_TRUE(ec_enabled);
2569 EXPECT_TRUE(ec_metrics_enabled); 2583 EXPECT_TRUE(voe_.ec_metrics_enabled());
2570 EXPECT_FALSE(cng_enabled); 2584 EXPECT_FALSE(cng_enabled);
2571 EXPECT_TRUE(agc_enabled); 2585 EXPECT_TRUE(agc_enabled);
2572 EXPECT_EQ(0, agc_config.targetLeveldBOv); 2586 EXPECT_EQ(0, agc_config.targetLeveldBOv);
2573 EXPECT_TRUE(ns_enabled); 2587 EXPECT_TRUE(ns_enabled);
2574 EXPECT_TRUE(highpass_filter_enabled); 2588 EXPECT_TRUE(highpass_filter_enabled);
2575 EXPECT_FALSE(stereo_swapping_enabled); 2589 EXPECT_FALSE(stereo_swapping_enabled);
2576 EXPECT_TRUE(typing_detection_enabled); 2590 EXPECT_TRUE(typing_detection_enabled);
2577 EXPECT_EQ(ec_mode, webrtc::kEcConference); 2591 EXPECT_EQ(ec_mode, webrtc::kEcConference);
2578 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); 2592 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression);
2579 2593
2580 // Nothing set, so all ignored. 2594 // Nothing set, so all ignored.
2581 cricket::AudioOptions options; 2595 cricket::AudioOptions options;
2582 ASSERT_TRUE(engine_.SetOptions(options)); 2596 ASSERT_TRUE(engine_.SetOptions(options));
2583 voe_.GetEcStatus(ec_enabled, ec_mode); 2597 voe_.GetEcStatus(ec_enabled, ec_mode);
2584 voe_.GetEcMetricsStatus(ec_metrics_enabled);
2585 voe_.GetAecmMode(aecm_mode, cng_enabled); 2598 voe_.GetAecmMode(aecm_mode, cng_enabled);
2586 voe_.GetAgcStatus(agc_enabled, agc_mode); 2599 voe_.GetAgcStatus(agc_enabled, agc_mode);
2587 voe_.GetAgcConfig(agc_config); 2600 voe_.GetAgcConfig(agc_config);
2588 voe_.GetNsStatus(ns_enabled, ns_mode); 2601 voe_.GetNsStatus(ns_enabled, ns_mode);
2589 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); 2602 highpass_filter_enabled = voe_.IsHighPassFilterEnabled();
2590 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); 2603 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled();
2591 voe_.GetTypingDetectionStatus(typing_detection_enabled); 2604 voe_.GetTypingDetectionStatus(typing_detection_enabled);
2592 EXPECT_TRUE(ec_enabled); 2605 EXPECT_TRUE(ec_enabled);
2593 EXPECT_TRUE(ec_metrics_enabled); 2606 EXPECT_TRUE(voe_.ec_metrics_enabled());
2594 EXPECT_FALSE(cng_enabled); 2607 EXPECT_FALSE(cng_enabled);
2595 EXPECT_TRUE(agc_enabled); 2608 EXPECT_TRUE(agc_enabled);
2596 EXPECT_EQ(0, agc_config.targetLeveldBOv); 2609 EXPECT_EQ(0, agc_config.targetLeveldBOv);
2597 EXPECT_TRUE(ns_enabled); 2610 EXPECT_TRUE(ns_enabled);
2598 EXPECT_TRUE(highpass_filter_enabled); 2611 EXPECT_TRUE(highpass_filter_enabled);
2599 EXPECT_FALSE(stereo_swapping_enabled); 2612 EXPECT_FALSE(stereo_swapping_enabled);
2600 EXPECT_TRUE(typing_detection_enabled); 2613 EXPECT_TRUE(typing_detection_enabled);
2601 EXPECT_EQ(ec_mode, webrtc::kEcConference); 2614 EXPECT_EQ(ec_mode, webrtc::kEcConference);
2602 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); 2615 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression);
2603 EXPECT_EQ(50, voe_.GetNetEqCapacity()); // From GetDefaultEngineOptions(). 2616 EXPECT_EQ(50, voe_.GetNetEqCapacity()); // From GetDefaultEngineOptions().
2604 EXPECT_FALSE( 2617 EXPECT_FALSE(
2605 voe_.GetNetEqFastAccelerate()); // From GetDefaultEngineOptions(). 2618 voe_.GetNetEqFastAccelerate()); // From GetDefaultEngineOptions().
2606 2619
2607 // Turn echo cancellation off 2620 // Turn echo cancellation off
2608 options.echo_cancellation.Set(false); 2621 options.echo_cancellation.Set(false);
2609 ASSERT_TRUE(engine_.SetOptions(options)); 2622 ASSERT_TRUE(engine_.SetOptions(options));
2610 voe_.GetEcStatus(ec_enabled, ec_mode); 2623 voe_.GetEcStatus(ec_enabled, ec_mode);
2611 EXPECT_FALSE(ec_enabled); 2624 EXPECT_FALSE(ec_enabled);
2612 2625
2613 // Turn echo cancellation back on, with settings, and make sure 2626 // Turn echo cancellation back on, with settings, and make sure
2614 // nothing else changed. 2627 // nothing else changed.
2615 options.echo_cancellation.Set(true); 2628 options.echo_cancellation.Set(true);
2616 ASSERT_TRUE(engine_.SetOptions(options)); 2629 ASSERT_TRUE(engine_.SetOptions(options));
2617 voe_.GetEcStatus(ec_enabled, ec_mode); 2630 voe_.GetEcStatus(ec_enabled, ec_mode);
2618 voe_.GetEcMetricsStatus(ec_metrics_enabled);
2619 voe_.GetAecmMode(aecm_mode, cng_enabled); 2631 voe_.GetAecmMode(aecm_mode, cng_enabled);
2620 voe_.GetAgcStatus(agc_enabled, agc_mode); 2632 voe_.GetAgcStatus(agc_enabled, agc_mode);
2621 voe_.GetAgcConfig(agc_config); 2633 voe_.GetAgcConfig(agc_config);
2622 voe_.GetNsStatus(ns_enabled, ns_mode); 2634 voe_.GetNsStatus(ns_enabled, ns_mode);
2623 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); 2635 highpass_filter_enabled = voe_.IsHighPassFilterEnabled();
2624 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); 2636 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled();
2625 voe_.GetTypingDetectionStatus(typing_detection_enabled); 2637 voe_.GetTypingDetectionStatus(typing_detection_enabled);
2626 EXPECT_TRUE(ec_enabled); 2638 EXPECT_TRUE(ec_enabled);
2627 EXPECT_TRUE(ec_metrics_enabled); 2639 EXPECT_TRUE(voe_.ec_metrics_enabled());
2628 EXPECT_TRUE(agc_enabled); 2640 EXPECT_TRUE(agc_enabled);
2629 EXPECT_EQ(0, agc_config.targetLeveldBOv); 2641 EXPECT_EQ(0, agc_config.targetLeveldBOv);
2630 EXPECT_TRUE(ns_enabled); 2642 EXPECT_TRUE(ns_enabled);
2631 EXPECT_TRUE(highpass_filter_enabled); 2643 EXPECT_TRUE(highpass_filter_enabled);
2632 EXPECT_FALSE(stereo_swapping_enabled); 2644 EXPECT_FALSE(stereo_swapping_enabled);
2633 EXPECT_TRUE(typing_detection_enabled); 2645 EXPECT_TRUE(typing_detection_enabled);
2634 EXPECT_EQ(ec_mode, webrtc::kEcConference); 2646 EXPECT_EQ(ec_mode, webrtc::kEcConference);
2635 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); 2647 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression);
2636 2648
2637 // Turn on delay agnostic aec and make sure nothing change w.r.t. echo 2649 // Turn on delay agnostic aec and make sure nothing change w.r.t. echo
2638 // control. 2650 // control.
2639 options.delay_agnostic_aec.Set(true); 2651 options.delay_agnostic_aec.Set(true);
2640 ASSERT_TRUE(engine_.SetOptions(options)); 2652 ASSERT_TRUE(engine_.SetOptions(options));
2641 voe_.GetEcStatus(ec_enabled, ec_mode); 2653 voe_.GetEcStatus(ec_enabled, ec_mode);
2642 voe_.GetEcMetricsStatus(ec_metrics_enabled);
2643 voe_.GetAecmMode(aecm_mode, cng_enabled); 2654 voe_.GetAecmMode(aecm_mode, cng_enabled);
2644 EXPECT_TRUE(ec_enabled); 2655 EXPECT_TRUE(ec_enabled);
2645 EXPECT_TRUE(ec_metrics_enabled); 2656 EXPECT_TRUE(voe_.ec_metrics_enabled());
2646 EXPECT_EQ(ec_mode, webrtc::kEcConference); 2657 EXPECT_EQ(ec_mode, webrtc::kEcConference);
2647 2658
2648 // Turn off echo cancellation and delay agnostic aec. 2659 // Turn off echo cancellation and delay agnostic aec.
2649 options.delay_agnostic_aec.Set(false); 2660 options.delay_agnostic_aec.Set(false);
2650 options.extended_filter_aec.Set(false); 2661 options.extended_filter_aec.Set(false);
2651 options.echo_cancellation.Set(false); 2662 options.echo_cancellation.Set(false);
2652 ASSERT_TRUE(engine_.SetOptions(options)); 2663 ASSERT_TRUE(engine_.SetOptions(options));
2653 voe_.GetEcStatus(ec_enabled, ec_mode); 2664 voe_.GetEcStatus(ec_enabled, ec_mode);
2654 EXPECT_FALSE(ec_enabled); 2665 EXPECT_FALSE(ec_enabled);
2655 // Turning delay agnostic aec back on should also turn on echo cancellation. 2666 // Turning delay agnostic aec back on should also turn on echo cancellation.
2656 options.delay_agnostic_aec.Set(true); 2667 options.delay_agnostic_aec.Set(true);
2657 ASSERT_TRUE(engine_.SetOptions(options)); 2668 ASSERT_TRUE(engine_.SetOptions(options));
2658 voe_.GetEcStatus(ec_enabled, ec_mode); 2669 voe_.GetEcStatus(ec_enabled, ec_mode);
2659 voe_.GetEcMetricsStatus(ec_metrics_enabled);
2660 EXPECT_TRUE(ec_enabled); 2670 EXPECT_TRUE(ec_enabled);
2661 EXPECT_TRUE(ec_metrics_enabled); 2671 EXPECT_TRUE(voe_.ec_metrics_enabled());
2662 EXPECT_EQ(ec_mode, webrtc::kEcConference); 2672 EXPECT_EQ(ec_mode, webrtc::kEcConference);
2663 2673
2664 // Turn off AGC 2674 // Turn off AGC
2665 options.auto_gain_control.Set(false); 2675 options.auto_gain_control.Set(false);
2666 ASSERT_TRUE(engine_.SetOptions(options)); 2676 ASSERT_TRUE(engine_.SetOptions(options));
2667 voe_.GetAgcStatus(agc_enabled, agc_mode); 2677 voe_.GetAgcStatus(agc_enabled, agc_mode);
2668 EXPECT_FALSE(agc_enabled); 2678 EXPECT_FALSE(agc_enabled);
2669 2679
2670 // Turn AGC back on 2680 // Turn AGC back on
2671 options.auto_gain_control.Set(true); 2681 options.auto_gain_control.Set(true);
(...skipping 27 matching lines...) Expand all
2699 EXPECT_EQ(webrtc::kEcConference, ec_mode); 2709 EXPECT_EQ(webrtc::kEcConference, ec_mode);
2700 EXPECT_FALSE(ns_enabled); 2710 EXPECT_FALSE(ns_enabled);
2701 EXPECT_EQ(webrtc::kNsHighSuppression, ns_mode); 2711 EXPECT_EQ(webrtc::kNsHighSuppression, ns_mode);
2702 } 2712 }
2703 2713
2704 TEST_F(WebRtcVoiceEngineTestFake, DefaultOptions) { 2714 TEST_F(WebRtcVoiceEngineTestFake, DefaultOptions) {
2705 EXPECT_TRUE(SetupEngineWithSendStream()); 2715 EXPECT_TRUE(SetupEngineWithSendStream());
2706 2716
2707 bool ec_enabled; 2717 bool ec_enabled;
2708 webrtc::EcModes ec_mode; 2718 webrtc::EcModes ec_mode;
2709 bool ec_metrics_enabled;
2710 bool agc_enabled; 2719 bool agc_enabled;
2711 webrtc::AgcModes agc_mode; 2720 webrtc::AgcModes agc_mode;
2712 bool ns_enabled; 2721 bool ns_enabled;
2713 webrtc::NsModes ns_mode; 2722 webrtc::NsModes ns_mode;
2714 bool highpass_filter_enabled; 2723 bool highpass_filter_enabled;
2715 bool stereo_swapping_enabled; 2724 bool stereo_swapping_enabled;
2716 bool typing_detection_enabled; 2725 bool typing_detection_enabled;
2717 2726
2718 voe_.GetEcStatus(ec_enabled, ec_mode); 2727 voe_.GetEcStatus(ec_enabled, ec_mode);
2719 voe_.GetEcMetricsStatus(ec_metrics_enabled);
2720 voe_.GetAgcStatus(agc_enabled, agc_mode); 2728 voe_.GetAgcStatus(agc_enabled, agc_mode);
2721 voe_.GetNsStatus(ns_enabled, ns_mode); 2729 voe_.GetNsStatus(ns_enabled, ns_mode);
2722 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); 2730 highpass_filter_enabled = voe_.IsHighPassFilterEnabled();
2723 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); 2731 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled();
2724 voe_.GetTypingDetectionStatus(typing_detection_enabled); 2732 voe_.GetTypingDetectionStatus(typing_detection_enabled);
2725 EXPECT_TRUE(ec_enabled); 2733 EXPECT_TRUE(ec_enabled);
2726 EXPECT_TRUE(agc_enabled); 2734 EXPECT_TRUE(agc_enabled);
2727 EXPECT_TRUE(ns_enabled); 2735 EXPECT_TRUE(ns_enabled);
2728 EXPECT_TRUE(highpass_filter_enabled); 2736 EXPECT_TRUE(highpass_filter_enabled);
2729 EXPECT_TRUE(typing_detection_enabled); 2737 EXPECT_TRUE(typing_detection_enabled);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 cricket::WebRtcVoiceEngine engine; 3292 cricket::WebRtcVoiceEngine engine;
3285 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3293 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3286 rtc::scoped_ptr<webrtc::Call> call( 3294 rtc::scoped_ptr<webrtc::Call> call(
3287 webrtc::Call::Create(webrtc::Call::Config())); 3295 webrtc::Call::Create(webrtc::Call::Config()));
3288 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), 3296 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(),
3289 call.get()); 3297 call.get());
3290 cricket::AudioRecvParameters parameters; 3298 cricket::AudioRecvParameters parameters;
3291 parameters.codecs = engine.codecs(); 3299 parameters.codecs = engine.codecs();
3292 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3300 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3293 } 3301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698