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

Side by Side Diff: webrtc/pc/statscollector_unittest.cc

Issue 3011623002: Add new ANA stats to GetStats() to count the number of actions taken by each controller. (Closed)
Patch Set: Fix for failing test. Created 3 years, 3 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/pc/statscollector.cc ('k') | webrtc/test/mock_voe_channel_proxy.h » ('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 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2014 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 &value_in_report)); 423 &value_in_report));
424 EXPECT_EQ(rtc::ToString<float>(sinfo.residual_echo_likelihood_recent_max), 424 EXPECT_EQ(rtc::ToString<float>(sinfo.residual_echo_likelihood_recent_max),
425 value_in_report); 425 value_in_report);
426 EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameAudioInputLevel, 426 EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameAudioInputLevel,
427 &value_in_report)); 427 &value_in_report));
428 EXPECT_EQ(rtc::ToString<int>(sinfo.audio_level), value_in_report); 428 EXPECT_EQ(rtc::ToString<int>(sinfo.audio_level), value_in_report);
429 EXPECT_TRUE(GetValue( 429 EXPECT_TRUE(GetValue(
430 report, StatsReport::kStatsValueNameTypingNoiseState, &value_in_report)); 430 report, StatsReport::kStatsValueNameTypingNoiseState, &value_in_report));
431 std::string typing_detected = sinfo.typing_noise_detected ? "true" : "false"; 431 std::string typing_detected = sinfo.typing_noise_detected ? "true" : "false";
432 EXPECT_EQ(typing_detected, value_in_report); 432 EXPECT_EQ(typing_detected, value_in_report);
433 EXPECT_TRUE(GetValue(report,
434 StatsReport::kStatsValueNameAnaBitrateActionCounter,
435 &value_in_report));
436 ASSERT_TRUE(sinfo.ana_statistics.bitrate_action_counter);
437 EXPECT_EQ(
438 rtc::ToString<uint32_t>(*sinfo.ana_statistics.bitrate_action_counter),
439 value_in_report);
440 EXPECT_TRUE(GetValue(report,
441 StatsReport::kStatsValueNameAnaChannelActionCounter,
442 &value_in_report));
443 ASSERT_TRUE(sinfo.ana_statistics.channel_action_counter);
444 EXPECT_EQ(
445 rtc::ToString<uint32_t>(*sinfo.ana_statistics.channel_action_counter),
446 value_in_report);
447 EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameAnaDtxActionCounter,
448 &value_in_report));
449 ASSERT_TRUE(sinfo.ana_statistics.dtx_action_counter);
450 EXPECT_EQ(rtc::ToString<uint32_t>(*sinfo.ana_statistics.dtx_action_counter),
451 value_in_report);
452 EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameAnaFecActionCounter,
453 &value_in_report));
454 ASSERT_TRUE(sinfo.ana_statistics.fec_action_counter);
455 EXPECT_EQ(rtc::ToString<uint32_t>(*sinfo.ana_statistics.fec_action_counter),
456 value_in_report);
457 EXPECT_TRUE(GetValue(report,
458 StatsReport::kStatsValueNameAnaFrameLengthActionCounter,
459 &value_in_report));
460 ASSERT_TRUE(sinfo.ana_statistics.frame_length_action_counter);
461 EXPECT_EQ(rtc::ToString<uint32_t>(
462 *sinfo.ana_statistics.frame_length_action_counter),
463 value_in_report);
433 } 464 }
434 465
435 // Helper methods to avoid duplication of code. 466 // Helper methods to avoid duplication of code.
436 void InitVoiceSenderInfo(cricket::VoiceSenderInfo* voice_sender_info) { 467 void InitVoiceSenderInfo(cricket::VoiceSenderInfo* voice_sender_info) {
437 voice_sender_info->add_ssrc(kSsrcOfTrack); 468 voice_sender_info->add_ssrc(kSsrcOfTrack);
438 voice_sender_info->codec_name = "fake_codec"; 469 voice_sender_info->codec_name = "fake_codec";
439 voice_sender_info->bytes_sent = 100; 470 voice_sender_info->bytes_sent = 100;
440 voice_sender_info->packets_sent = 101; 471 voice_sender_info->packets_sent = 101;
441 voice_sender_info->rtt_ms = 102; 472 voice_sender_info->rtt_ms = 102;
442 voice_sender_info->fraction_lost = 103; 473 voice_sender_info->fraction_lost = 103;
443 voice_sender_info->jitter_ms = 104; 474 voice_sender_info->jitter_ms = 104;
444 voice_sender_info->packets_lost = 105; 475 voice_sender_info->packets_lost = 105;
445 voice_sender_info->ext_seqnum = 106; 476 voice_sender_info->ext_seqnum = 106;
446 voice_sender_info->audio_level = 107; 477 voice_sender_info->audio_level = 107;
447 voice_sender_info->echo_return_loss = 108; 478 voice_sender_info->echo_return_loss = 108;
448 voice_sender_info->echo_return_loss_enhancement = 109; 479 voice_sender_info->echo_return_loss_enhancement = 109;
449 voice_sender_info->echo_delay_median_ms = 110; 480 voice_sender_info->echo_delay_median_ms = 110;
450 voice_sender_info->echo_delay_std_ms = 111; 481 voice_sender_info->echo_delay_std_ms = 111;
451 voice_sender_info->aec_quality_min = 112.0f; 482 voice_sender_info->aec_quality_min = 112.0f;
452 voice_sender_info->typing_noise_detected = false; 483 voice_sender_info->typing_noise_detected = false;
484 voice_sender_info->ana_statistics.bitrate_action_counter =
485 rtc::Optional<uint32_t>(113);
486 voice_sender_info->ana_statistics.channel_action_counter =
487 rtc::Optional<uint32_t>(114);
488 voice_sender_info->ana_statistics.dtx_action_counter =
489 rtc::Optional<uint32_t>(115);
490 voice_sender_info->ana_statistics.fec_action_counter =
491 rtc::Optional<uint32_t>(116);
492 voice_sender_info->ana_statistics.frame_length_action_counter =
493 rtc::Optional<uint32_t>(117);
453 } 494 }
454 495
455 void UpdateVoiceSenderInfoFromAudioTrack( 496 void UpdateVoiceSenderInfoFromAudioTrack(
456 AudioTrackInterface* audio_track, 497 AudioTrackInterface* audio_track,
457 cricket::VoiceSenderInfo* voice_sender_info) { 498 cricket::VoiceSenderInfo* voice_sender_info) {
458 audio_track->GetSignalLevel(&voice_sender_info->audio_level); 499 audio_track->GetSignalLevel(&voice_sender_info->audio_level);
459 webrtc::AudioProcessorInterface::AudioProcessorStats audio_processor_stats; 500 webrtc::AudioProcessorInterface::AudioProcessorStats audio_processor_stats;
460 audio_track->GetAudioProcessor()->GetStats(&audio_processor_stats); 501 audio_track->GetAudioProcessor()->GetStats(&audio_processor_stats);
461 voice_sender_info->typing_noise_detected = 502 voice_sender_info->typing_noise_detected =
462 audio_processor_stats.typing_noise_detected; 503 audio_processor_stats.typing_noise_detected;
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 cricket::VoiceChannel voice_channel( 2022 cricket::VoiceChannel voice_channel(
1982 worker_thread_, network_thread_, nullptr, media_engine_, media_channel, 2023 worker_thread_, network_thread_, nullptr, media_engine_, media_channel,
1983 kVcName, kDefaultRtcpMuxRequired, kDefaultSrtpRequired); 2024 kVcName, kDefaultRtcpMuxRequired, kDefaultSrtpRequired);
1984 2025
1985 // Create a local stream with a local audio track and adds it to the stats. 2026 // Create a local stream with a local audio track and adds it to the stats.
1986 AddOutgoingAudioTrackStats(); 2027 AddOutgoingAudioTrackStats();
1987 stats.AddStream(stream_); 2028 stats.AddStream(stream_);
1988 stats.AddLocalAudioTrack(audio_track_, kSsrcOfTrack); 2029 stats.AddLocalAudioTrack(audio_track_, kSsrcOfTrack);
1989 2030
1990 cricket::VoiceSenderInfo voice_sender_info; 2031 cricket::VoiceSenderInfo voice_sender_info;
2032 InitVoiceSenderInfo(&voice_sender_info);
1991 voice_sender_info.add_ssrc(kSsrcOfTrack); 2033 voice_sender_info.add_ssrc(kSsrcOfTrack);
1992 2034
1993 cricket::VoiceMediaInfo stats_read; 2035 cricket::VoiceMediaInfo stats_read;
1994 StatsReports reports; // returned values. 2036 StatsReports reports; // returned values.
1995 SetupAndVerifyAudioTrackStats( 2037 SetupAndVerifyAudioTrackStats(
1996 audio_track_.get(), stream_.get(), &stats, &voice_channel, kVcName, 2038 audio_track_.get(), stream_.get(), &stats, &voice_channel, kVcName,
1997 media_channel, &voice_sender_info, NULL, &stats_read, &reports); 2039 media_channel, &voice_sender_info, NULL, &stats_read, &reports);
1998 2040
1999 // Remove the previous audio track from the stream. 2041 // Remove the previous audio track from the stream.
2000 stream_->RemoveTrack(audio_track_.get()); 2042 stream_->RemoveTrack(audio_track_.get());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); 2151 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
2110 stats.GetStats(NULL, &reports); 2152 stats.GetStats(NULL, &reports);
2111 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), 2153 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded),
2112 ExtractSsrcStatsValue(reports, 2154 ExtractSsrcStatsValue(reports,
2113 StatsReport::kStatsValueNameFramesDecoded)); 2155 StatsReport::kStatsValueNameFramesDecoded));
2114 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum), 2156 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum),
2115 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum)); 2157 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum));
2116 } 2158 }
2117 2159
2118 } // namespace webrtc 2160 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/statscollector.cc ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698