| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
| 11 #include "webrtc/audio/audio_send_stream.h" | 11 #include "webrtc/audio/audio_send_stream.h" |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "webrtc/audio/audio_state.h" | 15 #include "webrtc/audio/audio_state.h" |
| 16 #include "webrtc/audio/conversion.h" | 16 #include "webrtc/audio/conversion.h" |
| 17 #include "webrtc/audio/scoped_voe_interface.h" | 17 #include "webrtc/audio/scoped_voe_interface.h" |
| 18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/base/event.h" | 19 #include "webrtc/base/event.h" |
| 20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/task_queue.h" | 21 #include "webrtc/base/task_queue.h" |
| 22 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 22 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 23 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 23 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
| 24 #include "webrtc/modules/pacing/paced_sender.h" | 24 #include "webrtc/modules/pacing/paced_sender.h" |
| 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 26 #include "webrtc/voice_engine/channel_proxy.h" | 26 #include "webrtc/voice_engine/channel_proxy.h" |
| 27 #include "webrtc/voice_engine/include/voe_base.h" | 27 #include "webrtc/voice_engine/include/voe_base.h" |
| 28 #include "webrtc/voice_engine/include/voe_volume_control.h" | 28 #include "webrtc/voice_engine/transmit_mixer.h" |
| 29 #include "webrtc/voice_engine/voice_engine_impl.h" | 29 #include "webrtc/voice_engine/voice_engine_impl.h" |
| 30 | 30 |
| 31 namespace webrtc { | 31 namespace webrtc { |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 constexpr char kOpusCodecName[] = "opus"; | 35 constexpr char kOpusCodecName[] = "opus"; |
| 36 | 36 |
| 37 bool IsCodec(const webrtc::CodecInst& codec, const char* ref_name) { | 37 bool IsCodec(const webrtc::CodecInst& codec, const char* ref_name) { |
| 38 return (STR_CASE_CMP(codec.plname, ref_name) == 0); | 38 return (STR_CASE_CMP(codec.plname, ref_name) == 0); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // Convert samples to milliseconds. | 186 // Convert samples to milliseconds. |
| 187 if (codec_inst.plfreq / 1000 > 0) { | 187 if (codec_inst.plfreq / 1000 > 0) { |
| 188 stats.jitter_ms = | 188 stats.jitter_ms = |
| 189 block.interarrival_jitter / (codec_inst.plfreq / 1000); | 189 block.interarrival_jitter / (codec_inst.plfreq / 1000); |
| 190 } | 190 } |
| 191 break; | 191 break; |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Local speech level. | 196 ScopedVoEInterface<VoEBase> base(voice_engine()); |
| 197 { | 197 RTC_DCHECK(base->transmit_mixer()); |
| 198 ScopedVoEInterface<VoEVolumeControl> volume(voice_engine()); | 198 stats.audio_level = base->transmit_mixer()->AudioLevelFullRange(); |
| 199 unsigned int level = 0; | 199 RTC_DCHECK_LE(0, stats.audio_level); |
| 200 int error = volume->GetSpeechInputLevelFullRange(level); | |
| 201 RTC_DCHECK_EQ(0, error); | |
| 202 stats.audio_level = static_cast<int32_t>(level); | |
| 203 } | |
| 204 | 200 |
| 205 ScopedVoEInterface<VoEBase> base(voice_engine()); | |
| 206 RTC_DCHECK(base->audio_processing()); | 201 RTC_DCHECK(base->audio_processing()); |
| 207 auto audio_processing_stats = base->audio_processing()->GetStatistics(); | 202 auto audio_processing_stats = base->audio_processing()->GetStatistics(); |
| 208 stats.echo_delay_median_ms = audio_processing_stats.delay_median; | 203 stats.echo_delay_median_ms = audio_processing_stats.delay_median; |
| 209 stats.echo_delay_std_ms = audio_processing_stats.delay_standard_deviation; | 204 stats.echo_delay_std_ms = audio_processing_stats.delay_standard_deviation; |
| 210 stats.echo_return_loss = audio_processing_stats.echo_return_loss.instant(); | 205 stats.echo_return_loss = audio_processing_stats.echo_return_loss.instant(); |
| 211 stats.echo_return_loss_enhancement = | 206 stats.echo_return_loss_enhancement = |
| 212 audio_processing_stats.echo_return_loss_enhancement.instant(); | 207 audio_processing_stats.echo_return_loss_enhancement.instant(); |
| 213 stats.residual_echo_likelihood = | 208 stats.residual_echo_likelihood = |
| 214 audio_processing_stats.residual_echo_likelihood; | 209 audio_processing_stats.residual_echo_likelihood; |
| 215 stats.residual_echo_likelihood_recent_max = | 210 stats.residual_echo_likelihood_recent_max = |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 LOG(LS_WARNING) << "SetVADStatus() failed."; | 374 LOG(LS_WARNING) << "SetVADStatus() failed."; |
| 380 return false; | 375 return false; |
| 381 } | 376 } |
| 382 } | 377 } |
| 383 } | 378 } |
| 384 return true; | 379 return true; |
| 385 } | 380 } |
| 386 | 381 |
| 387 } // namespace internal | 382 } // namespace internal |
| 388 } // namespace webrtc | 383 } // namespace webrtc |
| OLD | NEW |