Hi. Version Protobuf: v3.17.3 Language: PHP. The web portal is developed on the basis of the YII2 framework. I have downloaded the PHP SDK for Cloud Speech-to-Text for converting recorded audio (mp3) speech to text. This extension uses Protobuf to work with audio streams.
With this request, I send an audio file for transcription: https://cloud.google.com/speech-to-text/docs/samples/speech-transcribe-async#speech_transcribe_async-php In my controller it looks like this: " $audioFile = $_SERVER['DOCUMENT_ROOT'] . '/frontend/web/audiofiles/380633470210_2021-05-13 115637.mp3'; // change these variables if necessary $encoding = AudioEncoding::MP3; $sampleRateHertz = 44100; $languageCode = 'uk-UA'; // get contents of a file into a string $content = file_get_contents($audioFile); // set string as audio content $audio = (new RecognitionAudio()) ->setContent($content); // set config $config = (new RecognitionConfig()) ->setEncoding($encoding) ->setSampleRateHertz($sampleRateHertz) ->setLanguageCode($languageCode); // create the speech client $client = new SpeechClient(); // create the asyncronous recognize operation $operation = $client->longRunningRecognize($config, $audio); $operation->pollUntilComplete(); if ($operation->operationSucceeded()) { $response = $operation->getResult(); $comment = ''; // each result is for a consecutive portion of the audio. iterate // through them to get the transcripts for the entire audio file. foreach ($response->getResults() as $result) { $alternatives = $result->getAlternatives(); $mostLikely = $alternatives[0]; $transcript = $mostLikely->getTranscript(); $confidence = $mostLikely->getConfidence(); $comment .= '(' . $confidence . '): ' . $transcript . PHP_EOL; } } $client->close(); " On the local version of the site (Openserver, PHP 7.1.32, Apache API 20120211) everything works - I get lines of transcribed text in the $comment variable. On hosting (PHP 7.3.15-3 + ubuntu16.04.1 + deb.sury.org, Apache/2.4.41) I get an error: "Google\Protobuf\Internal\GPBDecodeException: Error occurred during parsing: Fail to push limit. in /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedInputStream.php:367 Stack trace: #0 /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedInputStream.php(390): Google\Protobuf\Internal\CodedInputStream->pushLimit(917) #1 /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWire.php(286): Google\Protobuf\Internal\CodedInputStream->incrementRecursionDepthAndPushLimit(917, 0, 0) #2 /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(437): Google\Protobuf\Internal\GPBWire::readMessage(Object(Google\Protobuf\Internal\CodedInputStream), Object(Google\Protobuf\Internal\FileDescriptorProto)) #3 /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(527): Google\Protobuf\Internal\Message::parseFieldFromStreamNoTag(Object(Google\Protobuf\Internal\CodedInputStream), Object(Google\Protobuf\Internal\FieldDescriptor), Object(Google\Protobuf\Internal\FileDescriptorProto)) #4 /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(823): Google\Protobuf\Internal\Message->parseFieldFromStream(10, Object(Google\Protobuf\Internal\CodedInputStream), Object(Google\Protobuf\Internal\FieldDescriptor)) #5 /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(787): Google\Protobuf\Internal\Message->parseFromStream(Object(Google\Protobuf\Internal\CodedInputStream)) #6 /var/www/4servicetp_ru/bat/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorPool.php(61): Google\Protobuf\Internal\Message->mergeFromString('\n\x95\x07\n,google/clo...') #7 /var/www/4servicetp_ru/bat/vendor/google/cloud-speech/metadata/V1P1Beta1/Resource.php(42): Google\Protobuf\Internal\DescriptorPool->internalAddGeneratedFile('\n\x95\x07\n,google/clo...', true) #8 /var/www/4servicetp_ru/bat/vendor/google/cloud-speech/metadata/V1P1Beta1/CloudSpeech.php(21): GPBMetadata\Google\Cloud\Speech\V1P1Beta1\Resource::initOnce() #9 /var/www/4servicetp_ru/bat/vendor/google/cloud-speech/src/V1p1beta1/SpeechContext.php(79): GPBMetadata\Google\Cloud\Speech\V1P1Beta1\CloudSpeech::initOnce() #10 /var/www/4servicetp_ru/bat/backend/controllers/AnketaController.php(748): Google\Cloud\Speech\V1p1beta1\SpeechContext->__construct() #11 [internal function]: backend\controllers\AnketaController->actionTranscribe('9') #12 /var/www/4servicetp_ru/bat/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #13 /var/www/4servicetp_ru/bat/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array) #14 /var/www/4servicetp_ru/bat/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('transcribe', Array) #15 /var/www/4servicetp_ru/bat/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('anketa/transcri...', Array) #16 /var/www/4servicetp_ru/bat/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request)) #17 /var/www/4servicetp_ru/bat/backend/web/index.php(17): yii\base\Application->run()" The error itself occurs directly in the application code (https://github.com/protocolbuffers/protobuf/blob/master/php/src/Google/Protobuf/Internal/CodedInputStream.php): " public function pushLimit($byte_limit) { // Current position relative to the beginning of the stream. $current_position = $this->current(); $old_limit = $this->current_limit; // security: byte_limit is possibly evil, so check for negative values // and overflow. if ($byte_limit >= 0 && $byte_limit <= PHP_INT_MAX - $current_position && $byte_limit <= $this->current_limit - $current_position) { $this->current_limit = $current_position + $byte_limit; $this->recomputeBufferLimits(); } else { throw new GPBDecodeException("Fail to push limit."); } return $old_limit; } " I talked about this issue in a chat with a Google specialist and he directed me here, because in his opinion the problem is precisely in the work of Protobuf. I would be grateful for opinions and tips on what could be the cause of this error. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/d6fa3499-ef38-4791-9634-242f255756b9n%40googlegroups.com.
