Discard very short segments of voice activity

This prevents short flickers from false VAD positives.
This fixes a regression recently introduced in 2bbad258c0.
This commit is contained in:
Daniel Wolf 2019-01-21 22:32:31 +01:00
parent 21392d32cc
commit c821788569
1 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,14 @@ JoiningBoundedTimeline<void> detectVoiceActivity(
}
}
// Discard very short segments of activity
const centiseconds minSegmentLength(5);
for (const auto& segment : activity) {
if (segment.getDuration() < minSegmentLength) {
activity.clear(segment.getTimeRange());
}
}
logging::debugFormat(
"Found {} sections of voice activity: {}",
activity.size(),