MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / finalize_stream

Method finalize_stream

src/models/silero_vad/runtime.cpp:645–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

643 return event;
644}
645
646runtime::TaskResult SileroRuntime::finalize_stream(const SileroVADConfig & config) const {
647 const auto total_start = Clock::now();
648 runtime::TaskResult result;
649 for (const auto & segment : streamed_segments_) {
650 result.speech_segments.push_back({
651 {segment.start, segment.end},
652 config.threshold,
653 {},
654 });
655 }
656 const int64_t min_speech_samples = static_cast<int64_t>(kSampleRate) * config.min_speech_duration_ms / 1000;
657 if (triggered_ && (current_sample_ - current_speech_start_) > min_speech_samples) {
658 result.speech_segments.push_back({
659 {current_speech_start_, current_sample_},
660 config.threshold,
661 {},
662 });
663 }
664 engine::debug::timing_log_scalar("silero_vad.streaming.finalize_ms", engine::debug::elapsed_ms(total_start));
665 return result;
666}

Callers 1

finalizeMethod · 0.80

Calls 2

timing_log_scalarFunction · 0.50
elapsed_msFunction · 0.50

Tested by

no test coverage detected