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

Side by Side Diff: webrtc/api/statscollector.cc

Issue 2629563003: Added a new echo likelihood stat that reports the maximum value from a previous time period. (Closed)
Patch Set: Small bugfix. Created 3 years, 11 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/api/mediastreaminterface.h ('k') | webrtc/api/statscollector_unittest.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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 report->AddString(StatsReport::kStatsValueNameCodecName, info.codec_name); 97 report->AddString(StatsReport::kStatsValueNameCodecName, info.codec_name);
98 } 98 }
99 99
100 void SetAudioProcessingStats(StatsReport* report, 100 void SetAudioProcessingStats(StatsReport* report,
101 bool typing_noise_detected, 101 bool typing_noise_detected,
102 int echo_return_loss, 102 int echo_return_loss,
103 int echo_return_loss_enhancement, 103 int echo_return_loss_enhancement,
104 int echo_delay_median_ms, 104 int echo_delay_median_ms,
105 float aec_quality_min, 105 float aec_quality_min,
106 int echo_delay_std_ms, 106 int echo_delay_std_ms,
107 float residual_echo_likelihood) { 107 float residual_echo_likelihood,
108 float residual_echo_likelihood_recent_max) {
108 report->AddBoolean(StatsReport::kStatsValueNameTypingNoiseState, 109 report->AddBoolean(StatsReport::kStatsValueNameTypingNoiseState,
109 typing_noise_detected); 110 typing_noise_detected);
110 if (aec_quality_min >= 0.0f) { 111 if (aec_quality_min >= 0.0f) {
111 report->AddFloat(StatsReport::kStatsValueNameEchoCancellationQualityMin, 112 report->AddFloat(StatsReport::kStatsValueNameEchoCancellationQualityMin,
112 aec_quality_min); 113 aec_quality_min);
113 } 114 }
114 const IntForAdd ints[] = { 115 const IntForAdd ints[] = {
115 { StatsReport::kStatsValueNameEchoDelayMedian, echo_delay_median_ms }, 116 { StatsReport::kStatsValueNameEchoDelayMedian, echo_delay_median_ms },
116 { StatsReport::kStatsValueNameEchoDelayStdDev, echo_delay_std_ms }, 117 { StatsReport::kStatsValueNameEchoDelayStdDev, echo_delay_std_ms },
117 }; 118 };
118 for (const auto& i : ints) { 119 for (const auto& i : ints) {
119 if (i.value >= 0) { 120 if (i.value >= 0) {
120 report->AddInt(i.name, i.value); 121 report->AddInt(i.name, i.value);
121 } 122 }
122 } 123 }
123 // These can take on valid negative values. 124 // These can take on valid negative values.
124 report->AddInt(StatsReport::kStatsValueNameEchoReturnLoss, echo_return_loss); 125 report->AddInt(StatsReport::kStatsValueNameEchoReturnLoss, echo_return_loss);
125 report->AddInt(StatsReport::kStatsValueNameEchoReturnLossEnhancement, 126 report->AddInt(StatsReport::kStatsValueNameEchoReturnLossEnhancement,
126 echo_return_loss_enhancement); 127 echo_return_loss_enhancement);
127 if (residual_echo_likelihood >= 0.0f) { 128 if (residual_echo_likelihood >= 0.0f) {
128 report->AddFloat(StatsReport::kStatsValueNameResidualEchoLikelihood, 129 report->AddFloat(StatsReport::kStatsValueNameResidualEchoLikelihood,
129 residual_echo_likelihood); 130 residual_echo_likelihood);
131 report->AddFloat(
hbos 2017/01/16 11:29:49 This can leak the default residual_echo_likelihood
hbos 2017/01/16 11:36:54 If the stat is optional, prefer rtc::Optional to -
hlundin-webrtc 2017/01/16 13:44:56 I'm making a minimal fix for now in https://codere
132 StatsReport::kStatsValueNameResidualEchoLikelihoodRecentMax,
133 residual_echo_likelihood_recent_max);
130 } 134 }
131 } 135 }
132 136
133 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) { 137 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) {
134 ExtractCommonReceiveProperties(info, report); 138 ExtractCommonReceiveProperties(info, report);
135 const FloatForAdd floats[] = { 139 const FloatForAdd floats[] = {
136 { StatsReport::kStatsValueNameExpandRate, info.expand_rate }, 140 { StatsReport::kStatsValueNameExpandRate, info.expand_rate },
137 { StatsReport::kStatsValueNameSecondaryDecodedRate, 141 { StatsReport::kStatsValueNameSecondaryDecodedRate,
138 info.secondary_decoded_rate }, 142 info.secondary_decoded_rate },
139 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate }, 143 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate },
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 report->AddString(StatsReport::kStatsValueNameMediaType, "audio"); 184 report->AddString(StatsReport::kStatsValueNameMediaType, "audio");
181 } 185 }
182 186
183 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) { 187 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) {
184 ExtractCommonSendProperties(info, report); 188 ExtractCommonSendProperties(info, report);
185 189
186 SetAudioProcessingStats( 190 SetAudioProcessingStats(
187 report, info.typing_noise_detected, info.echo_return_loss, 191 report, info.typing_noise_detected, info.echo_return_loss,
188 info.echo_return_loss_enhancement, info.echo_delay_median_ms, 192 info.echo_return_loss_enhancement, info.echo_delay_median_ms,
189 info.aec_quality_min, info.echo_delay_std_ms, 193 info.aec_quality_min, info.echo_delay_std_ms,
190 info.residual_echo_likelihood); 194 info.residual_echo_likelihood, info.residual_echo_likelihood_recent_max);
191 195
192 RTC_DCHECK_GE(info.audio_level, 0); 196 RTC_DCHECK_GE(info.audio_level, 0);
193 const IntForAdd ints[] = { 197 const IntForAdd ints[] = {
194 { StatsReport::kStatsValueNameAudioInputLevel, info.audio_level}, 198 { StatsReport::kStatsValueNameAudioInputLevel, info.audio_level},
195 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms }, 199 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms },
196 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost }, 200 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost },
197 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent }, 201 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent },
198 }; 202 };
199 203
200 for (const auto& i : ints) { 204 for (const auto& i : ints) {
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 auto audio_processor(track->GetAudioProcessor()); 937 auto audio_processor(track->GetAudioProcessor());
934 938
935 if (audio_processor.get()) { 939 if (audio_processor.get()) {
936 AudioProcessorInterface::AudioProcessorStats stats; 940 AudioProcessorInterface::AudioProcessorStats stats;
937 audio_processor->GetStats(&stats); 941 audio_processor->GetStats(&stats);
938 942
939 SetAudioProcessingStats( 943 SetAudioProcessingStats(
940 report, stats.typing_noise_detected, stats.echo_return_loss, 944 report, stats.typing_noise_detected, stats.echo_return_loss,
941 stats.echo_return_loss_enhancement, stats.echo_delay_median_ms, 945 stats.echo_return_loss_enhancement, stats.echo_delay_median_ms,
942 stats.aec_quality_min, stats.echo_delay_std_ms, 946 stats.aec_quality_min, stats.echo_delay_std_ms,
943 stats.residual_echo_likelihood); 947 stats.residual_echo_likelihood,
948 stats.residual_echo_likelihood_recent_max);
944 949
945 report->AddFloat(StatsReport::kStatsValueNameAecDivergentFilterFraction, 950 report->AddFloat(StatsReport::kStatsValueNameAecDivergentFilterFraction,
946 stats.aec_divergent_filter_fraction); 951 stats.aec_divergent_filter_fraction);
947 } 952 }
948 } 953 }
949 954
950 bool StatsCollector::GetTrackIdBySsrc(uint32_t ssrc, 955 bool StatsCollector::GetTrackIdBySsrc(uint32_t ssrc,
951 std::string* track_id, 956 std::string* track_id,
952 StatsReport::Direction direction) { 957 StatsReport::Direction direction) {
953 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); 958 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent());
(...skipping 24 matching lines...) Expand all
978 StatsReport* report = entry.second; 983 StatsReport* report = entry.second;
979 report->set_timestamp(stats_gathering_started_); 984 report->set_timestamp(stats_gathering_started_);
980 } 985 }
981 } 986 }
982 987
983 void StatsCollector::ClearUpdateStatsCacheForTest() { 988 void StatsCollector::ClearUpdateStatsCacheForTest() {
984 stats_gathering_started_ = 0; 989 stats_gathering_started_ = 0;
985 } 990 }
986 991
987 } // namespace webrtc 992 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/mediastreaminterface.h ('k') | webrtc/api/statscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698