alphacep / alphacep/vosk-api

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

未关闭
#830 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
15.1k
派生
1.8k
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。