Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Unified Diff: webrtc/audio/voice_engines.h

Issue 1403363003: Move VoiceEngineObserver into AudioSendStream so that we detect typing noises and return properly i… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: more includes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/audio/typing_noise_observer.cc ('k') | webrtc/audio/voice_engines.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « webrtc/audio/typing_noise_observer.cc ('k') | webrtc/audio/voice_engines.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698