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

Side by Side Diff: webrtc/modules/audio_device/audio_device_buffer.h

Issue 2190343002: Adds delta-time logging for audio playout (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Now uses and array instead Created 4 years, 4 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
« no previous file with comments | « no previous file | webrtc/modules/audio_device/audio_device_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_
12 #define WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ 12 #define WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_
13 13
14 #include <map>
magjed_webrtc 2016/07/29 13:13:20 remove
15
14 #include "webrtc/base/criticalsection.h" 16 #include "webrtc/base/criticalsection.h"
15 #include "webrtc/base/task_queue.h" 17 #include "webrtc/base/task_queue.h"
16 #include "webrtc/base/thread_checker.h" 18 #include "webrtc/base/thread_checker.h"
17 #include "webrtc/modules/audio_device/include/audio_device.h" 19 #include "webrtc/modules/audio_device/include/audio_device.h"
18 #include "webrtc/system_wrappers/include/file_wrapper.h" 20 #include "webrtc/system_wrappers/include/file_wrapper.h"
19 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
20 22
21 namespace webrtc { 23 namespace webrtc {
22 class CriticalSectionWrapper; 24 class CriticalSectionWrapper;
23 25
24 const uint32_t kPulsePeriodMs = 1000; 26 const uint32_t kPulsePeriodMs = 1000;
25 const size_t kMaxBufferSizeBytes = 3840; // 10ms in stereo @ 96kHz 27 const size_t kMaxBufferSizeBytes = 3840; // 10ms in stereo @ 96kHz
28 // Delta times between two successive playout callbacks are limited to this
29 // value before added to an internal array.
30 const size_t kMaxDeltaTimeInMs = 500;
26 31
27 class AudioDeviceObserver; 32 class AudioDeviceObserver;
28 33
29 class AudioDeviceBuffer { 34 class AudioDeviceBuffer {
30 public: 35 public:
31 AudioDeviceBuffer(); 36 AudioDeviceBuffer();
32 virtual ~AudioDeviceBuffer(); 37 virtual ~AudioDeviceBuffer();
33 38
34 void SetId(uint32_t id) {}; 39 void SetId(uint32_t id) {};
35 int32_t RegisterAudioCallback(AudioTransport* audioCallback); 40 int32_t RegisterAudioCallback(AudioTransport* audioCallback);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 uint64_t last_rec_samples_; 165 uint64_t last_rec_samples_;
161 166
162 // Total number of played audio samples. 167 // Total number of played audio samples.
163 uint64_t play_samples_; 168 uint64_t play_samples_;
164 169
165 // Total number of played samples stored at the previous timer task. 170 // Total number of played samples stored at the previous timer task.
166 uint64_t last_play_samples_; 171 uint64_t last_play_samples_;
167 172
168 // Time stamp of last stat report. 173 // Time stamp of last stat report.
169 uint64_t last_log_stat_time_; 174 uint64_t last_log_stat_time_;
175
176 // Time stamp of last playout callback.
177 uint64_t last_playout_time_;
178
179 // An array where the position corresponds to time differences (in
180 // milliseconds) between two successive playout callbacks, and the stored
181 // value is the number of times a given time difference was found.
182 // Writing to the array is done without a lock since it is only read once at
183 // destruction when no audio is running.
184 uint32_t playout_diff_times_[kMaxDeltaTimeInMs + 1] = {0};
170 }; 185 };
171 186
172 } // namespace webrtc 187 } // namespace webrtc
173 188
174 #endif // WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ 189 #endif // WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_device/audio_device_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698