Index: webrtc/audio/voice_engines.h |
diff --git a/webrtc/audio/voice_engines.h b/webrtc/audio/voice_engines.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..04b6209ee0fb3a86a858700f5be74208913a6eb0 |
--- /dev/null |
+++ b/webrtc/audio/voice_engines.h |
@@ -0,0 +1,54 @@ |
+/* |
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#ifndef WEBRTC_AUDIO_VOICE_ENGINES_H_ |
+#define WEBRTC_AUDIO_VOICE_ENGINES_H_ |
+ |
+#include <map> |
+ |
+#include "webrtc/base/basictypes.h" |
+#include "webrtc/base/constructormagic.h" |
+#include "webrtc/base/thread_checker.h" |
+ |
+namespace webrtc { |
+ |
+class VoEBase; |
+class VoiceEngine; |
+ |
+namespace internal { |
+ |
+class TypingNoiseObserver; |
+ |
+// TODO(solenberg): Class comment + unit test. |
+class VoiceEngines final { |
+ public: |
+ VoiceEngines(); |
+ ~VoiceEngines(); |
+ void RegisterVoiceEngine(VoiceEngine* voice_engine); |
+ void DeregisterVoiceEngine(VoiceEngine* voice_engine); |
+ bool GetTypingNoiseDetected(VoiceEngine* voice_engine) const; |
+ private: |
+ struct State { |
+ // Need to keep a ref count so we know when to deregister the observer. |
+ int32_t ref_count_ = 0; |
+ // We hold one interface pointer to the VoE to make sure it is kept alive. |
+ VoEBase* voe_base_ = nullptr; |
+ TypingNoiseObserver* observer_ = nullptr; |
+ }; |
+ |
+ rtc::ThreadChecker thread_checker_; |
+ std::map<VoiceEngine*, State> voice_engines_; |
+ |
+ RTC_DISALLOW_COPY_AND_ASSIGN(VoiceEngines); |
+}; |
+} // namespace internal |
+} // namespace webrtc |
+ |
+#endif // WEBRTC_AUDIO_VOICE_ENGINES_H_ |