OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_AUDIO_AUDIO_STATE_H_ |
| 12 #define WEBRTC_AUDIO_AUDIO_STATE_H_ |
| 13 |
| 14 #include "webrtc/audio_state.h" |
| 15 #include "webrtc/audio/scoped_voe_interface.h" |
| 16 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/base/criticalsection.h" |
| 18 #include "webrtc/base/thread_checker.h" |
| 19 #include "webrtc/voice_engine/include/voe_base.h" |
| 20 |
| 21 namespace webrtc { |
| 22 namespace internal { |
| 23 |
| 24 class AudioState final : public webrtc::AudioState, |
| 25 public webrtc::VoiceEngineObserver { |
| 26 public: |
| 27 explicit AudioState(const AudioState::Config& config); |
| 28 ~AudioState() override; |
| 29 |
| 30 VoiceEngine* voice_engine(); |
| 31 bool typing_noise_detected() const; |
| 32 |
| 33 // webrtc::VoiceEngineObserver implementation. |
| 34 void CallbackOnError(int channel_id, int err_code) override; |
| 35 |
| 36 private: |
| 37 rtc::ThreadChecker thread_checker_; |
| 38 rtc::ThreadChecker process_thread_checker_; |
| 39 const webrtc::AudioState::Config config_; |
| 40 |
| 41 // We hold one interface pointer to the VoE to make sure it is kept alive. |
| 42 ScopedVoEInterface<VoEBase> voe_base_; |
| 43 |
| 44 // The critical section isn't strictly needed in this case, but xSAN bots may |
| 45 // trigger on unprotected cross-thread access. |
| 46 mutable rtc::CriticalSection crit_sect_; |
| 47 bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false; |
| 48 |
| 49 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioState); |
| 50 }; |
| 51 } // namespace internal |
| 52 } // namespace webrtc |
| 53 |
| 54 #endif // WEBRTC_AUDIO_AUDIO_STATE_H_ |
OLD | NEW |