From a0d0e72d9ac1f8a63c7681e9c2b7eec5f1ecb972 Mon Sep 17 00:00:00 2001 From: Tommy MacWilliam Date: Tue, 8 Feb 2022 15:37:09 -0800 Subject: [PATCH] use clear() to reset vectors --- lib/src/chunk_processor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/chunk_processor.cpp b/lib/src/chunk_processor.cpp index 7000308..7eb8a56 100644 --- a/lib/src/chunk_processor.cpp +++ b/lib/src/chunk_processor.cpp @@ -162,7 +162,7 @@ void ChunkProcessor::Process(short* input) { if (speaking_ && consecutiveSilence_ == options_.consecutiveFramesForSilence) { speaking_ = false; - leadingBuffer_ = std::vector(); + leadingBuffer_.clear(); if (options_.onChunkEnd != nullptr) { options_.onChunkEnd(); } @@ -173,11 +173,11 @@ void ChunkProcessor::Reset() { consecutiveSilence_ = 0; consecutiveSpeaking_ = 0; framesUntilSileroVad_ = 0; - leadingBuffer_ = std::vector(); + leadingBuffer_.clear(); speaking_ = false; webrtcVad_.Reset(); - webrtcVadBuffer_ = std::vector(); - webrtcVadResults_ = std::vector(); + webrtcVadBuffer_.clear(); + webrtcVadResults_.clear(); short* audio; while (queue_.try_dequeue(audio)) { }