| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 170       fwd_proc_format_(kSampleRate16kHz), | 170       fwd_proc_format_(kSampleRate16kHz), | 
| 171       fwd_out_format_(kSampleRate16kHz, 1), | 171       fwd_out_format_(kSampleRate16kHz, 1), | 
| 172       rev_in_format_(kSampleRate16kHz, 1), | 172       rev_in_format_(kSampleRate16kHz, 1), | 
| 173       rev_proc_format_(kSampleRate16kHz, 1), | 173       rev_proc_format_(kSampleRate16kHz, 1), | 
| 174       split_rate_(kSampleRate16kHz), | 174       split_rate_(kSampleRate16kHz), | 
| 175       stream_delay_ms_(0), | 175       stream_delay_ms_(0), | 
| 176       delay_offset_ms_(0), | 176       delay_offset_ms_(0), | 
| 177       was_stream_delay_set_(false), | 177       was_stream_delay_set_(false), | 
| 178       last_stream_delay_ms_(0), | 178       last_stream_delay_ms_(0), | 
| 179       last_aec_system_delay_ms_(0), | 179       last_aec_system_delay_ms_(0), | 
|  | 180       stream_delay_jumps_(-1), | 
|  | 181       aec_system_delay_jumps_(-1), | 
| 180       output_will_be_muted_(false), | 182       output_will_be_muted_(false), | 
| 181       key_pressed_(false), | 183       key_pressed_(false), | 
| 182 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 184 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 
| 183       use_new_agc_(false), | 185       use_new_agc_(false), | 
| 184 #else | 186 #else | 
| 185       use_new_agc_(config.Get<ExperimentalAgc>().enabled), | 187       use_new_agc_(config.Get<ExperimentalAgc>().enabled), | 
| 186 #endif | 188 #endif | 
| 187       agc_startup_min_volume_(config.Get<ExperimentalAgc>().startup_min_volume), | 189       agc_startup_min_volume_(config.Get<ExperimentalAgc>().startup_min_volume), | 
| 188 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 190 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 
| 189       transient_suppressor_enabled_(false), | 191       transient_suppressor_enabled_(false), | 
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 996       beamformer_.reset(new NonlinearBeamformer(array_geometry_)); | 998       beamformer_.reset(new NonlinearBeamformer(array_geometry_)); | 
| 997     } | 999     } | 
| 998     beamformer_->Initialize(kChunkSizeMs, split_rate_); | 1000     beamformer_->Initialize(kChunkSizeMs, split_rate_); | 
| 999   } | 1001   } | 
| 1000 } | 1002 } | 
| 1001 | 1003 | 
| 1002 void AudioProcessingImpl::MaybeUpdateHistograms() { | 1004 void AudioProcessingImpl::MaybeUpdateHistograms() { | 
| 1003   static const int kMinDiffDelayMs = 60; | 1005   static const int kMinDiffDelayMs = 60; | 
| 1004 | 1006 | 
| 1005   if (echo_cancellation()->is_enabled()) { | 1007   if (echo_cancellation()->is_enabled()) { | 
|  | 1008     // Activate delay_jumps_ counters if we know echo_cancellation is runnning. | 
|  | 1009     // If a stream has echo we know that the echo_cancellation is in process. | 
|  | 1010     if (stream_delay_jumps_ == -1 && echo_cancellation()->stream_has_echo()) { | 
|  | 1011       stream_delay_jumps_ = 0; | 
|  | 1012     } | 
|  | 1013     if (aec_system_delay_jumps_ == -1 && | 
|  | 1014         echo_cancellation()->stream_has_echo()) { | 
|  | 1015       aec_system_delay_jumps_ = 0; | 
|  | 1016     } | 
|  | 1017 | 
| 1006     // Detect a jump in platform reported system delay and log the difference. | 1018     // Detect a jump in platform reported system delay and log the difference. | 
| 1007     const int diff_stream_delay_ms = stream_delay_ms_ - last_stream_delay_ms_; | 1019     const int diff_stream_delay_ms = stream_delay_ms_ - last_stream_delay_ms_; | 
| 1008     if (diff_stream_delay_ms > kMinDiffDelayMs && last_stream_delay_ms_ != 0) { | 1020     if (diff_stream_delay_ms > kMinDiffDelayMs && last_stream_delay_ms_ != 0) { | 
| 1009       RTC_HISTOGRAM_COUNTS("WebRTC.Audio.PlatformReportedStreamDelayJump", | 1021       RTC_HISTOGRAM_COUNTS("WebRTC.Audio.PlatformReportedStreamDelayJump", | 
| 1010                            diff_stream_delay_ms, kMinDiffDelayMs, 1000, 100); | 1022                            diff_stream_delay_ms, kMinDiffDelayMs, 1000, 100); | 
|  | 1023       if (stream_delay_jumps_ == -1) { | 
|  | 1024         stream_delay_jumps_ = 0;  // Activate counter if needed. | 
|  | 1025       } | 
|  | 1026       stream_delay_jumps_++; | 
| 1011     } | 1027     } | 
| 1012     last_stream_delay_ms_ = stream_delay_ms_; | 1028     last_stream_delay_ms_ = stream_delay_ms_; | 
| 1013 | 1029 | 
| 1014     // Detect a jump in AEC system delay and log the difference. | 1030     // Detect a jump in AEC system delay and log the difference. | 
| 1015     const int frames_per_ms = rtc::CheckedDivExact(split_rate_, 1000); | 1031     const int frames_per_ms = rtc::CheckedDivExact(split_rate_, 1000); | 
| 1016     const int aec_system_delay_ms = | 1032     const int aec_system_delay_ms = | 
| 1017         WebRtcAec_system_delay(echo_cancellation()->aec_core()) / frames_per_ms; | 1033         WebRtcAec_system_delay(echo_cancellation()->aec_core()) / frames_per_ms; | 
| 1018     const int diff_aec_system_delay_ms = aec_system_delay_ms - | 1034     const int diff_aec_system_delay_ms = aec_system_delay_ms - | 
| 1019         last_aec_system_delay_ms_; | 1035         last_aec_system_delay_ms_; | 
| 1020     if (diff_aec_system_delay_ms > kMinDiffDelayMs && | 1036     if (diff_aec_system_delay_ms > kMinDiffDelayMs && | 
| 1021         last_aec_system_delay_ms_ != 0) { | 1037         last_aec_system_delay_ms_ != 0) { | 
| 1022       RTC_HISTOGRAM_COUNTS("WebRTC.Audio.AecSystemDelayJump", | 1038       RTC_HISTOGRAM_COUNTS("WebRTC.Audio.AecSystemDelayJump", | 
| 1023                            diff_aec_system_delay_ms, kMinDiffDelayMs, 1000, | 1039                            diff_aec_system_delay_ms, kMinDiffDelayMs, 1000, | 
| 1024                            100); | 1040                            100); | 
|  | 1041       if (aec_system_delay_jumps_ == -1) { | 
|  | 1042         aec_system_delay_jumps_ = 0;  // Activate counter if needed. | 
|  | 1043       } | 
|  | 1044       aec_system_delay_jumps_++; | 
| 1025     } | 1045     } | 
| 1026     last_aec_system_delay_ms_ = aec_system_delay_ms; | 1046     last_aec_system_delay_ms_ = aec_system_delay_ms; | 
| 1027     // TODO(bjornv): Consider also logging amount of jumps. This gives a better |  | 
| 1028     // indication of how frequent jumps are. |  | 
| 1029   } | 1047   } | 
| 1030 } | 1048 } | 
| 1031 | 1049 | 
|  | 1050 void AudioProcessingImpl::UpdateHistogramsOnCallEnd() { | 
|  | 1051   CriticalSectionScoped crit_scoped(crit_); | 
|  | 1052   if (stream_delay_jumps_ > -1) { | 
|  | 1053     RTC_HISTOGRAM_ENUMERATION( | 
|  | 1054         "WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps", | 
|  | 1055         stream_delay_jumps_, 51); | 
|  | 1056   } | 
|  | 1057   stream_delay_jumps_ = -1; | 
|  | 1058   last_stream_delay_ms_ = 0; | 
|  | 1059 | 
|  | 1060   if (aec_system_delay_jumps_ > -1) { | 
|  | 1061     RTC_HISTOGRAM_ENUMERATION("WebRTC.Audio.NumOfAecSystemDelayJumps", | 
|  | 1062                               aec_system_delay_jumps_, 51); | 
|  | 1063   } | 
|  | 1064   aec_system_delay_jumps_ = -1; | 
|  | 1065   last_aec_system_delay_ms_ = 0; | 
|  | 1066 } | 
|  | 1067 | 
| 1032 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 1068 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 
| 1033 int AudioProcessingImpl::WriteMessageToDebugFile() { | 1069 int AudioProcessingImpl::WriteMessageToDebugFile() { | 
| 1034   int32_t size = event_msg_->ByteSize(); | 1070   int32_t size = event_msg_->ByteSize(); | 
| 1035   if (size <= 0) { | 1071   if (size <= 0) { | 
| 1036     return kUnspecifiedError; | 1072     return kUnspecifiedError; | 
| 1037   } | 1073   } | 
| 1038 #if defined(WEBRTC_ARCH_BIG_ENDIAN) | 1074 #if defined(WEBRTC_ARCH_BIG_ENDIAN) | 
| 1039   // TODO(ajm): Use little-endian "on the wire". For the moment, we can be | 1075   // TODO(ajm): Use little-endian "on the wire". For the moment, we can be | 
| 1040   //            pretty safe in assuming little-endian. | 1076   //            pretty safe in assuming little-endian. | 
| 1041 #endif | 1077 #endif | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 1070   int err = WriteMessageToDebugFile(); | 1106   int err = WriteMessageToDebugFile(); | 
| 1071   if (err != kNoError) { | 1107   if (err != kNoError) { | 
| 1072     return err; | 1108     return err; | 
| 1073   } | 1109   } | 
| 1074 | 1110 | 
| 1075   return kNoError; | 1111   return kNoError; | 
| 1076 } | 1112 } | 
| 1077 #endif  // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1113 #endif  // WEBRTC_AUDIOPROC_DEBUG_DUMP | 
| 1078 | 1114 | 
| 1079 }  // namespace webrtc | 1115 }  // namespace webrtc | 
| OLD | NEW | 
|---|