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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 if (capture_.aec_system_delay_jumps == -1 && | 1270 if (capture_.aec_system_delay_jumps == -1 && |
1271 echo_cancellation()->stream_has_echo()) { | 1271 echo_cancellation()->stream_has_echo()) { |
1272 capture_.aec_system_delay_jumps = 0; | 1272 capture_.aec_system_delay_jumps = 0; |
1273 } | 1273 } |
1274 | 1274 |
1275 // Detect a jump in platform reported system delay and log the difference. | 1275 // Detect a jump in platform reported system delay and log the difference. |
1276 const int diff_stream_delay_ms = | 1276 const int diff_stream_delay_ms = |
1277 capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms; | 1277 capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms; |
1278 if (diff_stream_delay_ms > kMinDiffDelayMs && | 1278 if (diff_stream_delay_ms > kMinDiffDelayMs && |
1279 capture_.last_stream_delay_ms != 0) { | 1279 capture_.last_stream_delay_ms != 0) { |
1280 RTC_HISTOGRAM_COUNTS_SPARSE( | 1280 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.PlatformReportedStreamDelayJump", |
1281 "WebRTC.Audio.PlatformReportedStreamDelayJump", diff_stream_delay_ms, | 1281 diff_stream_delay_ms, kMinDiffDelayMs, 1000, 100); |
1282 kMinDiffDelayMs, 1000, 100); | |
1283 if (capture_.stream_delay_jumps == -1) { | 1282 if (capture_.stream_delay_jumps == -1) { |
1284 capture_.stream_delay_jumps = 0; // Activate counter if needed. | 1283 capture_.stream_delay_jumps = 0; // Activate counter if needed. |
1285 } | 1284 } |
1286 capture_.stream_delay_jumps++; | 1285 capture_.stream_delay_jumps++; |
1287 } | 1286 } |
1288 capture_.last_stream_delay_ms = capture_nonlocked_.stream_delay_ms; | 1287 capture_.last_stream_delay_ms = capture_nonlocked_.stream_delay_ms; |
1289 | 1288 |
1290 // Detect a jump in AEC system delay and log the difference. | 1289 // Detect a jump in AEC system delay and log the difference. |
1291 const int frames_per_ms = | 1290 const int frames_per_ms = |
1292 rtc::CheckedDivExact(capture_nonlocked_.split_rate, 1000); | 1291 rtc::CheckedDivExact(capture_nonlocked_.split_rate, 1000); |
1293 const int aec_system_delay_ms = | 1292 const int aec_system_delay_ms = |
1294 WebRtcAec_system_delay(echo_cancellation()->aec_core()) / frames_per_ms; | 1293 WebRtcAec_system_delay(echo_cancellation()->aec_core()) / frames_per_ms; |
1295 const int diff_aec_system_delay_ms = | 1294 const int diff_aec_system_delay_ms = |
1296 aec_system_delay_ms - capture_.last_aec_system_delay_ms; | 1295 aec_system_delay_ms - capture_.last_aec_system_delay_ms; |
1297 if (diff_aec_system_delay_ms > kMinDiffDelayMs && | 1296 if (diff_aec_system_delay_ms > kMinDiffDelayMs && |
1298 capture_.last_aec_system_delay_ms != 0) { | 1297 capture_.last_aec_system_delay_ms != 0) { |
1299 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.Audio.AecSystemDelayJump", | 1298 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.AecSystemDelayJump", |
1300 diff_aec_system_delay_ms, kMinDiffDelayMs, | 1299 diff_aec_system_delay_ms, kMinDiffDelayMs, 1000, |
1301 1000, 100); | 1300 100); |
1302 if (capture_.aec_system_delay_jumps == -1) { | 1301 if (capture_.aec_system_delay_jumps == -1) { |
1303 capture_.aec_system_delay_jumps = 0; // Activate counter if needed. | 1302 capture_.aec_system_delay_jumps = 0; // Activate counter if needed. |
1304 } | 1303 } |
1305 capture_.aec_system_delay_jumps++; | 1304 capture_.aec_system_delay_jumps++; |
1306 } | 1305 } |
1307 capture_.last_aec_system_delay_ms = aec_system_delay_ms; | 1306 capture_.last_aec_system_delay_ms = aec_system_delay_ms; |
1308 } | 1307 } |
1309 } | 1308 } |
1310 | 1309 |
1311 void AudioProcessingImpl::UpdateHistogramsOnCallEnd() { | 1310 void AudioProcessingImpl::UpdateHistogramsOnCallEnd() { |
1312 // Run in a single-threaded manner. | 1311 // Run in a single-threaded manner. |
1313 rtc::CritScope cs_render(&crit_render_); | 1312 rtc::CritScope cs_render(&crit_render_); |
1314 rtc::CritScope cs_capture(&crit_capture_); | 1313 rtc::CritScope cs_capture(&crit_capture_); |
1315 | 1314 |
1316 if (capture_.stream_delay_jumps > -1) { | 1315 if (capture_.stream_delay_jumps > -1) { |
1317 RTC_HISTOGRAM_ENUMERATION_SPARSE( | 1316 RTC_HISTOGRAM_ENUMERATION( |
1318 "WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps", | 1317 "WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps", |
1319 capture_.stream_delay_jumps, 51); | 1318 capture_.stream_delay_jumps, 51); |
1320 } | 1319 } |
1321 capture_.stream_delay_jumps = -1; | 1320 capture_.stream_delay_jumps = -1; |
1322 capture_.last_stream_delay_ms = 0; | 1321 capture_.last_stream_delay_ms = 0; |
1323 | 1322 |
1324 if (capture_.aec_system_delay_jumps > -1) { | 1323 if (capture_.aec_system_delay_jumps > -1) { |
1325 RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Audio.NumOfAecSystemDelayJumps", | 1324 RTC_HISTOGRAM_ENUMERATION("WebRTC.Audio.NumOfAecSystemDelayJumps", |
1326 capture_.aec_system_delay_jumps, 51); | 1325 capture_.aec_system_delay_jumps, 51); |
1327 } | 1326 } |
1328 capture_.aec_system_delay_jumps = -1; | 1327 capture_.aec_system_delay_jumps = -1; |
1329 capture_.last_aec_system_delay_ms = 0; | 1328 capture_.last_aec_system_delay_ms = 0; |
1330 } | 1329 } |
1331 | 1330 |
1332 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 1331 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
1333 int AudioProcessingImpl::WriteMessageToDebugFile( | 1332 int AudioProcessingImpl::WriteMessageToDebugFile( |
1334 FileWrapper* debug_file, | 1333 FileWrapper* debug_file, |
1335 int64_t* filesize_limit_bytes, | 1334 int64_t* filesize_limit_bytes, |
1336 rtc::CriticalSection* crit_debug, | 1335 rtc::CriticalSection* crit_debug, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); | 1449 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); |
1451 | 1450 |
1452 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), | 1451 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), |
1453 &debug_dump_.num_bytes_left_for_log_, | 1452 &debug_dump_.num_bytes_left_for_log_, |
1454 &crit_debug_, &debug_dump_.capture)); | 1453 &crit_debug_, &debug_dump_.capture)); |
1455 return kNoError; | 1454 return kNoError; |
1456 } | 1455 } |
1457 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1456 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
1458 | 1457 |
1459 } // namespace webrtc | 1458 } // namespace webrtc |
OLD | NEW |