MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cpp-samples / main

Function main

speech/api/streaming_transcribe_coroutines.cc:112–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112int main(int argc, char* argv[]) try {
113 // Create a CompletionQueue to demux the I/O and other asynchronous
114 // operations, and dedicate a thread to it.
115 g::CompletionQueue cq;
116 auto runner = std::thread{[](auto cq) { cq.Run(); }, cq};
117 // Shutdown the completion queue and join the thread.
118 std::shared_ptr<void> auto_shutdown(nullptr, [&](void*) {
119 cq.Shutdown();
120 runner.join();
121 });
122
123 // Run a streaming transcription. Note that `.get()` blocks until it
124 // completes.
125 auto status = StreamingTranscribe(cq, ParseArguments(argc, argv)).get();
126
127 if (!status.ok()) {
128 std::cerr << "Error in transcribe stream: " << status << "\n";
129 return 1;
130 }
131 return 0;
132} catch (std::exception const& ex) {
133 std::cerr << "Standard C++ exception thrown: " << ex.what() << "\n"
134 << kUsage << "\n";
135 return 1;
136}

Callers

nothing calls this directly

Calls 2

StreamingTranscribeFunction · 0.85
ParseArgumentsFunction · 0.70

Tested by

no test coverage detected