fix(vad): add support for vad reset directly without stream close#5687
fix(vad): add support for vad reset directly without stream close#5687chenghao-mou wants to merge 8 commits into
Conversation
add vad stream reset method directly so that we don't have to close the stream or task this closes #5674
| Only effective when the underlying VAD advertises | ||
| `VADCapabilities.supports_reset`. For implementations that do not | ||
| support reset, the sentinel is silently dropped; callers that need a |
There was a problem hiding this comment.
should we raise an error when reset is not supported?
There was a problem hiding this comment.
good point. I'll add that.
There was a problem hiding this comment.
now we use the hard reset when it doesn't support flush.
| def flush(self) -> None: | ||
| """Mark the end of the current segment""" | ||
| self._check_input_not_ended() | ||
| self._check_not_closed() | ||
| self._input_ch.send_nowait(self._FlushSentinel()) |
There was a problem hiding this comment.
Do you think we need reset? Maybe flush could just do it?
There was a problem hiding this comment.
flush in silero is ignored today. we can reuse the signal to do the reset job.
|
Hi team! Thanks for working on this 🙏 This bug is really hurting our voice agent in production, user experience is bad because of it. Can you please try to include it in the next release? Thanks! |
| supports_flush: bool = False | ||
| """Whether flush() is honored as a segment boundary that clears accumulated state.""" |
There was a problem hiding this comment.
Not sure if we need that, I think every VAD should support flush
There was a problem hiding this comment.
Calling it would be a no-op worst case
| supports_flush: bool = False | ||
| """Whether flush() is honored as a segment boundary that clears accumulated state.""" |
There was a problem hiding this comment.
Calling it would be a no-op worst case
add vad stream reset method directly so that we don't have to close the stream or task
resetting directly with a new resampler and buffer zero-fill should take less than 0.1ms.
this closes #5674