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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Called periodically on the internal thread created by the TaskQueue. | 79 // Called periodically on the internal thread created by the TaskQueue. |
80 void LogStats(); | 80 void LogStats(); |
81 | 81 |
82 // Clears all members tracking stats for recording and playout. | 82 // Clears all members tracking stats for recording and playout. |
83 void ResetRecStats(); | 83 void ResetRecStats(); |
84 void ResetPlayStats(); | 84 void ResetPlayStats(); |
85 | 85 |
86 // Updates counters in each play/record callback but does it on the task | 86 // Updates counters in each play/record callback but does it on the task |
87 // queue to ensure that they can be read by LogStats() without any locks since | 87 // queue to ensure that they can be read by LogStats() without any locks since |
88 // each task is serialized by the task queue. | 88 // each task is serialized by the task queue. |
89 void UpdateRecStats(const void* audio_buffer, size_t num_samples); | 89 void UpdateRecStats(int16_t max_abs, size_t num_samples); |
90 void UpdatePlayStats(const void* audio_buffer, size_t num_samples); | 90 void UpdatePlayStats(int16_t max_abs, size_t num_samples); |
91 | 91 |
92 // Ensures that methods are called on the same thread as the thread that | 92 // Ensures that methods are called on the same thread as the thread that |
93 // creates this object. | 93 // creates this object. |
94 rtc::ThreadChecker thread_checker_; | 94 rtc::ThreadChecker thread_checker_; |
95 | 95 |
96 // Raw pointer to AudioTransport instance. Supplied to RegisterAudioCallback() | 96 // Raw pointer to AudioTransport instance. Supplied to RegisterAudioCallback() |
97 // and it must outlive this object. | 97 // and it must outlive this object. |
98 AudioTransport* audio_transport_cb_; | 98 AudioTransport* audio_transport_cb_; |
99 | 99 |
100 // TODO(henrika): given usage of thread checker, it should be possible to | 100 // TODO(henrika): given usage of thread checker, it should be possible to |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Contains max level of recorded audio packets over the last 10 seconds | 195 // Contains max level of recorded audio packets over the last 10 seconds |
196 // where a new measurement is done twice per second. | 196 // where a new measurement is done twice per second. |
197 int16_t max_play_level_; | 197 int16_t max_play_level_; |
198 | 198 |
199 // Counts number of times we detect "no audio" corresponding to a case where | 199 // Counts number of times we detect "no audio" corresponding to a case where |
200 // all level measurements since the last log has been exactly zero. | 200 // all level measurements since the last log has been exactly zero. |
201 // In other words: this counter is incremented only if 20 measurements | 201 // In other words: this counter is incremented only if 20 measurements |
202 // (two per second) in a row equals zero. The member is only incremented on | 202 // (two per second) in a row equals zero. The member is only incremented on |
203 // the task queue and max once every 10th second. | 203 // the task queue and max once every 10th second. |
204 size_t num_rec_level_is_zero_; | 204 size_t num_rec_level_is_zero_; |
| 205 |
| 206 // Counts number of audio callbacks modulo 50 to create a signal when |
| 207 // a new storage of audio stats shall be done. |
| 208 // Only updated on the OS-specific audio thread that drives audio. |
| 209 int16_t rec_stat_count_; |
| 210 int16_t play_stat_count_; |
205 }; | 211 }; |
206 | 212 |
207 } // namespace webrtc | 213 } // namespace webrtc |
208 | 214 |
209 #endif // WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ | 215 #endif // WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ |
OLD | NEW |