alphacep / alphacep/vosk-api

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

Open
#830 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
15.1k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

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));
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.