| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 StatsReport* report) { | 96 StatsReport* report) { |
| 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 report->AddBoolean(StatsReport::kStatsValueNameTypingNoiseState, | 108 report->AddBoolean(StatsReport::kStatsValueNameTypingNoiseState, |
| 108 typing_noise_detected); | 109 typing_noise_detected); |
| 109 if (aec_quality_min >= 0.0f) { | 110 if (aec_quality_min >= 0.0f) { |
| 110 report->AddFloat(StatsReport::kStatsValueNameEchoCancellationQualityMin, | 111 report->AddFloat(StatsReport::kStatsValueNameEchoCancellationQualityMin, |
| 111 aec_quality_min); | 112 aec_quality_min); |
| 112 } | 113 } |
| 113 const IntForAdd ints[] = { | 114 const IntForAdd ints[] = { |
| 114 { StatsReport::kStatsValueNameEchoDelayMedian, echo_delay_median_ms }, | 115 { StatsReport::kStatsValueNameEchoDelayMedian, echo_delay_median_ms }, |
| 115 { StatsReport::kStatsValueNameEchoDelayStdDev, echo_delay_std_ms }, | 116 { StatsReport::kStatsValueNameEchoDelayStdDev, echo_delay_std_ms }, |
| 116 }; | 117 }; |
| 117 for (const auto& i : ints) { | 118 for (const auto& i : ints) { |
| 118 if (i.value >= 0) { | 119 if (i.value >= 0) { |
| 119 report->AddInt(i.name, i.value); | 120 report->AddInt(i.name, i.value); |
| 120 } | 121 } |
| 121 } | 122 } |
| 122 // These can take on valid negative values. | 123 // These can take on valid negative values. |
| 123 report->AddInt(StatsReport::kStatsValueNameEchoReturnLoss, echo_return_loss); | 124 report->AddInt(StatsReport::kStatsValueNameEchoReturnLoss, echo_return_loss); |
| 124 report->AddInt(StatsReport::kStatsValueNameEchoReturnLossEnhancement, | 125 report->AddInt(StatsReport::kStatsValueNameEchoReturnLossEnhancement, |
| 125 echo_return_loss_enhancement); | 126 echo_return_loss_enhancement); |
| 127 if (residual_echo_likelihood >= 0.0f) { |
| 128 report->AddFloat(StatsReport::kStatsValueNameResidualEchoLikelihood, |
| 129 residual_echo_likelihood); |
| 130 } |
| 126 } | 131 } |
| 127 | 132 |
| 128 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) { | 133 void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) { |
| 129 ExtractCommonReceiveProperties(info, report); | 134 ExtractCommonReceiveProperties(info, report); |
| 130 const FloatForAdd floats[] = { | 135 const FloatForAdd floats[] = { |
| 131 { StatsReport::kStatsValueNameExpandRate, info.expand_rate }, | 136 { StatsReport::kStatsValueNameExpandRate, info.expand_rate }, |
| 132 { StatsReport::kStatsValueNameSecondaryDecodedRate, | 137 { StatsReport::kStatsValueNameSecondaryDecodedRate, |
| 133 info.secondary_decoded_rate }, | 138 info.secondary_decoded_rate }, |
| 134 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate }, | 139 { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate }, |
| 135 { StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate }, | 140 { StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 179 } |
| 175 report->AddString(StatsReport::kStatsValueNameMediaType, "audio"); | 180 report->AddString(StatsReport::kStatsValueNameMediaType, "audio"); |
| 176 } | 181 } |
| 177 | 182 |
| 178 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) { | 183 void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) { |
| 179 ExtractCommonSendProperties(info, report); | 184 ExtractCommonSendProperties(info, report); |
| 180 | 185 |
| 181 SetAudioProcessingStats( | 186 SetAudioProcessingStats( |
| 182 report, info.typing_noise_detected, info.echo_return_loss, | 187 report, info.typing_noise_detected, info.echo_return_loss, |
| 183 info.echo_return_loss_enhancement, info.echo_delay_median_ms, | 188 info.echo_return_loss_enhancement, info.echo_delay_median_ms, |
| 184 info.aec_quality_min, info.echo_delay_std_ms); | 189 info.aec_quality_min, info.echo_delay_std_ms, |
| 190 info.residual_echo_likelihood); |
| 185 | 191 |
| 186 RTC_DCHECK_GE(info.audio_level, 0); | 192 RTC_DCHECK_GE(info.audio_level, 0); |
| 187 const IntForAdd ints[] = { | 193 const IntForAdd ints[] = { |
| 188 { StatsReport::kStatsValueNameAudioInputLevel, info.audio_level}, | 194 { StatsReport::kStatsValueNameAudioInputLevel, info.audio_level}, |
| 189 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms }, | 195 { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms }, |
| 190 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost }, | 196 { StatsReport::kStatsValueNamePacketsLost, info.packets_lost }, |
| 191 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent }, | 197 { StatsReport::kStatsValueNamePacketsSent, info.packets_sent }, |
| 192 }; | 198 }; |
| 193 | 199 |
| 194 for (const auto& i : ints) { | 200 for (const auto& i : ints) { |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 925 |
| 920 auto audio_processor(track->GetAudioProcessor()); | 926 auto audio_processor(track->GetAudioProcessor()); |
| 921 | 927 |
| 922 if (audio_processor.get()) { | 928 if (audio_processor.get()) { |
| 923 AudioProcessorInterface::AudioProcessorStats stats; | 929 AudioProcessorInterface::AudioProcessorStats stats; |
| 924 audio_processor->GetStats(&stats); | 930 audio_processor->GetStats(&stats); |
| 925 | 931 |
| 926 SetAudioProcessingStats( | 932 SetAudioProcessingStats( |
| 927 report, stats.typing_noise_detected, stats.echo_return_loss, | 933 report, stats.typing_noise_detected, stats.echo_return_loss, |
| 928 stats.echo_return_loss_enhancement, stats.echo_delay_median_ms, | 934 stats.echo_return_loss_enhancement, stats.echo_delay_median_ms, |
| 929 stats.aec_quality_min, stats.echo_delay_std_ms); | 935 stats.aec_quality_min, stats.echo_delay_std_ms, |
| 936 stats.residual_echo_likelihood); |
| 930 | 937 |
| 931 report->AddFloat(StatsReport::kStatsValueNameAecDivergentFilterFraction, | 938 report->AddFloat(StatsReport::kStatsValueNameAecDivergentFilterFraction, |
| 932 stats.aec_divergent_filter_fraction); | 939 stats.aec_divergent_filter_fraction); |
| 933 } | 940 } |
| 934 } | 941 } |
| 935 | 942 |
| 936 bool StatsCollector::GetTrackIdBySsrc(uint32_t ssrc, | 943 bool StatsCollector::GetTrackIdBySsrc(uint32_t ssrc, |
| 937 std::string* track_id, | 944 std::string* track_id, |
| 938 StatsReport::Direction direction) { | 945 StatsReport::Direction direction) { |
| 939 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); | 946 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 964 StatsReport* report = entry.second; | 971 StatsReport* report = entry.second; |
| 965 report->set_timestamp(stats_gathering_started_); | 972 report->set_timestamp(stats_gathering_started_); |
| 966 } | 973 } |
| 967 } | 974 } |
| 968 | 975 |
| 969 void StatsCollector::ClearUpdateStatsCacheForTest() { | 976 void StatsCollector::ClearUpdateStatsCacheForTest() { |
| 970 stats_gathering_started_ = 0; | 977 stats_gathering_started_ = 0; |
| 971 } | 978 } |
| 972 | 979 |
| 973 } // namespace webrtc | 980 } // namespace webrtc |
| OLD | NEW |