diff --git a/daemon/src/audio/audiortp/audio_rtp_stream.cpp b/daemon/src/audio/audiortp/audio_rtp_stream.cpp index 00e8c1770880661554158794ca47c7836258fc1f..a364c47603fdc06c1c244c1bde595a2884407e61 100644 --- a/daemon/src/audio/audiortp/audio_rtp_stream.cpp +++ b/daemon/src/audio/audiortp/audio_rtp_stream.cpp @@ -344,13 +344,11 @@ size_t AudioRtpStream::processDataEncode() return 0; } - const auto frameSize = out->frames(); const auto codecFrameSize = codec->getFrameSize(); - if (codecFrameSize > frameSize) { + if (codecFrameSize > out->frames()) { // PCM too small (underflow), add zero padding to avoid reading past // end of buffer when encoding, for every channel - for (auto &c : out->getData()) - c.resize(codecFrameSize, 0); + out->resize(codecFrameSize); } size_t encoded = codec->encode(out->getData(), encodedData_.data(), encodedData_.size());