IVoiceCodec
- Module
- VoiceChat
- Header
#include "VoiceChat/IVoiceCodec.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
virtual ~IVoiceCodec() = default | ~IVoiceCodec |
Public functions
| Returns | Name | Description |
|---|---|---|
EVoiceCodecId | GetCodecId | |
const char* | GetName | |
uint32_t | GetSampleRate | |
uint32_t | GetFrameSamples | |
std::unique_ptr<IVoiceDecoder> | CreateDecoder | A fresh per-stream decoder. |
uint32_t | GetMaxEncodedBytes | Upper bound on the encoded size of one frame. |
bool | EncodeFrame | Encodes exactly GetFrameSamples() samples into out (cleared first, never grown past GetMaxEncodedBytes). |
bool | DecodeFrame | Decodes one payload back into exactly GetFrameSamples() samples. |
bool | SupportsInbandFec | True when the codec embeds a coarse copy of the previous frame in every payload, so one lost frame can be rebuilt from its successor instead of concealed. |
bool | DecodeFecFrame | Reconstructs the frame that PRECEDES nextPacket out of the redundancy inside it, and must run before nextPacket itself is decoded — the decoder walks the two in order. |
Function details
~IVoiceCodec
virtual ~IVoiceCodec() = defaultGetCodecId
virtual EVoiceCodecId GetCodecId() const = 0GetName
virtual const char* GetName() const = 0GetSampleRate
virtual uint32_t GetSampleRate() const = 0GetFrameSamples
virtual uint32_t GetFrameSamples() const = 0CreateDecoder
virtual std::unique_ptr<IVoiceDecoder> CreateDecoder() const = 0A fresh per-stream decoder. Never shared between speakers.
GetMaxEncodedBytes
virtual uint32_t GetMaxEncodedBytes() const = 0Upper bound on the encoded size of one frame. Callers reserve against this once so the steady state never reallocates.
EncodeFrame
virtual bool EncodeFrame(const int16_t* samples, uint32_t sampleCount, std::vector<uint8_t>& out) = 0Encodes exactly GetFrameSamples() samples into out (cleared first, never grown past GetMaxEncodedBytes). False on a wrong sample count.
DecodeFrame
virtual bool DecodeFrame(const uint8_t* data, size_t len, std::vector<int16_t>& out) = 0Decodes one payload back into exactly GetFrameSamples() samples. False on a truncated or malformed payload — a hostile peer must not be able to talk the decoder into writing an unbounded block.
SupportsInbandFec
virtual bool SupportsInbandFec() constTrue when the codec embeds a coarse copy of the previous frame in every payload, so one lost frame can be rebuilt from its successor instead of concealed.
DecodeFecFrame
virtual bool DecodeFecFrame(const uint8_t*, size_t, std::vector<int16_t>&)Reconstructs the frame that PRECEDES nextPacket out of the redundancy inside it, and must run before nextPacket itself is decoded — the decoder walks the two in order. False when the codec carries no redundancy, or this packet happens to carry none.