If I send no data to a Google Speech-to-Text (V2) session for 10 seconds, it throws the following error:
Error during recognition: Status(StatusCode="Cancelled", Detail="No grpc-status found on response. Using gRPC with WinHttp has Windows and package version requirements. See https://aka.ms/aspnet/grpc/netstandard for details.")
Is this expected behavior for the Speech-to-Text streaming endpoint? Can anyone provide documentation or further details on this?
Hi @sibaji,
Welcome to Google Cloud Community!
It seems you're encountering an issue with the Google Speech-to-Text API when no data is being sent for a period of time. The error message suggests that the gRPC connection may be interrupted or canceled due to inactivity.
Although this behavior isn't explicitly mentioned in the official Google Cloud Speech-to-Text documentation, it's likely that the streaming endpoint expects a continuous stream of data and may terminate the session if no data is received for a certain duration.
Here’s a breakdown of possible approaches you can consider to address the issue:
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
Thanks, @ibaui, for the reply! I will go through the approaches you suggested and let you know the outcome. Thanks again!
Approach 1 seems to be working. If no audio content is available, sending silent audio data prevents the call from terminating.
await stream.WriteAsync(new StreamingRecognizeRequest
{
StreamingConfig = _streamingConfig,
Audio = Google.Protobuf.ByteString.CopyFrom(new byte[640]),
Recognizer = _recognizerPath
});
Approach 2:
I attempted to set up KEEP-ALIVE for the gRPC call settings, but it didn't work as expected. @ibaui could you please guide me on how to implement this correctly?
Here is what I tried:
var _clientBuider = new SpeechClientBuilder
{
GoogleCredential = googleCredential,
Endpoint = "us-central1-speech.googleapis.com"//,
GrpcChannelOptions =GrpcChannelOptions.Empty
};
_clientBuider.GrpcChannelOptions = _clientBuider.GrpcChannelOptions.WithKeepAliveTime(TimeSpan.FromMilliseconds(5000));
var _client =_clientBuider.Build();
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |