Pass encoded chunks as shared_ptr

This commit is contained in:
badaix 2020-02-29 21:48:12 +01:00
parent d9d403d729
commit 63ad64dfff
10 changed files with 15 additions and 21 deletions

View file

@ -98,7 +98,7 @@ void OggEncoder::encode(const msg::PcmChunk* chunk)
/* tell the library how much we actually submitted */
vorbis_analysis_wrote(&vd_, frames);
auto* oggChunk = new msg::PcmChunk(chunk->format, 0);
auto oggChunk = make_shared<msg::PcmChunk>(chunk->format, 0);
/* vorbis does some data preanalysis, then divvies up blocks for
more involved (potentially parallel) processing. Get a single
@ -149,8 +149,6 @@ void OggEncoder::encode(const msg::PcmChunk* chunk)
oggChunk->payloadSize = pos;
listener_->onChunkEncoded(this, oggChunk, res);
}
else
delete oggChunk;
}