Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: media/audio/mac/audio_low_latency_input_mac.cc

Issue 1864483002: Forward output glitch information from stream WebRTC log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/mac/audio_low_latency_input_mac.h" 5 #include "media/audio/mac/audio_low_latency_input_mac.h"
6 #include <CoreServices/CoreServices.h> 6 #include <CoreServices/CoreServices.h>
7 #include <mach/mach.h> 7 #include <mach/mach.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/mac/mac_logging.h" 12 #include "base/mac/mac_logging.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/sparse_histogram.h" 14 #include "base/metrics/sparse_histogram.h"
15 #include "base/sys_info.h" 15 #include "base/sys_info.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "media/audio/audio_logging.h"
17 #include "media/audio/mac/audio_manager_mac.h" 18 #include "media/audio/mac/audio_manager_mac.h"
18 #include "media/base/audio_bus.h" 19 #include "media/base/audio_bus.h"
19 #include "media/base/data_buffer.h" 20 #include "media/base/data_buffer.h"
20 21
21 namespace media { 22 namespace media {
22 23
23 // Number of blocks of buffers used in the |fifo_|. 24 // Number of blocks of buffers used in the |fifo_|.
24 const int kNumberOfBlocksBufferInFifo = 2; 25 const int kNumberOfBlocksBufferInFifo = 2;
25 26
26 // Max length of sequence of TooManyFramesToProcessError errors. 27 // Max length of sequence of TooManyFramesToProcessError errors.
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 last_sample_time_ = timestamp->mSampleTime; 1321 last_sample_time_ = timestamp->mSampleTime;
1321 } 1322 }
1322 1323
1323 void AUAudioInputStream::ReportAndResetStats() { 1324 void AUAudioInputStream::ReportAndResetStats() {
1324 if (last_sample_time_ == 0) 1325 if (last_sample_time_ == 0)
1325 return; // No stats gathered to report. 1326 return; // No stats gathered to report.
1326 1327
1327 // A value of 0 indicates that we got the buffer size we asked for. 1328 // A value of 0 indicates that we got the buffer size we asked for.
1328 UMA_HISTOGRAM_COUNTS_10000("Media.Audio.Capture.FramesProvided", 1329 UMA_HISTOGRAM_COUNTS_10000("Media.Audio.Capture.FramesProvided",
1329 number_of_frames_provided_); 1330 number_of_frames_provided_);
1331 WebRtcLogMessage("(Example) Here the stats will be logged.");
DaleCurtis 2016/04/05 21:56:52 No, this is a layering violation. media/ shouldn't
Henrik Grunell 2016/04/06 12:25:31 What about adding something like AudioLog::OnStati
1332
1330 // Even if there aren't any glitches, we want to record it to get a feel for 1333 // Even if there aren't any glitches, we want to record it to get a feel for
1331 // how often we get no glitches vs the alternative. 1334 // how often we get no glitches vs the alternative.
1332 UMA_HISTOGRAM_COUNTS("Media.Audio.Capture.Glitches", glitches_detected_); 1335 UMA_HISTOGRAM_COUNTS("Media.Audio.Capture.Glitches", glitches_detected_);
1333 1336
1334 if (glitches_detected_ != 0) { 1337 if (glitches_detected_ != 0) {
1335 auto lost_frames_ms = (total_lost_frames_ * 1000) / format_.mSampleRate; 1338 auto lost_frames_ms = (total_lost_frames_ * 1000) / format_.mSampleRate;
1336 UMA_HISTOGRAM_LONG_TIMES("Media.Audio.Capture.LostFramesInMs", 1339 UMA_HISTOGRAM_LONG_TIMES("Media.Audio.Capture.LostFramesInMs",
1337 base::TimeDelta::FromMilliseconds(lost_frames_ms)); 1340 base::TimeDelta::FromMilliseconds(lost_frames_ms));
1338 auto largest_glitch_ms = 1341 auto largest_glitch_ms =
1339 (largest_glitch_frames_ * 1000) / format_.mSampleRate; 1342 (largest_glitch_frames_ * 1000) / format_.mSampleRate;
1340 UMA_HISTOGRAM_CUSTOM_TIMES( 1343 UMA_HISTOGRAM_CUSTOM_TIMES(
1341 "Media.Audio.Capture.LargestGlitchMs", 1344 "Media.Audio.Capture.LargestGlitchMs",
1342 base::TimeDelta::FromMilliseconds(largest_glitch_ms), 1345 base::TimeDelta::FromMilliseconds(largest_glitch_ms),
1343 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), 1346 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1),
1344 50); 1347 50);
1345 DLOG(WARNING) << "Total glitches=" << glitches_detected_ 1348 DLOG(WARNING) << "Total glitches=" << glitches_detected_
1346 << ". Total frames lost=" << total_lost_frames_ << " (" 1349 << ". Total frames lost=" << total_lost_frames_ << " ("
1347 << lost_frames_ms; 1350 << lost_frames_ms;
1348 } 1351 }
1349 1352
1350 number_of_frames_provided_ = 0; 1353 number_of_frames_provided_ = 0;
1351 glitches_detected_ = 0; 1354 glitches_detected_ = 0;
1352 last_sample_time_ = 0; 1355 last_sample_time_ = 0;
1353 last_number_of_frames_ = 0; 1356 last_number_of_frames_ = 0;
1354 total_lost_frames_ = 0; 1357 total_lost_frames_ = 0;
1355 largest_glitch_frames_ = 0; 1358 largest_glitch_frames_ = 0;
1356 } 1359 }
1357 1360
1358 } // namespace media 1361 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698