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

Unified Diff: webrtc/common_audio/vad/include/vad.h

Issue 1317243005: Turn webrtc::Vad into a pure virtual interface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@ifc-merge-2
Patch Set: Created 5 years, 3 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 | « no previous file | webrtc/common_audio/vad/mock/mock_vad.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/vad/include/vad.h
diff --git a/webrtc/common_audio/vad/include/vad.h b/webrtc/common_audio/vad/include/vad.h
index 72c09492b343da4a32dc505467a3ed53d18ecb91..087970f58e25570690507ea4c26cbe89b3fefaff 100644
--- a/webrtc/common_audio/vad/include/vad.h
+++ b/webrtc/common_audio/vad/include/vad.h
@@ -12,12 +12,12 @@
#define WEBRTC_COMMON_AUDIO_VAD_INCLUDE_VAD_H_
#include "webrtc/base/checks.h"
+#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/vad/include/webrtc_vad.h"
#include "webrtc/typedefs.h"
namespace webrtc {
-// This is a C++ wrapper class for WebRtcVad.
class Vad {
public:
enum Aggressiveness {
@@ -29,21 +29,22 @@ class Vad {
enum Activity { kPassive = 0, kActive = 1, kError = -1 };
- explicit Vad(enum Aggressiveness mode);
-
- virtual ~Vad();
+ virtual ~Vad() = default;
+ // Calculates a VAD decision for the given audio frame. Valid sample rates
+ // are 8000, 16000, and 32000 Hz; the number of samples must be such that the
+ // frame is 10, 20, or 30 ms long.
virtual Activity VoiceActivity(const int16_t* audio,
size_t num_samples,
- int sample_rate_hz);
-
- // Reset VAD state.
- virtual void Reset();
+ int sample_rate_hz) = 0;
- private:
- VadInst* handle_;
- Aggressiveness aggressiveness_;
+ // Resets VAD state.
+ virtual void Reset() = 0;
};
+// Returns a Vad instance that's implemented on top of WebRtcVad.
+rtc::scoped_ptr<Vad> CreateVad(Vad::Aggressiveness aggressiveness);
+
} // namespace webrtc
+
#endif // WEBRTC_COMMON_AUDIO_VAD_INCLUDE_VAD_H_
« no previous file with comments | « no previous file | webrtc/common_audio/vad/mock/mock_vad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698