Merge pull request #1366 from daleglass/fix-pcmaudio-crash

Fix crash due to audio packet loss with PCM and zlib codecs.
This commit is contained in:
Kalila 2021-09-30 17:07:56 -04:00 committed by GitHub
commit 15907d18e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -8,7 +8,7 @@
set(TARGET_NAME pcmCodec)
setup_hifi_client_server_plugin()
link_hifi_libraries(shared plugins)
link_hifi_libraries(shared audio plugins)
if (BUILD_SERVER)
install_beside_console()

View file

@ -13,6 +13,7 @@
#define hifi__PCMCodecManager_h
#include <plugins/CodecPlugin.h>
#include <AudioConstants.h>
class PCMCodec : public CodecPlugin, public Encoder, public Decoder {
Q_OBJECT
@ -44,6 +45,7 @@ public:
}
virtual void lostFrame(QByteArray& decodedBuffer) override {
decodedBuffer.resize(AudioConstants::NETWORK_FRAME_BYTES_STEREO);
memset(decodedBuffer.data(), 0, decodedBuffer.size());
}
@ -81,6 +83,7 @@ public:
}
virtual void lostFrame(QByteArray& decodedBuffer) override {
decodedBuffer.resize(AudioConstants::NETWORK_FRAME_BYTES_STEREO);
memset(decodedBuffer.data(), 0, decodedBuffer.size());
}