add endpointing for online websocket server (#294)

This commit is contained in:
Fangjun Kuang
2023-08-31 14:41:04 +08:00
committed by GitHub
parent 2b0152d2a2
commit a0a747a0c0
4 changed files with 27 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ class OnlineStream::Impl {
int32_t &GetNumProcessedFrames() { return num_processed_frames_; }
int32_t &GetCurrentSegment() { return segment_; }
void SetResult(const OnlineTransducerDecoderResult &r) { result_ = r; }
OnlineTransducerDecoderResult &GetResult() { return result_; }
@@ -83,6 +85,7 @@ class OnlineStream::Impl {
ContextGraphPtr context_graph_;
int32_t num_processed_frames_ = 0; // before subsampling
int32_t start_frame_index_ = 0; // never reset
int32_t segment_ = 0;
OnlineTransducerDecoderResult result_;
std::vector<Ort::Value> states_;
std::vector<float> paraformer_feat_cache_;
@@ -123,6 +126,10 @@ int32_t &OnlineStream::GetNumProcessedFrames() {
return impl_->GetNumProcessedFrames();
}
int32_t &OnlineStream::GetCurrentSegment() {
return impl_->GetCurrentSegment();
}
void OnlineStream::SetResult(const OnlineTransducerDecoderResult &r) {
impl_->SetResult(r);
}