Fix PCM and zlib codec audio crash on packet loss

This commit is contained in:
Dale Glass 2021-09-25 23:02:16 +02:00
parent 891d555679
commit 2abff7b878
2 changed files with 3 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());
}