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_VOICE_ENGINES_H_ |
| 12 #define WEBRTC_AUDIO_VOICE_ENGINES_H_ |
| 13 |
| 14 #include <map> |
| 15 |
| 16 #include "webrtc/base/basictypes.h" |
| 17 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/base/thread_checker.h" |
| 19 |
| 20 namespace webrtc { |
| 21 |
| 22 class VoEBase; |
| 23 class VoiceEngine; |
| 24 |
| 25 namespace internal { |
| 26 |
| 27 class TypingNoiseObserver; |
| 28 |
| 29 // TODO(solenberg): Class comment + unit test. |
| 30 class VoiceEngines final { |
| 31 public: |
| 32 VoiceEngines(); |
| 33 ~VoiceEngines(); |
| 34 void RegisterVoiceEngine(VoiceEngine* voice_engine); |
| 35 void DeregisterVoiceEngine(VoiceEngine* voice_engine); |
| 36 bool GetTypingNoiseDetected(VoiceEngine* voice_engine) const; |
| 37 private: |
| 38 struct State { |
| 39 // Need to keep a ref count so we know when to deregister the observer. |
| 40 int32_t ref_count_ = 0; |
| 41 // We hold one interface pointer to the VoE to make sure it is kept alive. |
| 42 VoEBase* voe_base_ = nullptr; |
| 43 TypingNoiseObserver* observer_ = nullptr; |
| 44 }; |
| 45 |
| 46 rtc::ThreadChecker thread_checker_; |
| 47 std::map<VoiceEngine*, State> voice_engines_; |
| 48 |
| 49 RTC_DISALLOW_COPY_AND_ASSIGN(VoiceEngines); |
| 50 }; |
| 51 } // namespace internal |
| 52 } // namespace webrtc |
| 53 |
| 54 #endif // WEBRTC_AUDIO_VOICE_ENGINES_H_ |
OLD | NEW |