alphacep / alphacep/vosk-api

Android RecognizerThread should generate OnError instead of runtimeException when nread < 0

Aperta
#830 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Jupyter Notebook
Stelle
15.1k
Fork
1.8k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

The problem is when there is a problem with Android AudioRecord, the error condition generates a runtime exception that can't be trapped within my app.

The problem is in: /vosk-api/android/lib/src/main/java/org/vosk/android/SpeechService.java

At line 227, instead of generating a runtime exception, it would be better if it could generate something that ends up in "onError". This is my suggested code fix.

if (nread < 0) {
IOException ioe = new IOException(
"error reading audio buffer. code= " + nread);
mainHandler.post(() -> listener.onError(ioe));
}

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.