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

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: Fixed div by zero 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 "webrtc/base/criticalsection.h" 14 #include "webrtc/base/criticalsection.h"
15 #include "webrtc/base/task_queue.h" 15 #include "webrtc/base/task_queue.h"
16 #include "webrtc/base/thread_checker.h" 16 #include "webrtc/base/thread_checker.h"
17 #include "webrtc/modules/audio_device/include/audio_device.h" 17 #include "webrtc/modules/audio_device/include/audio_device.h"
18 #include "webrtc/system_wrappers/include/file_wrapper.h" 18 #include "webrtc/system_wrappers/include/file_wrapper.h"
19 #include "webrtc/typedefs.h" 19 #include "webrtc/typedefs.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22 class CriticalSectionWrapper; 22 class CriticalSectionWrapper;
23 23
24 const uint32_t kPulsePeriodMs = 1000; 24 const uint32_t kPulsePeriodMs = 1000;
25 const size_t kMaxBufferSizeBytes = 3840; // 10ms in stereo @ 96kHz 25 const size_t kMaxBufferSizeBytes = 3840; // 10ms in stereo @ 96kHz
26 // Delta times between two successive playout callbacks are limited to this
27 // value before added to an internal array.
28 const size_t kMaxDeltaTimeInMs = 500;
26 29
27 class AudioDeviceObserver; 30 class AudioDeviceObserver;
28 31
29 class AudioDeviceBuffer { 32 class AudioDeviceBuffer {
30 public: 33 public:
31 AudioDeviceBuffer(); 34 AudioDeviceBuffer();
32 virtual ~AudioDeviceBuffer(); 35 virtual ~AudioDeviceBuffer();
33 36
34 void SetId(uint32_t id) {}; 37 void SetId(uint32_t id) {};
35 int32_t RegisterAudioCallback(AudioTransport* audioCallback); 38 int32_t RegisterAudioCallback(AudioTransport* audioCallback);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 uint64_t last_rec_samples_; 163 uint64_t last_rec_samples_;
161 164
162 // Total number of played audio samples. 165 // Total number of played audio samples.
163 uint64_t play_samples_; 166 uint64_t play_samples_;
164 167
165 // Total number of played samples stored at the previous timer task. 168 // Total number of played samples stored at the previous timer task.
166 uint64_t last_play_samples_; 169 uint64_t last_play_samples_;
167 170
168 // Time stamp of last stat report. 171 // Time stamp of last stat report.
169 uint64_t last_log_stat_time_; 172 uint64_t last_log_stat_time_;
173
174 // Time stamp of last playout callback.
175 uint64_t last_playout_time_;
176
177 // An array where the position corresponds to time differences (in
178 // milliseconds) between two successive playout callbacks, and the stored
179 // value is the number of times a given time difference was found.
180 // Writing to the array is done without a lock since it is only read once at
181 // destruction when no audio is running.
182 uint32_t playout_diff_times_[kMaxDeltaTimeInMs + 1] = {0};
170 }; 183 };
171 184
172 } // namespace webrtc 185 } // namespace webrtc
173 186
174 #endif // WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ 187 #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