- performance optimizations

This commit is contained in:
2026-06-17 14:18:31 +03:00
parent 40f3b34b16
commit 2cb2a93d59
7 changed files with 177 additions and 32 deletions
+11
View File
@@ -33,6 +33,13 @@ protected:
int mPreviousPacketLength = 0;
size_t mCngCounter = 0;
size_t mSwitchCounter = 0;
// opencore-amr encoder/decoder state is allocated lazily on first encode/decode.
// Network-MOS-only streams resolve codec metadata (name/samplerate/frame timing)
// but never decode, so they must not pay for a context they never use - at scale
// this is ~a decoder state (several KB) saved per network-only stream.
void ensureEncoder();
void ensureDecoder();
public:
class CodecFactory: public Factory
{
@@ -85,6 +92,10 @@ protected:
int mPreviousPacketLength;
// Decoder state is allocated lazily on first decode/plc (see AmrNbCodec) so
// network-MOS-only streams never instantiate the AMR-WB decoder.
void ensureDecoder();
DecodeResult decodeIuup(std::span<const uint8_t> input, std::span<uint8_t> output);
DecodeResult decodePlain(std::span<const uint8_t> input, std::span<uint8_t> output);