我是一个为集装箱维修设施实施语音识别的应用程序;它基于gRPC异步识别,并且一直运行良好,具有良好的转录时间(要转录的音频通常很短,从1到8秒)。 该应用程序已经使用了一段时间,现在Speech API已经成为GA,我不得不使用它,因为使用旧库我总是获得一个UNAUTHENTICATED错误打开che通信通道。 问题是转录时间比v1beta1高;对于单个单词转录(" Lista",例如)它需要不少于3秒,但标准是5秒,从客户的角度来看有点不可接受。从logcat,你可以看到所花费的时间(在这个特殊情况下8秒,从requestObserver.onComplete事件到转录)我也看到一些奇怪的警告,不是从我的代码生成的:
07-18 11:09:32.705 9872-10459/it.sia.contrepair D/it.sia.contrepair: src, wPos=25096,rPos=24576,toRead=520
07-18 11:09:32.705 9872-10459/it.sia.contrepair D/it.sia.contrepair: src.requestObserver.onComplete()
07-18 11:09:32.706 9872-10459/it.sia.contrepair D/it.sia.contrepair: src.dataSendThread.finishLatch.await
07-18 11:09:32.714 9872-10346/it.sia.contrepair D/it.sia.contrepair: Stop read runnable
07-18 11:09:40.285 9872-10606/it.sia.contrepair W/UnsafeUtil: platform method missing - proto runtime falling back to safer methods: java.lang.NoSuchMethodException: getByte [long]
07-18 11:09:40.286 9872-10606/it.sia.contrepair W/UnsafeUtil: platform method missing - proto runtime falling back to safer methods: java.lang.NoSuchMethodException: getByte [class java.lang.Object, long]
07-18 11:09:40.287 9872-10606/it.sia.contrepair W/UnsafeUtil: copyMemory is missing from platform - proto runtime falling back to safer methods.
07-18 11:09:40.769 9872-10606/it.sia.contrepair D/it.sia.contrepair: results {
alternatives {
transcript: "lista"
confidence: 0.93588203
}
alternatives {
transcript: "Lista"
}
alternatives {
transcript: "vista"
}
is_final: true
}
07-18 11:09:42.706 9872-10459/it.sia.contrepair D/it.sia.contrepair: src.dataSendThread.finishLatch exited
07-18 11:09:42.706 9872-10459/it.sia.contrepair D/it.sia.contrepair: src.shutting down channel
07-18 11:09:42.713 9872-10459/it.sia.contrepair D/it.sia.contrepair: src.channel shutted down
警告并不总是会发生,正如您可以从第二个logcat摘录中看到的那样:
07-18 11:10:26.404 9872-11328/it.sia.contrepair D/it.sia.contrepair: src.requestObserver.onComplete()
07-18 11:10:26.404 9872-11328/it.sia.contrepair D/it.sia.contrepair: src.dataSendThread.finishLatch.await
07-18 11:10:26.413 9872-11233/it.sia.contrepair D/it.sia.contrepair: Stop read runnable
07-18 11:10:29.853 9872-11431/it.sia.contrepair D/it.sia.contrepair: results {
alternatives {
transcript: "annulla"
confidence: 0.9913793
}
is_final: true
}
07-18 11:10:29.947 9872-9888/it.sia.contrepair D/it.sia.contrepair: onStart
07-18 11:10:29.952 9872-11431/it.sia.contrepair D/it.sia.contrepair: src.responseObserver.onCompleted()
07-18 11:10:29.953 9872-11328/it.sia.contrepair D/it.sia.contrepair: src.dataSendThread.finishLatch exited
07-18 11:10:29.953 9872-11328/it.sia.contrepair D/it.sia.contrepair: src.shutting down channel
07-18 11:10:29.954 9872-11328/it.sia.contrepair D/it.sia.contrepair: src.channel shutted down
这是Android Studio依赖项:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/dsp-collection.jar')
compile files('libs/javaFlacEncoder-0.3.1.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'io.grpc:grpc-auth:1.4.0'
compile 'io.grpc:grpc-okhttp:1.4.0'
compile 'io.grpc:grpc-stub:1.4.0'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.google.auth:google-auth-library-oauth2-http:0.7.1'
compile 'joda-time:joda-time:2.9.9'
compile 'com.google.api.grpc:grpc-google-cloud-speech-v1:0.1.13'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.google.code.findbugs:jsr305:3.0.0'
}
是否有人使用Google Cloud Speech开发了应用程序并遇到了同样的问题?
感谢。 鲁道夫。