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

Side by Side Diff: talk/app/webrtc/statscollector.cc

Issue 1315413002: Wire up currently-received video codec to stats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 5 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 | « no previous file | talk/media/webrtc/webrtcvideoengine2.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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 } 102 }
103 103
104 void ExtractCommonSendProperties(const cricket::MediaSenderInfo& info, 104 void ExtractCommonSendProperties(const cricket::MediaSenderInfo& info,
105 StatsReport* report) { 105 StatsReport* report) {
106 report->AddString(StatsReport::kStatsValueNameCodecName, info.codec_name); 106 report->AddString(StatsReport::kStatsValueNameCodecName, info.codec_name);
107 report->AddInt64(StatsReport::kStatsValueNameBytesSent, info.bytes_sent); 107 report->AddInt64(StatsReport::kStatsValueNameBytesSent, info.bytes_sent);
108 report->AddInt64(StatsReport::kStatsValueNameRtt, info.rtt_ms); 108 report->AddInt64(StatsReport::kStatsValueNameRtt, info.rtt_ms);
109 } 109 }
110 110
111 void ExtractCommonReceiveProperties(const cricket::MediaReceiverInfo& info,
112 StatsReport* report) {
113 report->AddString(StatsReport::kStatsValueNameCodecName, info.codec_name);
114 }
115
111 void SetAudioProcessingStats(StatsReport* report, int signal_level, 116 void SetAudioProcessingStats(StatsReport* report, int signal_level,
112 bool typing_noise_detected, int echo_return_loss, 117 bool typing_noise_detected, int echo_return_loss,
113 int echo_return_loss_enhancement, int echo_delay_median_ms, 118 int echo_return_loss_enhancement, int echo_delay_median_ms,
114 float aec_quality_min, int echo_delay_std_ms) { 119 float aec_quality_min, int echo_delay_std_ms) {
115 report->AddBoolean(StatsReport::kStatsValueNameTypingNoiseState, 120 report->AddBoolean(StatsReport::kStatsValueNameTypingNoiseState,
116 typing_noise_detected); 121 typing_noise_detected);
117 report->AddFloat(StatsReport::kStatsValueNameEchoCancellationQualityMin, 122 report->AddFloat(StatsReport::kStatsValueNameEchoCancellationQualityMin,
118 aec_quality_min); 123 aec_quality_min);
119 // Don't overwrite the previous signal level if it's not available now. 124 // Don't overwrite the previous signal level if it's not available now.
120 if (signal_level >= 0) 125 if (signal_level >= 0)
121 report->AddInt(StatsReport::kStatsValueNameAudioInputLevel, signal_level); 126 report->AddInt(StatsReport::kStatsValueNameAudioInputLevel, signal_level);
122 const IntForAdd ints[] = { 127 const IntForAdd ints[] = {
123 { StatsReport::kStatsValueNameEchoReturnLoss, echo_return_loss }, 128 { StatsReport::kStatsValueNameEchoReturnLoss, echo_return_loss },
124 { StatsReport::kStatsValueNameEchoReturnLossEnhancement, 129 { StatsReport::kStatsValueNameEchoReturnLossEnhancement,
125 echo_return_loss_enhancement }, 130 echo_return_loss_enhancement },
126 { StatsReport::kStatsValueNameEchoDelayMedian, echo_delay_median_ms }, 131 { StatsReport::kStatsValueNameEchoDelayMedian, echo_delay_median_ms },
127 { StatsReport::kStatsValueNameEchoDelayStdDev, echo_delay_std_ms }, 132 { StatsReport::kStatsValueNameEchoDelayStdDev, echo_delay_std_ms },
128 }; 133 };
129 for (const auto& i : ints) 134 for (const auto& i : ints)
130 report->AddInt(i.name, i.value); 135 report->AddInt(i.name, i.value);
131 } 136 }
132 137
133 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) { 138 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) {
139 ExtractCommonReceiveProperties(info, report);
134 const FloatForAdd floats[] = { 140 const FloatForAdd floats[] = {
135 { StatsReport::kStatsValueNameExpandRate, info.expand_rate }, 141 { StatsReport::kStatsValueNameExpandRate, info.expand_rate },
136 { StatsReport::kStatsValueNameSecondaryDecodedRate, 142 { StatsReport::kStatsValueNameSecondaryDecodedRate,
137 info.secondary_decoded_rate }, 143 info.secondary_decoded_rate },
138 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate }, 144 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate },
139 { StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate }, 145 { StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate },
140 { StatsReport::kStatsValueNamePreemptiveExpandRate, 146 { StatsReport::kStatsValueNamePreemptiveExpandRate,
141 info.preemptive_expand_rate }, 147 info.preemptive_expand_rate },
142 }; 148 };
143 149
(...skipping 18 matching lines...) Expand all
162 for (const auto& f : floats) 168 for (const auto& f : floats)
163 report->AddFloat(f.name, f.value); 169 report->AddFloat(f.name, f.value);
164 170
165 for (const auto& i : ints) 171 for (const auto& i : ints)
166 report->AddInt(i.name, i.value); 172 report->AddInt(i.name, i.value);
167 173
168 report->AddInt64(StatsReport::kStatsValueNameBytesReceived, 174 report->AddInt64(StatsReport::kStatsValueNameBytesReceived,
169 info.bytes_rcvd); 175 info.bytes_rcvd);
170 report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs, 176 report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs,
171 info.capture_start_ntp_time_ms); 177 info.capture_start_ntp_time_ms);
172
173 report->AddString(StatsReport::kStatsValueNameCodecName, info.codec_name);
174 } 178 }
175 179
176 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) { 180 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) {
177 ExtractCommonSendProperties(info, report); 181 ExtractCommonSendProperties(info, report);
178 182
179 SetAudioProcessingStats(report, info.audio_level, info.typing_noise_detected, 183 SetAudioProcessingStats(report, info.audio_level, info.typing_noise_detected,
180 info.echo_return_loss, info.echo_return_loss_enhancement, 184 info.echo_return_loss, info.echo_return_loss_enhancement,
181 info.echo_delay_median_ms, info.aec_quality_min, info.echo_delay_std_ms); 185 info.echo_delay_median_ms, info.aec_quality_min, info.echo_delay_std_ms);
182 186
183 const IntForAdd ints[] = { 187 const IntForAdd ints[] = {
184 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms }, 188 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms },
185 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost }, 189 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost },
186 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent }, 190 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent },
187 }; 191 };
188 192
189 for (const auto& i : ints) 193 for (const auto& i : ints)
190 report->AddInt(i.name, i.value); 194 report->AddInt(i.name, i.value);
191 } 195 }
192 196
193 void ExtractStats(const cricket::VideoReceiverInfo& info, StatsReport* report) { 197 void ExtractStats(const cricket::VideoReceiverInfo& info, StatsReport* report) {
198 ExtractCommonReceiveProperties(info, report);
194 report->AddInt64(StatsReport::kStatsValueNameBytesReceived, 199 report->AddInt64(StatsReport::kStatsValueNameBytesReceived,
195 info.bytes_rcvd); 200 info.bytes_rcvd);
196 report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs, 201 report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs,
197 info.capture_start_ntp_time_ms); 202 info.capture_start_ntp_time_ms);
198 const IntForAdd ints[] = { 203 const IntForAdd ints[] = {
199 { StatsReport::kStatsValueNameCurrentDelayMs, info.current_delay_ms }, 204 { StatsReport::kStatsValueNameCurrentDelayMs, info.current_delay_ms },
200 { StatsReport::kStatsValueNameDecodeMs, info.decode_ms }, 205 { StatsReport::kStatsValueNameDecodeMs, info.decode_ms },
201 { StatsReport::kStatsValueNameFirsSent, info.firs_sent }, 206 { StatsReport::kStatsValueNameFirsSent, info.firs_sent },
202 { StatsReport::kStatsValueNameFrameHeightReceived, info.frame_height }, 207 { StatsReport::kStatsValueNameFrameHeightReceived, info.frame_height },
203 { StatsReport::kStatsValueNameFrameRateDecoded, info.framerate_decoded }, 208 { StatsReport::kStatsValueNameFrameRateDecoded, info.framerate_decoded },
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 report->set_timestamp(stats_gathering_started_); 940 report->set_timestamp(stats_gathering_started_);
936 } 941 }
937 942
938 } 943 }
939 944
940 void StatsCollector::ClearUpdateStatsCacheForTest() { 945 void StatsCollector::ClearUpdateStatsCacheForTest() {
941 stats_gathering_started_ = 0; 946 stats_gathering_started_ = 0;
942 } 947 }
943 948
944 } // namespace webrtc 949 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvideoengine2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698