Skip to content

Commit

Permalink
use clear() to reset vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tmacwill committed Feb 8, 2022
1 parent b7ae361 commit a0d0e72
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/src/chunk_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void ChunkProcessor::Process(short* input) {
if (speaking_ &&
consecutiveSilence_ == options_.consecutiveFramesForSilence) {
speaking_ = false;
leadingBuffer_ = std::vector<short>();
leadingBuffer_.clear();
if (options_.onChunkEnd != nullptr) {
options_.onChunkEnd();
}
Expand All @@ -173,11 +173,11 @@ void ChunkProcessor::Reset() {
consecutiveSilence_ = 0;
consecutiveSpeaking_ = 0;
framesUntilSileroVad_ = 0;
leadingBuffer_ = std::vector<short>();
leadingBuffer_.clear();
speaking_ = false;
webrtcVad_.Reset();
webrtcVadBuffer_ = std::vector<short>();
webrtcVadResults_ = std::vector<bool>();
webrtcVadBuffer_.clear();
webrtcVadResults_.clear();
short* audio;
while (queue_.try_dequeue(audio)) {
}
Expand Down

0 comments on commit a0d0e72

Please sign in to comment.