sipxmedialib
Version 3.3
|
#include <MpPlcBase.h>
Static Protected Attributes | |
static UtlString | smDefaultAlgorithm |
Name of algorithm to be used by default. More... | |
Creators | |
static MpPlcBase * | createPlc (const UtlString &name="") |
Factory method for PLC algorithms creation. More... | |
virtual OsStatus | init (int samplesPerSec)=0 |
Initialize PLC with given sample rate and frame size. More... | |
virtual | ~MpPlcBase () |
Virtual base destructor. More... | |
virtual void | reset ()=0 |
Reset. More... | |
virtual void | fullReset ()=0 |
Full reset followed by init call. More... | |
Manipulators | |
static void | setDefaultAlgorithm (const UtlString &name) |
Set algorithm to be used by default. More... | |
virtual OsStatus | insertToHistory (int frameNum, const MpSpeechParams &speechParams, MpAudioSample *pBuf, unsigned inSamplesNum)=0 |
Update PLC history with late/future frame. More... | |
virtual OsStatus | processFrame (MpSpeechParams &speechParams, MpAudioSample *pBuf, unsigned bufferSize, unsigned inSamplesNum, unsigned outSamplesNum, int wantedAdjustment, int &madeAdjustment)=0 |
Process next frame - do PLC and/or adjustment if needed. More... | |
Accessors | |
virtual int | getMaxDelayedFramesNum () const =0 |
Return maximum offset for delayed frame with respect to current. More... | |
virtual int | getMaxFutureFramesNum () const =0 |
Return maximum offset for future frame with respect to current. More... | |
virtual int | getAlgorithmicDelay () const =0 |
Return algorithmic delay in samples, should be called after init. More... | |
Base class for all PLC algorithms.
To create concrete class you could directly instantiate it or use MpPlcBase::createPlc() static method for greater flexibility.
|
inlinevirtual |
Virtual base destructor.
|
static |
Factory method for PLC algorithms creation.
[in] | name | - name of PLC algorithm to use. Use empty string to get default algorithm. |
|
pure virtual |
Initialize PLC with given sample rate and frame size.
Should be called before any other class methods.
Implemented in MpPlcSilence.
|
pure virtual |
Reset.
Implemented in MpPlcSilence.
|
pure virtual |
Full reset followed by init call.
Implemented in MpPlcSilence.
|
pure virtual |
Update PLC history with late/future frame.
[in] | frameNum | - position of passed data relative to current moment. E.g. frameNum<0 means late frame, frameNum>0 means future frame and frameNum==0 means current frame. Passing late and future frames may improve PLC quality if algorithm supports this. Passing late and future frames they should be in bounds set by of getMaxFutureFramesNum() and getMaxDelayedFramesNum(). |
[in] | speechParams | - various parameters of speech. |
[in,out] | pBuf | - buffer with input data. |
[in] | inSamplesNum | - number of samples of actual data, passed to this function. |
Implemented in MpPlcSilence.
|
pure virtual |
Process next frame - do PLC and/or adjustment if needed.
[in] | speechParams | - various parameters of speech. |
[in,out] | pBuf | - buffer with input data and place for output data. Data is read from this buffer if numSamples>0 . If any processing is needed, i.e. PLC or adjustment is requested, output data will also be written to this buffer. |
[in] | bufferSize | - size of pBuf buffer. This value is always greater or equal to numSamples . When algorithm needs to write data to buffer it must take this value into account. |
[in] | inSamplesNum | - number of samples of actual data, passed to this function. If we've got no data and PLC is needed, this parameter should be equal to 0. If inSamplesNum is not 0, it is equal to outSamplesNum . |
[in] | outSamplesNum | - output frame size. Together with wantedAdjustment this value sets bounds in which we want to fit output data length. See wantedAdjustment for more details. If inSamplesNum is not 0, outSamplesNum is equal to it. |
[in] | wantedAdjustment | - number of samples by which we want to adjust audio stream. Output number of samples must be in range [outSamplesNum ; outSamplesNum + wantedAdjustment ]. Output lengths closer to outSamplesNum + wantedAdjustment are desired, but not required. Note, that output lengths not in this range are not allowed and may confuse upper levels. Positive values request stream extension (samples should be added), negative values request stream reduction (samples should be took off). |
[out] | madeAdjustment | - length of made adjustment. Shows how many samples were added to stream (if positive) or removed from stream (if negative). |
Implemented in MpPlcSilence.
|
static |
Set algorithm to be used by default.
Initially default algorithm is defined at compile time. Using this function you can change default algorithm at run-time or switch back to compile-time default.
[in] | name | - name of algorithm to use by default. Reverts to compile-time default if empty. |
|
pure virtual |
Return maximum offset for delayed frame with respect to current.
If zero is returned, late packets are not allowed.
Implemented in MpPlcSilence.
|
pure virtual |
Return maximum offset for future frame with respect to current.
If zero is returned, future packets are not allowed.
Implemented in MpPlcSilence.
|
pure virtual |
Return algorithmic delay in samples, should be called after init.
Implemented in MpPlcSilence.
|
staticprotected |
Name of algorithm to be used by default.