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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 if (capture_.aec_system_delay_jumps == -1 && | 1315 if (capture_.aec_system_delay_jumps == -1 && |
1316 echo_cancellation()->stream_has_echo()) { | 1316 echo_cancellation()->stream_has_echo()) { |
1317 capture_.aec_system_delay_jumps = 0; | 1317 capture_.aec_system_delay_jumps = 0; |
1318 } | 1318 } |
1319 | 1319 |
1320 // Detect a jump in platform reported system delay and log the difference. | 1320 // Detect a jump in platform reported system delay and log the difference. |
1321 const int diff_stream_delay_ms = | 1321 const int diff_stream_delay_ms = |
1322 capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms; | 1322 capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms; |
1323 if (diff_stream_delay_ms > kMinDiffDelayMs && | 1323 if (diff_stream_delay_ms > kMinDiffDelayMs && |
1324 capture_.last_stream_delay_ms != 0) { | 1324 capture_.last_stream_delay_ms != 0) { |
1325 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.PlatformReportedStreamDelayJump", | 1325 RTC_HISTOGRAM_COUNTS_SPARSE( |
1326 diff_stream_delay_ms, kMinDiffDelayMs, 1000, 100); | 1326 "WebRTC.Audio.PlatformReportedStreamDelayJump", diff_stream_delay_ms, |
| 1327 kMinDiffDelayMs, 1000, 100); |
1327 if (capture_.stream_delay_jumps == -1) { | 1328 if (capture_.stream_delay_jumps == -1) { |
1328 capture_.stream_delay_jumps = 0; // Activate counter if needed. | 1329 capture_.stream_delay_jumps = 0; // Activate counter if needed. |
1329 } | 1330 } |
1330 capture_.stream_delay_jumps++; | 1331 capture_.stream_delay_jumps++; |
1331 } | 1332 } |
1332 capture_.last_stream_delay_ms = capture_nonlocked_.stream_delay_ms; | 1333 capture_.last_stream_delay_ms = capture_nonlocked_.stream_delay_ms; |
1333 | 1334 |
1334 // Detect a jump in AEC system delay and log the difference. | 1335 // Detect a jump in AEC system delay and log the difference. |
1335 const int frames_per_ms = | 1336 const int frames_per_ms = |
1336 rtc::CheckedDivExact(capture_nonlocked_.split_rate, 1000); | 1337 rtc::CheckedDivExact(capture_nonlocked_.split_rate, 1000); |
1337 const int aec_system_delay_ms = | 1338 const int aec_system_delay_ms = |
1338 WebRtcAec_system_delay(echo_cancellation()->aec_core()) / frames_per_ms; | 1339 WebRtcAec_system_delay(echo_cancellation()->aec_core()) / frames_per_ms; |
1339 const int diff_aec_system_delay_ms = | 1340 const int diff_aec_system_delay_ms = |
1340 aec_system_delay_ms - capture_.last_aec_system_delay_ms; | 1341 aec_system_delay_ms - capture_.last_aec_system_delay_ms; |
1341 if (diff_aec_system_delay_ms > kMinDiffDelayMs && | 1342 if (diff_aec_system_delay_ms > kMinDiffDelayMs && |
1342 capture_.last_aec_system_delay_ms != 0) { | 1343 capture_.last_aec_system_delay_ms != 0) { |
1343 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.AecSystemDelayJump", | 1344 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.Audio.AecSystemDelayJump", |
1344 diff_aec_system_delay_ms, kMinDiffDelayMs, 1000, | 1345 diff_aec_system_delay_ms, kMinDiffDelayMs, |
1345 100); | 1346 1000, 100); |
1346 if (capture_.aec_system_delay_jumps == -1) { | 1347 if (capture_.aec_system_delay_jumps == -1) { |
1347 capture_.aec_system_delay_jumps = 0; // Activate counter if needed. | 1348 capture_.aec_system_delay_jumps = 0; // Activate counter if needed. |
1348 } | 1349 } |
1349 capture_.aec_system_delay_jumps++; | 1350 capture_.aec_system_delay_jumps++; |
1350 } | 1351 } |
1351 capture_.last_aec_system_delay_ms = aec_system_delay_ms; | 1352 capture_.last_aec_system_delay_ms = aec_system_delay_ms; |
1352 } | 1353 } |
1353 } | 1354 } |
1354 | 1355 |
1355 void AudioProcessingImpl::UpdateHistogramsOnCallEnd() { | 1356 void AudioProcessingImpl::UpdateHistogramsOnCallEnd() { |
1356 // Run in a single-threaded manner. | 1357 // Run in a single-threaded manner. |
1357 rtc::CritScope cs_render(&crit_render_); | 1358 rtc::CritScope cs_render(&crit_render_); |
1358 rtc::CritScope cs_capture(&crit_capture_); | 1359 rtc::CritScope cs_capture(&crit_capture_); |
1359 | 1360 |
1360 if (capture_.stream_delay_jumps > -1) { | 1361 if (capture_.stream_delay_jumps > -1) { |
1361 RTC_HISTOGRAM_ENUMERATION( | 1362 RTC_HISTOGRAM_ENUMERATION_SPARSE( |
1362 "WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps", | 1363 "WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps", |
1363 capture_.stream_delay_jumps, 51); | 1364 capture_.stream_delay_jumps, 51); |
1364 } | 1365 } |
1365 capture_.stream_delay_jumps = -1; | 1366 capture_.stream_delay_jumps = -1; |
1366 capture_.last_stream_delay_ms = 0; | 1367 capture_.last_stream_delay_ms = 0; |
1367 | 1368 |
1368 if (capture_.aec_system_delay_jumps > -1) { | 1369 if (capture_.aec_system_delay_jumps > -1) { |
1369 RTC_HISTOGRAM_ENUMERATION("WebRTC.Audio.NumOfAecSystemDelayJumps", | 1370 RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Audio.NumOfAecSystemDelayJumps", |
1370 capture_.aec_system_delay_jumps, 51); | 1371 capture_.aec_system_delay_jumps, 51); |
1371 } | 1372 } |
1372 capture_.aec_system_delay_jumps = -1; | 1373 capture_.aec_system_delay_jumps = -1; |
1373 capture_.last_aec_system_delay_ms = 0; | 1374 capture_.last_aec_system_delay_ms = 0; |
1374 } | 1375 } |
1375 | 1376 |
1376 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 1377 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
1377 int AudioProcessingImpl::WriteMessageToDebugFile( | 1378 int AudioProcessingImpl::WriteMessageToDebugFile( |
1378 FileWrapper* debug_file, | 1379 FileWrapper* debug_file, |
1379 rtc::CriticalSection* crit_debug, | 1380 rtc::CriticalSection* crit_debug, |
1380 ApmDebugDumpThreadState* debug_state) { | 1381 ApmDebugDumpThreadState* debug_state) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 debug_dump_.capture.event_msg->set_type(audioproc::Event::CONFIG); | 1480 debug_dump_.capture.event_msg->set_type(audioproc::Event::CONFIG); |
1480 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); | 1481 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); |
1481 | 1482 |
1482 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), | 1483 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), |
1483 &crit_debug_, &debug_dump_.capture)); | 1484 &crit_debug_, &debug_dump_.capture)); |
1484 return kNoError; | 1485 return kNoError; |
1485 } | 1486 } |
1486 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1487 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
1487 | 1488 |
1488 } // namespace webrtc | 1489 } // namespace webrtc |
OLD | NEW |