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

Side by Side Diff: webrtc/pc/statscollector.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/pc/rtcstatscollector_unittest.cc ('k') | webrtc/stats/rtcstats_objects.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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) { 139 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) {
140 ExtractCommonReceiveProperties(info, report); 140 ExtractCommonReceiveProperties(info, report);
141 const FloatForAdd floats[] = { 141 const FloatForAdd floats[] = {
142 { StatsReport::kStatsValueNameExpandRate, info.expand_rate }, 142 { StatsReport::kStatsValueNameExpandRate, info.expand_rate },
143 { StatsReport::kStatsValueNameSecondaryDecodedRate, 143 { StatsReport::kStatsValueNameSecondaryDecodedRate,
144 info.secondary_decoded_rate }, 144 info.secondary_decoded_rate },
145 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate }, 145 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate },
146 { StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate }, 146 { StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate },
147 { StatsReport::kStatsValueNamePreemptiveExpandRate, 147 { StatsReport::kStatsValueNamePreemptiveExpandRate,
148 info.preemptive_expand_rate }, 148 info.preemptive_expand_rate },
149 { StatsReport::kStatsValueNameTotalAudioEnergy, info.total_output_energy },
150 { StatsReport::kStatsValueNameTotalSamplesDuration,
151 info.total_output_duration }
149 }; 152 };
150 153
151 const IntForAdd ints[] = { 154 const IntForAdd ints[] = {
152 { StatsReport::kStatsValueNameCurrentDelayMs, info.delay_estimate_ms }, 155 { StatsReport::kStatsValueNameCurrentDelayMs, info.delay_estimate_ms },
153 { StatsReport::kStatsValueNameDecodingCNG, info.decoding_cng }, 156 { StatsReport::kStatsValueNameDecodingCNG, info.decoding_cng },
154 { StatsReport::kStatsValueNameDecodingCTN, info.decoding_calls_to_neteq }, 157 { StatsReport::kStatsValueNameDecodingCTN, info.decoding_calls_to_neteq },
155 { StatsReport::kStatsValueNameDecodingCTSG, 158 { StatsReport::kStatsValueNameDecodingCTSG,
156 info.decoding_calls_to_silence_generator }, 159 info.decoding_calls_to_silence_generator },
157 { StatsReport::kStatsValueNameDecodingMutedOutput, 160 { StatsReport::kStatsValueNameDecodingMutedOutput,
158 info.decoding_muted_output }, 161 info.decoding_muted_output },
(...skipping 29 matching lines...) Expand all
188 191
189 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) { 192 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) {
190 ExtractCommonSendProperties(info, report); 193 ExtractCommonSendProperties(info, report);
191 194
192 SetAudioProcessingStats( 195 SetAudioProcessingStats(
193 report, info.typing_noise_detected, info.echo_return_loss, 196 report, info.typing_noise_detected, info.echo_return_loss,
194 info.echo_return_loss_enhancement, info.echo_delay_median_ms, 197 info.echo_return_loss_enhancement, info.echo_delay_median_ms,
195 info.aec_quality_min, info.echo_delay_std_ms, 198 info.aec_quality_min, info.echo_delay_std_ms,
196 info.residual_echo_likelihood, info.residual_echo_likelihood_recent_max); 199 info.residual_echo_likelihood, info.residual_echo_likelihood_recent_max);
197 200
201 const FloatForAdd floats[] = {
202 { StatsReport::kStatsValueNameTotalAudioEnergy, info.total_input_energy },
203 { StatsReport::kStatsValueNameTotalSamplesDuration,
204 info.total_input_duration }
205 };
206
198 RTC_DCHECK_GE(info.audio_level, 0); 207 RTC_DCHECK_GE(info.audio_level, 0);
199 const IntForAdd ints[] = { 208 const IntForAdd ints[] = {
200 { StatsReport::kStatsValueNameAudioInputLevel, info.audio_level}, 209 { StatsReport::kStatsValueNameAudioInputLevel, info.audio_level},
201 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms }, 210 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms },
202 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost }, 211 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost },
203 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent }, 212 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent },
204 }; 213 };
205 214
215 for (const auto& f : floats) {
216 report->AddFloat(f.name, f.value);
217 }
218
206 for (const auto& i : ints) { 219 for (const auto& i : ints) {
207 if (i.value >= 0) { 220 if (i.value >= 0) {
208 report->AddInt(i.name, i.value); 221 report->AddInt(i.name, i.value);
209 } 222 }
210 } 223 }
211 report->AddString(StatsReport::kStatsValueNameMediaType, "audio"); 224 report->AddString(StatsReport::kStatsValueNameMediaType, "audio");
212 } 225 }
213 226
214 void ExtractStats(const cricket::VideoReceiverInfo& info, StatsReport* report) { 227 void ExtractStats(const cricket::VideoReceiverInfo& info, StatsReport* report) {
215 ExtractCommonReceiveProperties(info, report); 228 ExtractCommonReceiveProperties(info, report);
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 StatsReport* report = entry.second; 1016 StatsReport* report = entry.second;
1004 report->set_timestamp(stats_gathering_started_); 1017 report->set_timestamp(stats_gathering_started_);
1005 } 1018 }
1006 } 1019 }
1007 1020
1008 void StatsCollector::ClearUpdateStatsCacheForTest() { 1021 void StatsCollector::ClearUpdateStatsCacheForTest() {
1009 stats_gathering_started_ = 0; 1022 stats_gathering_started_ = 0;
1010 } 1023 }
1011 1024
1012 } // namespace webrtc 1025 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/rtcstatscollector_unittest.cc ('k') | webrtc/stats/rtcstats_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698