react-native-executorch 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -90,8 +90,6 @@ void SpeechToText::stream(std::shared_ptr<jsi::Function> callback,
|
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
this->resetStreamState();
|
|
94
|
-
|
|
95
93
|
this->isStreaming = true;
|
|
96
94
|
while (this->isStreaming) {
|
|
97
95
|
if (!this->readyToProcess ||
|
|
@@ -107,14 +105,13 @@ void SpeechToText::stream(std::shared_ptr<jsi::Function> callback,
|
|
|
107
105
|
|
|
108
106
|
std::string committed = this->processor->finish();
|
|
109
107
|
nativeCallback(committed, "", true);
|
|
108
|
+
|
|
109
|
+
this->resetStreamState();
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
void SpeechToText::streamStop() { this->isStreaming = false; }
|
|
113
113
|
|
|
114
114
|
void SpeechToText::streamInsert(std::span<float> waveform) {
|
|
115
|
-
if (!this->isStreaming) {
|
|
116
|
-
throw std::runtime_error("Streaming is not started");
|
|
117
|
-
}
|
|
118
115
|
this->processor->insertAudioChunk(waveform);
|
|
119
116
|
this->readyToProcess = true;
|
|
120
117
|
}
|
|
@@ -28,6 +28,7 @@ public:
|
|
|
28
28
|
void streamInsert(std::span<float> waveform);
|
|
29
29
|
|
|
30
30
|
private:
|
|
31
|
+
std::shared_ptr<react::CallInvoker> callInvoker;
|
|
31
32
|
std::unique_ptr<BaseModel> encoder;
|
|
32
33
|
std::unique_ptr<BaseModel> decoder;
|
|
33
34
|
std::unique_ptr<TokenizerModule> tokenizer;
|
|
@@ -37,7 +38,6 @@ private:
|
|
|
37
38
|
makeOwningBuffer(std::span<const float> vectorView) const;
|
|
38
39
|
|
|
39
40
|
// Stream
|
|
40
|
-
std::shared_ptr<react::CallInvoker> callInvoker;
|
|
41
41
|
std::unique_ptr<stream::OnlineASRProcessor> processor;
|
|
42
42
|
bool isStreaming;
|
|
43
43
|
bool readyToProcess;
|