assistant-sdk-cpp icon indicating copy to clipboard operation
assistant-sdk-cpp copied to clipboard

assistant_sdk failed, error: OS Error

Open sunjunlishi opened this issue 7 years ago • 6 comments

Init ok,and write data ok,but response always "OS Error";Some times ok. ubuntu

sunjunlishi avatar Apr 09 '18 03:04 sunjunlishi

mpChannel->GetState() when state is GRPC_CHANNEL_IDLE,it is ok. but when state is GRPC_CHANNEL_READY,the oper result will be bad.

sunjunlishi avatar Apr 09 '18 06:04 sunjunlishi

Is there any other information you can provide, such as a way to reproduce this error?

Fleker avatar Apr 09 '18 19:04 Fleker

run_assistant.cc

grpc::Status status = stream1->Finish(); if (!status.ok()) { // Report the RPC failure. std::cerr << "assistant_sdk failed, error: " << status.error_message() << std::endl; return false; }****

sunjunlishi avatar Apr 10 '18 12:04 sunjunlishi


my use is saving channel state:

	mpChannel = CreateChannel(api_endpoint);
		assistant = std::unique_ptr<EmbeddedAssistant::Stub>(
			EmbeddedAssistant::NewStub(mpChannel));

every time use send and receive:

if (context != NULL) { delete context; context = NULL; } context = new grpc::ClientContext; context->set_fail_fast(false); context->set_credentials(call_credentials); stream1 = std::shared_ptr<ClientReaderWriter<ConverseRequest, ConverseResponse>>(std::move(assistant->Converse(context)));

::google::assistant::embedded::v1alpha1::ConverseConfig* converse_config = request1.mutable_config(); converse_config->mutable_audio_in_config()->set_encoding(AudioInConfig::LINEAR16); converse_config->mutable_audio_in_config()->set_sample_rate_hertz(16000); converse_config->mutable_audio_out_config()->set_encoding(AudioOutConfig::MP3); converse_config->mutable_audio_out_config()->set_sample_rate_hertz(16000);

	stream1->Write(request1);
           while (stream1->Read(&response))
	{  
		if ((response.has_error() || response.has_audio_out() ||
			response.event_type() == ConverseResponse_EventType_END_OF_UTTERANCE))
		{
			//printf(" Synchronously stops audio input.");
			//audio_input->Stop();
		}

		if (response.has_audio_out())
		{
		
                      }
             }

it works ok on windows system,but some times error in ubuntu

sunjunlishi avatar Apr 10 '18 12:04 sunjunlishi

It looks like you're using an earlier version of the sample, such as using API version v1alpha1. You may want to consider updating to a newer version which uses v1alpha2 and has additional features like text input and output. It may also be slightly more reliable.

I am not familiar with the error that you've been getting.

Fleker avatar Apr 10 '18 17:04 Fleker

ok i will have a try

sunjunlishi avatar Apr 11 '18 01:04 sunjunlishi