| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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_AUDIO_AUDIO_STATE_H_ | 11 #ifndef WEBRTC_AUDIO_AUDIO_STATE_H_ |
| 12 #define WEBRTC_AUDIO_AUDIO_STATE_H_ | 12 #define WEBRTC_AUDIO_AUDIO_STATE_H_ |
| 13 | 13 |
| 14 #include <memory> |
| 15 |
| 14 #include "webrtc/api/call/audio_state.h" | 16 #include "webrtc/api/call/audio_state.h" |
| 15 #include "webrtc/audio/scoped_voe_interface.h" | 17 #include "webrtc/audio/scoped_voe_interface.h" |
| 16 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
| 18 #include "webrtc/base/thread_checker.h" | 20 #include "webrtc/base/thread_checker.h" |
| 19 #include "webrtc/voice_engine/include/voe_base.h" | 21 #include "webrtc/voice_engine/include/voe_base.h" |
| 20 | 22 |
| 21 namespace webrtc { | 23 namespace webrtc { |
| 22 namespace internal { | 24 namespace internal { |
| 23 | 25 |
| 24 class AudioState final : public webrtc::AudioState, | 26 class AudioState final : public webrtc::AudioState, |
| 25 public webrtc::VoiceEngineObserver { | 27 public webrtc::VoiceEngineObserver { |
| 26 public: | 28 public: |
| 27 explicit AudioState(const AudioState::Config& config); | 29 explicit AudioState(const AudioState::Config& config); |
| 28 ~AudioState() override; | 30 ~AudioState() override; |
| 29 | 31 |
| 30 VoiceEngine* voice_engine(); | 32 VoiceEngine* voice_engine(); |
| 33 AudioDeviceModule* audio_device(); |
| 31 bool typing_noise_detected() const; | 34 bool typing_noise_detected() const; |
| 32 | 35 |
| 33 private: | 36 private: |
| 34 // rtc::RefCountInterface implementation. | 37 // rtc::RefCountInterface implementation. |
| 35 int AddRef() const override; | 38 int AddRef() const override; |
| 36 int Release() const override; | 39 int Release() const override; |
| 37 | 40 |
| 38 // webrtc::VoiceEngineObserver implementation. | 41 // webrtc::VoiceEngineObserver implementation. |
| 39 void CallbackOnError(int channel_id, int err_code) override; | 42 void CallbackOnError(int channel_id, int err_code) override; |
| 40 | 43 |
| 41 rtc::ThreadChecker thread_checker_; | 44 rtc::ThreadChecker thread_checker_; |
| 42 rtc::ThreadChecker process_thread_checker_; | 45 rtc::ThreadChecker process_thread_checker_; |
| 43 const webrtc::AudioState::Config config_; | 46 const webrtc::AudioState::Config config_; |
| 44 | 47 |
| 45 // We hold one interface pointer to the VoE to make sure it is kept alive. | 48 // We hold one interface pointer to the VoE to make sure it is kept alive. |
| 46 ScopedVoEInterface<VoEBase> voe_base_; | 49 ScopedVoEInterface<VoEBase> voe_base_; |
| 47 | 50 |
| 48 // The critical section isn't strictly needed in this case, but xSAN bots may | 51 // The critical section isn't strictly needed in this case, but xSAN bots may |
| 49 // trigger on unprotected cross-thread access. | 52 // trigger on unprotected cross-thread access. |
| 50 rtc::CriticalSection crit_sect_; | 53 rtc::CriticalSection crit_sect_; |
| 51 bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false; | 54 bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false; |
| 52 | 55 |
| 53 // Reference count; implementation copied from rtc::RefCountedObject. | 56 // Reference count; implementation copied from rtc::RefCountedObject. |
| 54 mutable volatile int ref_count_ = 0; | 57 mutable volatile int ref_count_ = 0; |
| 55 | 58 |
| 59 AudioTransport* mim_transport_ = nullptr; |
| 60 |
| 56 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioState); | 61 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioState); |
| 57 }; | 62 }; |
| 58 } // namespace internal | 63 } // namespace internal |
| 59 } // namespace webrtc | 64 } // namespace webrtc |
| 60 | 65 |
| 61 #endif // WEBRTC_AUDIO_AUDIO_STATE_H_ | 66 #endif // WEBRTC_AUDIO_AUDIO_STATE_H_ |
| OLD | NEW |