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

Unified Diff: webrtc/common_audio/vad/vad.cc

Issue 1322973004: Fold AudioEncoderMutable into AudioEncoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review fixes 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 | « webrtc/common_audio/vad/mock/mock_vad.h ('k') | webrtc/modules/audio_coding/codecs/audio_encoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/vad/vad.cc
diff --git a/webrtc/common_audio/vad/vad.cc b/webrtc/common_audio/vad/vad.cc
index 764d024cbd36a0abd7bcc9a7cee6ca5ff61d6bae..dc4eb6db3246d488d85e23e155ff305ab0099170 100644
--- a/webrtc/common_audio/vad/vad.cc
+++ b/webrtc/common_audio/vad/vad.cc
@@ -14,11 +14,8 @@
namespace webrtc {
-Vad::Vad(enum Aggressiveness mode) {
- handle_ = WebRtcVad_Create();
- CHECK(handle_);
- CHECK_EQ(WebRtcVad_Init(handle_), 0);
- CHECK_EQ(WebRtcVad_set_mode(handle_, mode), 0);
+Vad::Vad(enum Aggressiveness mode) : handle_(nullptr), aggressiveness_(mode) {
+ Reset();
}
Vad::~Vad() {
@@ -40,4 +37,13 @@ enum Vad::Activity Vad::VoiceActivity(const int16_t* audio,
}
}
+void Vad::Reset() {
+ if (handle_)
+ WebRtcVad_Free(handle_);
+ handle_ = WebRtcVad_Create();
+ CHECK(handle_);
+ CHECK_EQ(WebRtcVad_Init(handle_), 0);
+ CHECK_EQ(WebRtcVad_set_mode(handle_, aggressiveness_), 0);
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/common_audio/vad/mock/mock_vad.h ('k') | webrtc/modules/audio_coding/codecs/audio_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698