So we are trying to capture audio and compress it using opus.
Capturing (and also playing back and doing other stuff) the audio works just fine, no problems.
This is how we create the encoder:
Encoder = FVoiceModule::Get().CreateVoiceEncoder(48000, 1, EAudioEncodeHint::VoiceEncode_Voice);
This is how we capture:
VoiceCapture->GetVoiceData(CaptureBuffer.GetData(), bytesAvailable, readBytes, sampleCount);
This is how we call to encode:
Encoder->Encode(CaptureBuffer.GetData(), readBytes, EncodeBuffer.GetData(), encodeBytes);
We know we do always capture data, since we log readBytes.
It also works perfectly fine in the editor or in editor “standalone”. However, it doesnt really seem to work in a packaged build. Though, the odd thing is, SOMETIMES randomly it works.
The log just says:
[2021.03.04-10.47.24:893][362]LogTemp: Warning: (VoiceChat) Volume: 5.731047 Buffer: 8 kb
[2021.03.04-10.47.24:893][362]LogVoiceEncode: Warning: Failed to encode: -1] invalid argument