sipxmedialib  Version 3.3
Static Protected Attributes | List of all members
MpSpeakerSelectBase Class Referenceabstract

#include <MpSpeakerSelectBase.h>

Static Protected Attributes

static UtlString smDefaultAlgorithm
 Name of algorithm to be used by default. More...
 

Creators

virtual OsStatus init (int maxParticipants, int maxActive)=0
 Initialize SS to initial state. More...
 
virtual ~MpSpeakerSelectBase ()
 Destructor. More...
 
static MpSpeakerSelectBasecreateInstance (const UtlString &name="")
 Factory method for SS algorithms creation. More...
 

Manipulators

virtual void reset ()=0
 Reset algorithm state to initial and prepare for processing of new data. More...
 
virtual OsStatus enableParticipant (int num, UtlBoolean newState)=0
 Enable/disable processing of a selected participant. More...
 
virtual OsStatus processFrame (MpSpeechParams *speechParams[], int frameSize)=0
 Compute speaker ranks. More...
 
virtual OsStatus setParam (const char *paramName, void *value)=0
 Set algorithm parameter. More...
 
static void setDefaultAlgorithm (const UtlString &name)
 Set algorithm to be used by default. More...
 

Inquiry

virtual OsStatus isParticipantEnabled (int num, UtlBoolean &enabled)=0
 Is processing enabled for a given participant? More...
 

Detailed Description

Base class for all Speaker Selection (SS) algorithms.

To create concrete class you could directly instantiate it or use MpSpeakerSelectBase::createInstance() static method for greater flexibility.

Constructor & Destructor Documentation

virtual ~MpSpeakerSelectBase ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual OsStatus init ( int  maxParticipants,
int  maxActive 
)
pure virtual

Initialize SS to initial state.

Parameters
[in]maxParticipants- maximum number of participants in a conference.
[in]maxActive- maximum number of participants to be detected as active speech, -1 lead to no constrains. Correct setting of maxActive helps SS algorithm to minimize number of flips between least ranked speaker inside maxActive speakers and most ranked speaker outside of this number.

Should be called before any other class methods. All participants after initialization are disabled, to enable it call enableParticipant().

MpSpeakerSelectBase * createInstance ( const UtlString &  name = "")
static

Factory method for SS algorithms creation.

Parameters
[in]name- name of SS algorithm to use. Use empty string to get default algorithm.
Note
To date we have no available SS algorithms in open-source, so NULL is always returned.
Returns
If appropriate SS algorithm is not found, default one is returned.
virtual void reset ( )
pure virtual

Reset algorithm state to initial and prepare for processing of new data.

It's supposed that init() will not be called after reset(). So reset() must turn algorithm to the state as right after calling init(). Maximum number of participants intentionally is not changed, to prevent memory reallocation.

virtual OsStatus enableParticipant ( int  num,
UtlBoolean  newState 
)
pure virtual

Enable/disable processing of a selected participant.

Initially all participants are disabled. Use this method to enable processing for newly added participants and disable processing for removed participants. Data from disabled participants are just ignored.

Parameters
[in]num- number of participant, starting from zero
[in]newState- pass TRUE to enable processing of this participant, FALSE to disable.
Return values
OS_SUCCESSif participant is successfully enabled or disabled.
OS_INVALID_ARGUMENTif participant number refers to non existing participant.
virtual OsStatus processFrame ( MpSpeechParams speechParams[],
int  frameSize 
)
pure virtual

Compute speaker ranks.

Parameters
[in]speechParams- parameters of bridges
[in]frameSize- number of milliseconds in frame
Return values
OS_SUCCESSif processing is ok.
virtual OsStatus setParam ( const char *  paramName,
void *  value 
)
pure virtual

Set algorithm parameter.

Parameters
[in]paramName- name of parameter.
[in]value- pointer to a value.
Return values
OS_SUCCESSif parameter has been set.
void setDefaultAlgorithm ( const UtlString &  name)
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.

Parameters
[in]name- name of algorithm to use by default. Reverts to compile-time default if empty.
virtual OsStatus isParticipantEnabled ( int  num,
UtlBoolean &  enabled 
)
pure virtual

Is processing enabled for a given participant?

Parameters
[in]num- number of a participant, starting from zero.
[out]enabled- variable is set to TRUE processing of this participant is enabled, FALSE otherwise.
Return values
OS_SUCCESSif value is returned.
OS_INVALID_ARGUMENTif participant number refers to non existing participant.

Member Data Documentation

UtlString smDefaultAlgorithm
staticprotected

Name of algorithm to be used by default.