| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 uint32_t rec_sample_rate_; | 181 uint32_t rec_sample_rate_; |
| 182 uint32_t play_sample_rate_; | 182 uint32_t play_sample_rate_; |
| 183 | 183 |
| 184 // Number of audio channels. | 184 // Number of audio channels. |
| 185 size_t rec_channels_; | 185 size_t rec_channels_; |
| 186 size_t play_channels_; | 186 size_t play_channels_; |
| 187 | 187 |
| 188 // Keeps track of if playout/recording are active or not. A combination | 188 // Keeps track of if playout/recording are active or not. A combination |
| 189 // of these states are used to determine when to start and stop the timer. | 189 // of these states are used to determine when to start and stop the timer. |
| 190 // Only used on the creating thread and not used to control any media flow. | 190 // Only used on the creating thread and not used to control any media flow. |
| 191 bool playing_ ACCESS_ON(main_thread_checker_); | 191 bool playing_ RTC_ACCESS_ON(main_thread_checker_); |
| 192 bool recording_ ACCESS_ON(main_thread_checker_); | 192 bool recording_ RTC_ACCESS_ON(main_thread_checker_); |
| 193 | 193 |
| 194 // Buffer used for audio samples to be played out. Size can be changed | 194 // Buffer used for audio samples to be played out. Size can be changed |
| 195 // dynamically. The 16-bit samples are interleaved, hence the size is | 195 // dynamically. The 16-bit samples are interleaved, hence the size is |
| 196 // proportional to the number of channels. | 196 // proportional to the number of channels. |
| 197 rtc::BufferT<int16_t> play_buffer_ ACCESS_ON(playout_thread_checker_); | 197 rtc::BufferT<int16_t> play_buffer_ RTC_ACCESS_ON(playout_thread_checker_); |
| 198 | 198 |
| 199 // Byte buffer used for recorded audio samples. Size can be changed | 199 // Byte buffer used for recorded audio samples. Size can be changed |
| 200 // dynamically. | 200 // dynamically. |
| 201 rtc::BufferT<int16_t> rec_buffer_ ACCESS_ON(recording_thread_checker_); | 201 rtc::BufferT<int16_t> rec_buffer_ RTC_ACCESS_ON(recording_thread_checker_); |
| 202 | 202 |
| 203 // AGC parameters. | 203 // AGC parameters. |
| 204 #if !defined(WEBRTC_WIN) | 204 #if !defined(WEBRTC_WIN) |
| 205 uint32_t current_mic_level_ ACCESS_ON(recording_thread_checker_); | 205 uint32_t current_mic_level_ RTC_ACCESS_ON(recording_thread_checker_); |
| 206 #else | 206 #else |
| 207 // Windows uses a dedicated thread for volume APIs. | 207 // Windows uses a dedicated thread for volume APIs. |
| 208 uint32_t current_mic_level_; | 208 uint32_t current_mic_level_; |
| 209 #endif | 209 #endif |
| 210 uint32_t new_mic_level_ ACCESS_ON(recording_thread_checker_); | 210 uint32_t new_mic_level_ RTC_ACCESS_ON(recording_thread_checker_); |
| 211 | 211 |
| 212 // Contains true of a key-press has been detected. | 212 // Contains true of a key-press has been detected. |
| 213 bool typing_status_ ACCESS_ON(recording_thread_checker_); | 213 bool typing_status_ RTC_ACCESS_ON(recording_thread_checker_); |
| 214 | 214 |
| 215 // Delay values used by the AEC. | 215 // Delay values used by the AEC. |
| 216 int play_delay_ms_ ACCESS_ON(recording_thread_checker_); | 216 int play_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_); |
| 217 int rec_delay_ms_ ACCESS_ON(recording_thread_checker_); | 217 int rec_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_); |
| 218 | 218 |
| 219 // Contains a clock-drift measurement. | 219 // Contains a clock-drift measurement. |
| 220 int clock_drift_ ACCESS_ON(recording_thread_checker_); | 220 int clock_drift_ RTC_ACCESS_ON(recording_thread_checker_); |
| 221 | 221 |
| 222 // Counts number of times LogStats() has been called. | 222 // Counts number of times LogStats() has been called. |
| 223 size_t num_stat_reports_ ACCESS_ON(task_queue_); | 223 size_t num_stat_reports_ RTC_ACCESS_ON(task_queue_); |
| 224 | 224 |
| 225 // Time stamp of last timer task (drives logging). | 225 // Time stamp of last timer task (drives logging). |
| 226 int64_t last_timer_task_time_ ACCESS_ON(task_queue_); | 226 int64_t last_timer_task_time_ RTC_ACCESS_ON(task_queue_); |
| 227 | 227 |
| 228 // Counts number of audio callbacks modulo 50 to create a signal when | 228 // Counts number of audio callbacks modulo 50 to create a signal when |
| 229 // a new storage of audio stats shall be done. | 229 // a new storage of audio stats shall be done. |
| 230 int16_t rec_stat_count_ ACCESS_ON(recording_thread_checker_); | 230 int16_t rec_stat_count_ RTC_ACCESS_ON(recording_thread_checker_); |
| 231 int16_t play_stat_count_ ACCESS_ON(playout_thread_checker_); | 231 int16_t play_stat_count_ RTC_ACCESS_ON(playout_thread_checker_); |
| 232 | 232 |
| 233 // Time stamps of when playout and recording starts. | 233 // Time stamps of when playout and recording starts. |
| 234 int64_t play_start_time_ ACCESS_ON(main_thread_checker_); | 234 int64_t play_start_time_ RTC_ACCESS_ON(main_thread_checker_); |
| 235 int64_t rec_start_time_ ACCESS_ON(main_thread_checker_); | 235 int64_t rec_start_time_ RTC_ACCESS_ON(main_thread_checker_); |
| 236 | 236 |
| 237 // Contains counters for playout and recording statistics. | 237 // Contains counters for playout and recording statistics. |
| 238 Stats stats_ GUARDED_BY(lock_); | 238 Stats stats_ RTC_GUARDED_BY(lock_); |
| 239 | 239 |
| 240 // Stores current stats at each timer task. Used to calculate differences | 240 // Stores current stats at each timer task. Used to calculate differences |
| 241 // between two successive timer events. | 241 // between two successive timer events. |
| 242 Stats last_stats_ ACCESS_ON(task_queue_); | 242 Stats last_stats_ RTC_ACCESS_ON(task_queue_); |
| 243 | 243 |
| 244 // Set to true at construction and modified to false as soon as one audio- | 244 // Set to true at construction and modified to false as soon as one audio- |
| 245 // level estimate larger than zero is detected. | 245 // level estimate larger than zero is detected. |
| 246 bool only_silence_recorded_; | 246 bool only_silence_recorded_; |
| 247 | 247 |
| 248 // Set to true when logging of audio stats is enabled for the first time in | 248 // Set to true when logging of audio stats is enabled for the first time in |
| 249 // StartPeriodicLogging() and set to false by StopPeriodicLogging(). | 249 // StartPeriodicLogging() and set to false by StopPeriodicLogging(). |
| 250 // Setting this member to false prevents (possiby invalid) log messages from | 250 // Setting this member to false prevents (possiby invalid) log messages from |
| 251 // being printed in the LogStats() task. | 251 // being printed in the LogStats() task. |
| 252 bool log_stats_ ACCESS_ON(task_queue_); | 252 bool log_stats_ RTC_ACCESS_ON(task_queue_); |
| 253 | 253 |
| 254 // Should *never* be defined in production builds. Only used for testing. | 254 // Should *never* be defined in production builds. Only used for testing. |
| 255 // When defined, the output signal will be replaced by a sinus tone at 440Hz. | 255 // When defined, the output signal will be replaced by a sinus tone at 440Hz. |
| 256 #ifdef AUDIO_DEVICE_PLAYS_SINUS_TONE | 256 #ifdef AUDIO_DEVICE_PLAYS_SINUS_TONE |
| 257 double phase_ ACCESS_ON(playout_thread_checker_); | 257 double phase_ RTC_ACCESS_ON(playout_thread_checker_); |
| 258 #endif | 258 #endif |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 } // namespace webrtc | 261 } // namespace webrtc |
| 262 | 262 |
| 263 #endif // WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ | 263 #endif // WEBRTC_MODULES_AUDIO_DEVICE_AUDIO_DEVICE_BUFFER_H_ |
| OLD | NEW |