"Received EOS on DATA" frame after around 1 minute running
See original GitHub issueI setup a demo of the Google Cloud Speech API running on Android with AudioRecord to retrieve audio from the microphone. Its working but after a while (+/- 1 minute) the channel closes by itself. I basically used the java StreamRecognizeClient example, including the last changes to the gRPC 1.0 and the ManagedChannelBuilder There is a definition to set a timeout or am I doing something wrong here?
Here is the main code setup:
Setup channel
private static final List<String> OAUTH2_SCOPES = Arrays.asList("https://www.googleapis.com/auth/cloud-platform");
public static ManagedChannel createChannel(InputStream authorizationFile, String host, int port) throws IOException {
GoogleCredentials creds = GoogleCredentials.fromStream(authorizationFile);
creds = creds.createScoped(OAUTH2_SCOPES);
ManagedChannel channel =
ManagedChannelBuilder.forAddress(host, port)
.intercept(new ClientAuthInterceptor(creds, Executors.newSingleThreadExecutor()))
.build();
return channel;
}
Recognize setup and loop
public void recognize() throws InterruptedException, IOException {
try {
// Build and send a StreamingRecognizeRequest containing the parameters for
// processing the audio.
RecognitionConfig config =
RecognitionConfig.newBuilder()
.setEncoding(RecognitionConfig.AudioEncoding.LINEAR16)
.setSampleRate(this.RECORDER_SAMPLERATE)
//.setLanguageCode("en-US")
.build();
// Sreaming config
StreamingRecognitionConfig streamingConfig =
StreamingRecognitionConfig.newBuilder()
.setConfig(config)
.setInterimResults(true)
.setSingleUtterance(false)
.build();
// First request
StreamingRecognizeRequest initial =
StreamingRecognizeRequest.newBuilder().setStreamingConfig(streamingConfig).build();
requestObserver.onNext(initial);
// Microphone listener and recorder
recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,
this.RECORDER_SAMPLERATE,
this.RECORDER_CHANNELS,
this.RECORDER_AUDIO_ENCODING,
bufferSize);
recorder.startRecording();
byte[] buffer = new byte[bufferSize];
int recordState;
// loop through the audio samplings
while ( (recordState = recorder.read(buffer, 0, buffer.length) ) > -1 ) {
// skip if there is no data
if( recordState < 0 )
continue;
// create a new recognition request
StreamingRecognizeRequest request =
StreamingRecognizeRequest.newBuilder()
.setAudioContent(ByteString.copyFrom(buffer, 0, buffer.length))
.build();
// put it on the works
requestObserver.onNext(request);
}
} catch (RuntimeException e) {
// Cancel RPC.
requestObserver.onError(e);
throw e;
}
// Mark the end of requests.
requestObserver.onCompleted();
}
The full code is in this repo: https://github.com/Cloudoki/android-google-cloud-speech-api
Need some help here, because I’m not figuring it out!
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
grpc getting a "Received unexpected EOS on DATA frame ...
I'm trying to load a table with around 3 billion rows (311 GB) in pyspark like this: df = spark.read.format('bigquery').option('table', ...
Read more >Received unexpected EOS on empty DATA frame from server
This seems to happen when the request has been running for an hour. Therefore, we thought this was a time-out and we increased...
Read more >GRPC call failing with error "Received unexpected EOS on ...
Sometimes calls are successful, while sometimes it fails with exception Received unexpected EOS on DATA frame from server.
Read more >EOS 4.29.0F - Data Transfer - Arista
Data Transfer Arista switches support the transfer of packets (network layer) and frames (data link layer). This chapter describes concepts and processes ...
Read more >Canon EOS R5- Things you need to know if you are recording ...
Because High Frame Rate movies are recorded as 29.97 fps/25.00 fps movie files, they are played in slow motion at 1/4 speed. ISO...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ricmalta Can you please take a look at https://github.com/GoogleCloudPlatform/android-docs-samples/tree/master/speech/Speech
This appears to have been resolved. Closing this issue. Feel free to reopen.