sipxmedialib
Version 3.3
|
Flow graph used to handle a basic call. More...
#include <MpCallFlowGraph.h>
Public Types | |
enum | ToneOptions { TONE_TO_SPKR = 0x1, TONE_TO_NET = 0x2 } |
enum | RecorderChoice { RECORDER_MIC = 0, RECORDER_ECHO_OUT, RECORDER_ECHO_IN8, RECORDER_SPKR, RECORDER_CALL, MAX_RECORDERS = 10 } |
Public Types inherited from MpFlowGraphBase | |
enum | FlowGraphState { STARTED, STOPPED } |
enum | FlowGraphType { BASE_FLOWGRAPH = 0, CALL_FLOWGRAPH = 1, TOPOLOGY_FLOWGRAPH = 2 } |
Public Member Functions | |
Creators | |
MpCallFlowGraph (const char *pLocale="", int samplesPerFrame=0, int samplesPerSec=0, OsMsgDispatcher *pNotifDispatcher=NULL) | |
Default constructor. More... | |
virtual | ~MpCallFlowGraph () |
Destructor. More... | |
Manipulators | |
void | startTone (int toneId, int toneOptions) |
Starts playing the indicated tone. More... | |
void | stopTone (void) |
Stops playing the tone (applies to all tone destinations). More... | |
int | closeRecorders (void) |
OsStatus | Record (int ms, const char *playFilename, const char *baseName, const char *endName, int recorderMask) |
OsStatus | recordMic (int ms, MpAudioSample *pAudioBuf, int bufferSize) |
OsStatus | recordMic (int ms, int silenceLength, const char *fileName) |
OsStatus | record (int timeMS, int silenceLength, const char *micName=NULL, const char *echoOutName=NULL, const char *spkrName=NULL, const char *mic32Name=NULL, const char *spkr32Name=NULL, const char *echoIn8Name=NULL, const char *echoIn32Name=NULL, const char *playName=NULL, const char *callName=NULL, int toneOptions=0, int repeat=0, MprRecorder::RecordFileFormat format=MprRecorder::RAW_PCM_16) |
UtlBoolean | setupRecorder (RecorderChoice which, const char *audioFileName, int time, int silenceLength, MprRecorder::RecordFileFormat format=MprRecorder::RAW_PCM_16) |
OsStatus | playBuffer (char *audioBuf, unsigned long bufSize, uint32_t inRate, int type, UtlBoolean repeat, int toneOptions, OsProtectedEvent *event=NULL, UtlBoolean autoStopOnFinish=TRUE) |
Start playing audio from a buffer passed in. More... | |
OsStatus | playFile (const char *audioFileName, UtlBoolean repeat, int toneOptions, UtlBoolean autoStopOnFinish=TRUE) |
Start playing audio from a file. More... | |
OsStatus | pauseFile () |
Tell fromFile resource to pause the currently playing file, if one is being played. More... | |
OsStatus | resumeFile () |
Tell fromFile resource to resume playing, if previously paused. More... | |
void | stopFile (UtlBoolean closeFile) |
Stop playing audio from a file. More... | |
void | startSendRtp (OsSocket &rRtpSocket, OsSocket &rRtcpSocket, MpConnectionID connID=1, SdpCodec *pPrimaryCodec=NULL, SdpCodec *pDtmfCodec=NULL) |
Starts sending RTP and RTCP packets. More... | |
void | stopSendRtp (MpConnectionID connID=1) |
Stops sending RTP and RTCP packets. More... | |
void | startReceiveRtp (SdpCodec *pCodecs[], int numCodecs, OsSocket &rRtpSocket, OsSocket &rRtcpSocket, MpConnectionID connID=1) |
Starts receiving RTP and RTCP packets. More... | |
void | stopReceiveRtp (MpConnectionID connID=1) |
Stops receiving RTP and RTCP packets. More... | |
virtual OsStatus | gainFocus (void) |
Informs the flow graph that it now has the MpMediaTask focus. More... | |
virtual OsStatus | loseFocus (void) |
Informs the flow graph that it has lost the MpMediaTask focus. More... | |
OsStatus | postNotification (const MpResNotificationMsg &msg) |
posts a resource notification message to the Notification dispatcher. More... | |
MpConnectionID | createConnection (int maxRtpStreams=1, UtlBoolean isMcast=FALSE) |
Creates a new MpAudioConnection; returns -1 if failure. More... | |
UtlBoolean | unmuteInput (MpConnectionID connID) |
enables hearing audio data from a source More... | |
UtlBoolean | unmuteOutput (MpConnectionID connID) |
enables sending audio data to a remote party More... | |
UtlBoolean | muteInput (MpConnectionID connID) |
disables hearing audio data from a source More... | |
UtlBoolean | muteOutput (MpConnectionID connID) |
disables sending audio data to a remote party More... | |
OsStatus | deleteConnection (MpConnectionID connID) |
Removes an MpAudioConnection and deletes it and all its resources. More... | |
Accessors | |
virtual MpFlowGraphBase::FlowGraphType | getType () |
Returns the type of this flow graph. More... | |
Inquiry | |
UtlBoolean | isCodecSupported (SdpCodec &rCodec) |
Returns TRUE if the indicated codec is supported. More... | |
Public Member Functions inherited from MpFlowGraphBase | |
void | synchronize (const char *tag=NULL, int val=0) |
Sends a message to self, and waits for reply. More... | |
MpFlowGraphBase (int samplesPerFrame=0, int samplesPerSec=0, OsMsgDispatcher *pNotifDispatcher=NULL) | |
Constructor. More... | |
virtual | ~MpFlowGraphBase () |
Destructor. More... | |
OsStatus | addLink (MpResource &rFrom, int outPortIdx, MpResource &rTo, int inPortIdx) |
Creates a link between resources. More... | |
OsMsgDispatcher * | setNotificationDispatcher (OsMsgDispatcher *notifyDispatcher) |
Adds a dispatcher for notifications to the flowgraph. More... | |
OsStatus | addResource (MpResource &rResource, UtlBoolean makeNameUnique=TRUE) |
Adds the indicated media processing object to the flow graph. More... | |
OsStatus | destroyResources (void) |
Stops the flow graph, removes all of the resources in the flow graph and destroys them. More... | |
OsStatus | disable (void) |
Invokes the disable() method for each resource in the flow graph. More... | |
OsStatus | enable (void) |
Invokes the enable() method for each resource in the flow graph. More... | |
OsStatus | insertResourceAfter (MpResource &rResource, MpResource &rUpstreamResource, int outPortIdx) |
Inserts rResource into the flow graph downstream of the designated rUpstreamResource resource. More... | |
OsStatus | insertResourceBefore (MpResource &rResource, MpResource &rDownstreamResource, int inPortIdx) |
virtual OsStatus | processNextFrame (void) |
Processes the next frame interval's worth of media for the flow graph. More... | |
OsStatus | removeLink (MpResource &rFrom, int outPortIdx) |
Removes the link between the outPortIdx port of the rFrom resource and its downstream counterpart. More... | |
OsStatus | removeResource (MpResource &rResource) |
Removes the indicated media processing object from the flow graph. More... | |
OsStatus | destroyResource (const UtlString &resourceName) |
Removes the indicated media processing object from the flowgraph and destroys it. More... | |
OsStatus | setNotificationsEnabled (bool enabled, const UtlString &resourceName=NULL) |
OsStatus | start (void) |
Start this flow graph. More... | |
OsStatus | stop (void) |
Stop this flow graph. More... | |
int | getSamplesPerFrame (void) const |
Returns the number of samples expected per frame. More... | |
int | getSamplesPerSec (void) const |
Returns the number of samples expected per second. More... | |
int | getState (void) const |
Returns the current state of flow graph. More... | |
OsMsgDispatcher * | getNotificationDispatcher () const |
Returns the current notification dispatcher, if any. If none, returns NULL. More... | |
OsStatus | lookupResource (const UtlString &name, MpResource *&rpResource) |
Sets rpResource to point to the resource that corresponds to name or to NULL if no matching resource is found. More... | |
int | numLinks (void) const |
Returns the number of links in the flow graph. More... | |
int | numFramesProcessed (void) const |
Returns the number of frames this flow graph has processed. More... | |
int | numResources (void) const |
Returns the number of resources in the flow graph. More... | |
OsMsgQ * | getMsgQ (void) |
Returns the message queue used by the flow graph. More... | |
int | getFlowgraphNum () const |
Get flowgraph's sequence number (use for debug purposes only!) More... | |
UtlString | getFlowgraphName () const |
Get flowgraph's name based on its sequence number (use for debug purposes only!) More... | |
OsStatus | getLatencyForPath (MpResource *pStartResource, int startResourceInput, const UtlString &endResourceName, int endResourceOutput, UtlBoolean includeEndResourceLatency, int &latency) |
Get latency for main path from one resource to another in forward direction. More... | |
OsStatus | getLatencyForPathReverse (MpResource *pStartResource, int startResourceOutput, const UtlString &endResourceName, int endResourceInput, UtlBoolean includeEndResourceLatency, int &latency) |
Get latency for main path from one resource to another in reverse direction. More... | |
UtlBoolean | isStarted (void) const |
Is flow graph in STARTED state. More... | |
Static Public Member Functions | |
static UtlBoolean | setInbandDTMF (UtlBoolean bEnable) |
Enables/Disable the transmission of inband DTMF audio. More... | |
static UtlBoolean | setAECMode (FLOWGRAPH_AEC_MODE mode) |
Set Acoustic Echo Cancelation mode. More... | |
static UtlBoolean | setAGC (UtlBoolean bEnable) |
Enable/disable Automatic Gain Control. More... | |
static UtlBoolean | setAudioNoiseReduction (UtlBoolean bEnable) |
Enable/disable speex noise reduction. More... | |
Static Public Member Functions inherited from MpFlowGraphBase | |
static void | flowGraphInfo (MpFlowGraphBase *pFlowGraph) |
Displays information on the console about the specified flow graph. More... | |
Private Types | |
enum | PlayStart { START_PLAY_NONE = 0, START_PLAY_FILE, START_PLAY_SPKR } |
enum | { MAX_CONNECTIONS = 10 } |
Private Member Functions | |
virtual UtlBoolean | handleMessage (OsMsg &rMsg) |
Handles an incoming message for the flow graph. More... | |
UtlBoolean | handleRemoveConnection (MpFlowGraphMsg &rMsg) |
Handle the FLOWGRAPH_REMOVE_CONNECTION message. More... | |
UtlBoolean | handleStartPlay (MpFlowGraphMsg &rMsg) |
Handle the FLOWGRAPH_START_PLAY message for MprFromFile. More... | |
UtlBoolean | handleStartRecord (MpFlowGraphMsg &rMsg) |
Handle the FLOWGRAPH_START_RECORD message. More... | |
UtlBoolean | handleStopRecord (MpFlowGraphMsg &rMsg) |
Handle the FLOWGRAPH_STOP_RECORD message. More... | |
UtlBoolean | handleStartTone (MpFlowGraphMsg &rMsg) |
Handle the FLOWGRAPH_START_TONE message. More... | |
UtlBoolean | handleStopToneOrPlay (void) |
Handle the FLOWGRAPH_STOP_TONE and FLOWGRAPH_STOP_PLAY messages. More... | |
UtlBoolean | handleOnMprRecorderEnabled (const UtlString &resourceName) |
UtlBoolean | handleOnMprRecorderDisabled (const UtlString &resourceName) |
UtlBoolean | handleStreamRealizeUrl (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_REALIZE_URL message. More... | |
UtlBoolean | handleStreamRealizeBuffer (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_REALIZE_BUFFER message. More... | |
UtlBoolean | handleStreamPrefetch (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_PREFETCH message. More... | |
UtlBoolean | handleStreamPlay (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_PLAY message. More... | |
UtlBoolean | handleStreamRewind (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_REWIND message. More... | |
UtlBoolean | handleStreamPause (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_PAUSE message. More... | |
UtlBoolean | handleStreamStop (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_STOP message. More... | |
UtlBoolean | handleStreamDestroy (MpStreamMsg &rMsg) |
Handle the FLOWGRAPH_STREAM_DESTROY message. More... | |
MpCallFlowGraph (const MpCallFlowGraph &rMpCallFlowGraph) | |
Copy constructor (not implemented for this class) More... | |
MpCallFlowGraph & | operator= (const MpCallFlowGraph &rhs) |
Assignment operator (not implemented for this class) More... | |
Private Attributes | |
MprBridge * | mpBridge |
MprFromFile * | mpFromFile |
MprFromStream * | mpFromStream |
MprFromMic * | mpFromMic |
MprSplitter * | mpMicSplitter |
MprRecorder * | mpBufferRecorder |
MprToSpkr * | mpToSpkr |
MprMixer * | mpTFsMicMixer |
MprMixer * | mpTFsBridgeMixer |
MprMixer * | mpCallrecMixer |
MprSplitter * | mpMicCallrecSplitter |
MprSplitter * | mpSpeakerCallrecSplitter |
MprSplitter * | mpToneFileSplitter |
MprToneGen * | mpToneGen |
OsBSem | mConnTableLock |
UtlBoolean | mToneIsGlobal |
MpRtpInputConnection * | mpInputConnections [MAX_CONNECTIONS] |
int | mNumRtpStreams [MAX_CONNECTIONS] |
UtlBoolean | mIsMcastConnection [MAX_CONNECTIONS] |
MprDecode ** | mpDecoders [MAX_CONNECTIONS] |
MprMixer * | mpMcastMixer [MAX_CONNECTIONS] |
MpRtpOutputConnection * | mpOutputConnections [MAX_CONNECTIONS] |
MprEncode * | mpEncoders [MAX_CONNECTIONS] |
UtlBoolean | mToneGenDefocused |
disabled during defocused state flag More... | |
MprRecorder * | mpRecorders [MAX_RECORDERS] |
Static Private Attributes | |
static UtlBoolean | sbSendInBandDTMF = true |
static UtlBoolean | sbEnableAEC = false |
static UtlBoolean | sbEnableAGC = false |
static UtlBoolean | sbEnableNoiseReduction = false |
Additional Inherited Members | |
Protected Member Functions inherited from MpFlowGraphBase | |
virtual OsStatus | postMessage (const MpFlowGraphMsg &rMsg, const OsTime &rTimeout=OsTime::OS_INFINITY) |
Posts a message to this flow graph. More... | |
UtlBoolean | handleRemoveLink (MpResource *pFrom, int outPortIdx) |
Handle the FLOWGRAPH_REMOVE_LINK message. More... | |
UtlBoolean | handleRemoveResource (MpResource *pResource) |
Handle the FLOWGRAPH_REMOVE_RESOURCE message. More... | |
UtlBoolean | handleDestroyResource (const UtlString &name) |
Handle the FLOWGRAPH_DESTROY_RESOURCE message. More... | |
UtlBoolean | handleSynchronize (MpFlowGraphMsg &rMsg) |
Handle the FLOWGRAPH_SYNCHRONIZE message. More... | |
Protected Attributes inherited from MpFlowGraphBase | |
OsRWMutex | mRWMutex |
Flow graph used to handle a basic call.
enum ToneOptions |
enum RecorderChoice |
|
private |
MpCallFlowGraph | ( | const char * | pLocale = "" , |
int | samplesPerFrame = 0 , |
||
int | samplesPerSec = 0 , |
||
OsMsgDispatcher * | pNotifDispatcher = NULL |
||
) |
Default constructor.
|
virtual |
Destructor.
|
private |
Copy constructor (not implemented for this class)
void startTone | ( | int | toneId, |
int | toneOptions | ||
) |
Starts playing the indicated tone.
void stopTone | ( | void | ) |
Stops playing the tone (applies to all tone destinations).
int closeRecorders | ( | void | ) |
OsStatus Record | ( | int | ms, |
const char * | playFilename, | ||
const char * | baseName, | ||
const char * | endName, | ||
int | recorderMask | ||
) |
playFilename | if NULL, defaults to previous string |
baseName | if NULL, defaults to previous string |
endName | if NULL, defaults to previous string |
OsStatus recordMic | ( | int | ms, |
MpAudioSample * | pAudioBuf, | ||
int | bufferSize | ||
) |
OsStatus recordMic | ( | int | ms, |
int | silenceLength, | ||
const char * | fileName | ||
) |
OsStatus record | ( | int | timeMS, |
int | silenceLength, | ||
const char * | micName = NULL , |
||
const char * | echoOutName = NULL , |
||
const char * | spkrName = NULL , |
||
const char * | mic32Name = NULL , |
||
const char * | spkr32Name = NULL , |
||
const char * | echoIn8Name = NULL , |
||
const char * | echoIn32Name = NULL , |
||
const char * | playName = NULL , |
||
const char * | callName = NULL , |
||
int | toneOptions = 0 , |
||
int | repeat = 0 , |
||
MprRecorder::RecordFileFormat | format = MprRecorder::RAW_PCM_16 |
||
) |
UtlBoolean setupRecorder | ( | RecorderChoice | which, |
const char * | audioFileName, | ||
int | time, | ||
int | silenceLength, | ||
MprRecorder::RecordFileFormat | format = MprRecorder::RAW_PCM_16 |
||
) |
OsStatus playBuffer | ( | char * | audioBuf, |
unsigned long | bufSize, | ||
uint32_t | inRate, | ||
int | type, | ||
UtlBoolean | repeat, | ||
int | toneOptions, | ||
OsProtectedEvent * | event = NULL , |
||
UtlBoolean | autoStopOnFinish = TRUE |
||
) |
Start playing audio from a buffer passed in.
The passed in audio /p audioBuf is converted (if necessary) to the flowgraph's sample rate, then played through the flowgraph as it is set up.
[in] | audioBuf | - the audio buffer to play. |
[in] | bufSize | - the size of the audio buffer /p audioBuf |
[in] | inRate | - the sample rate of audioBuf |
[in] | type | - Currently unused! Please pass '0'. |
[in] | repeat | - Whether this audio should be looped until explicitly stopped. |
[in] | toneOptions | - TODO: Fill in docs here |
[in,out] | event | - an old event object for signaling status changes. |
OsStatus playFile | ( | const char * | audioFileName, |
UtlBoolean | repeat, | ||
int | toneOptions, | ||
UtlBoolean | autoStopOnFinish = TRUE |
||
) |
Start playing audio from a file.
audioFileName | name of the audio file |
repeat | TRUE/FALSE continue playing audio from the beginning after the end of file is reached. |
toneOptions | TONE_TO_SPKR/TONE_TO_NET file audio played locally or both locally and remotely. |
OsStatus pauseFile | ( | ) |
Tell fromFile resource to pause the currently playing file, if one is being played.
OsStatus resumeFile | ( | ) |
Tell fromFile resource to resume playing, if previously paused.
void stopFile | ( | UtlBoolean | closeFile | ) |
Stop playing audio from a file.
closeFile | - TRUE/FALSE whether to close the audio file. |
void startSendRtp | ( | OsSocket & | rRtpSocket, |
OsSocket & | rRtcpSocket, | ||
MpConnectionID | connID = 1 , |
||
SdpCodec * | pPrimaryCodec = NULL , |
||
SdpCodec * | pDtmfCodec = NULL |
||
) |
Starts sending RTP and RTCP packets.
void stopSendRtp | ( | MpConnectionID | connID = 1 | ) |
Stops sending RTP and RTCP packets.
void startReceiveRtp | ( | SdpCodec * | pCodecs[], |
int | numCodecs, | ||
OsSocket & | rRtpSocket, | ||
OsSocket & | rRtcpSocket, | ||
MpConnectionID | connID = 1 |
||
) |
Starts receiving RTP and RTCP packets.
void stopReceiveRtp | ( | MpConnectionID | connID = 1 | ) |
Stops receiving RTP and RTCP packets.
|
virtual |
Informs the flow graph that it now has the MpMediaTask focus.
Only the flow graph that has the focus is permitted to access the audio hardware. This may only be called if this flow graph is managed and started!
Reimplemented from MpFlowGraphBase.
|
virtual |
Informs the flow graph that it has lost the MpMediaTask focus.
Only the flow graph that has the focus is permitted to access the audio hardware. This should only be called if this flow graph is managed and started!
Reimplemented from MpFlowGraphBase.
|
virtual |
posts a resource notification message to the Notification dispatcher.
If there is a notification dispatcher, this message is posted to it. Otherwise, the message is dropped.
The Notification Dispatcher is used to hold and notify users of notification messages. This is first being created to be used by resources, held here in the flowgraph, and used to pass notification up to the application level. In the future, this could be extended to allow filtering of notification messages - The one setting up the notification dispatcher could set properties on it to enable only certain types of messages to be sent up through it's framework.
[in] | msg | - the notification message to post to the dispatcher. |
OS_SUCCESS | if the message was successfully added to the dispatcher. |
OS_LIMIT_REACHED | if the queue is full, and no more messages can be accepted. |
OS_NOT_FOUND | if there's no dispatcher. |
Reimplemented from MpFlowGraphBase.
MpConnectionID createConnection | ( | int | maxRtpStreams = 1 , |
UtlBoolean | isMcast = FALSE |
||
) |
Creates a new MpAudioConnection; returns -1 if failure.
UtlBoolean unmuteInput | ( | MpConnectionID | connID | ) |
enables hearing audio data from a source
UtlBoolean unmuteOutput | ( | MpConnectionID | connID | ) |
enables sending audio data to a remote party
UtlBoolean muteInput | ( | MpConnectionID | connID | ) |
disables hearing audio data from a source
UtlBoolean muteOutput | ( | MpConnectionID | connID | ) |
disables sending audio data to a remote party
OsStatus deleteConnection | ( | MpConnectionID | connID | ) |
Removes an MpAudioConnection and deletes it and all its resources.
|
static |
Enables/Disable the transmission of inband DTMF audio.
|
static |
Set Acoustic Echo Cancelation mode.
|
static |
Enable/disable Automatic Gain Control.
|
static |
Enable/disable speex noise reduction.
|
virtual |
Returns the type of this flow graph.
Reimplemented from MpFlowGraphBase.
UtlBoolean isCodecSupported | ( | SdpCodec & | rCodec | ) |
Returns TRUE if the indicated codec is supported.
|
privatevirtual |
Handles an incoming message for the flow graph.
Reimplemented from MpFlowGraphBase.
|
private |
Handle the FLOWGRAPH_REMOVE_CONNECTION message.
|
private |
Handle the FLOWGRAPH_START_PLAY message for MprFromFile.
|
private |
Handle the FLOWGRAPH_START_RECORD message.
|
private |
Handle the FLOWGRAPH_STOP_RECORD message.
|
private |
Handle the FLOWGRAPH_START_TONE message.
|
private |
Handle the FLOWGRAPH_STOP_TONE and FLOWGRAPH_STOP_PLAY messages.
|
private |
Handle the ON_MPRRECORDER_ENABLED message. It is sent when a recorder is really enabled.
|
private |
Handle the ON_MPRRECORDER_DISABLED message. It is sent when a recorder is really disabled, so we can send an event to sipxtapi in the future. Currently we only disable some other resources if the recorder is call recorder.
|
private |
Handle the FLOWGRAPH_STREAM_REALIZE_URL message.
|
private |
Handle the FLOWGRAPH_STREAM_REALIZE_BUFFER message.
|
private |
Handle the FLOWGRAPH_STREAM_PREFETCH message.
|
private |
Handle the FLOWGRAPH_STREAM_PLAY message.
|
private |
Handle the FLOWGRAPH_STREAM_REWIND message.
|
private |
Handle the FLOWGRAPH_STREAM_PAUSE message.
|
private |
Handle the FLOWGRAPH_STREAM_STOP message.
|
private |
Handle the FLOWGRAPH_STREAM_DESTROY message.
|
private |
Assignment operator (not implemented for this class)
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
disabled during defocused state flag
|
private |
these array should really be made into a structure but for now we'll just use em this way.
D.W.