sipxmedialib  Version 3.3
Classes | Public Types | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Friends | List of all members
MpResource Class Referenceabstract

Abstract base class for all media processing objects. More...

#include <MpResource.h>

Inheritance diagram for MpResource:
Inheritance graph
[legend]
Collaboration diagram for MpResource:
Collaboration graph
[legend]

Classes

struct  Conn
 The Conn object maintains information about the "far end" of a connection. More...
 

Public Types

enum  VisitState { NOT_VISITED, IN_PROGRESS, FINISHED }
 Graph traversal states that are used when running a topological sort to order resources within a flow graph. More...
 
enum  { ASSOCIATED_LATENCY =-1, INF_LATENCY =-1 }
 

Static Public Attributes

static const UtlContainableType TYPE = "MpResource"
 Class name, used for run-time checks. More...
 

Protected Member Functions

virtual UtlBoolean handleMessage (MpFlowGraphMsg &fgMsg)
 Handles an incoming flowgraph message for this media processing object. More...
 
virtual UtlBoolean handleMessage (MpResourceMsg &rMsg)
 Handles an incoming resource message for this media processing object. More...
 
virtual UtlBoolean handleEnable ()
 perform the enable operation on the resource More...
 
virtual UtlBoolean handleDisable ()
 perform the disable operation on the resource More...
 
void setInputBuffer (int inPortIdx, const MpBufPtr &pBuf)
 If there already is a buffer stored for this input port, delete it. Then store pBuf for the indicated input port. More...
 
OsStatus postMessage (MpFlowGraphMsg &rMsg)
 Post a message from this resource. More...
 
OsStatus postMessage (MpResourceMsg &rMsg)
 Post a message for this resource. More...
 
UtlBoolean pushBufferDownsream (int outPortIdx, const MpBufPtr &pBuf)
 Makes pBuf available to resource connected to the outPortIdx output port of this resource. More...
 
virtual OsStatus setFlowGraph (MpFlowGraphBase *pFlowGraph)
 Associates this resource with the indicated flow graph. More...
 
virtual OsStatus setNotificationsEnabled (UtlBoolean enable)
 Sets whether or not this resource should send notifications. More...
 
virtual UtlBoolean connectInput (MpResource &rFrom, int fromPortIdx, int toPortIdx)
 Connects the toPortIdx input port on this resource to the fromPortIdx output port of the rFrom resource. More...
 
virtual UtlBoolean connectOutput (MpResource &rTo, int toPortIdx, int fromPortIdx)
 Connects the fromPortIdx output port on this resource to the toPortIdx input port of the rTo resource. More...
 
virtual UtlBoolean disconnectInput (int inPortIdx)
 Removes the connection to the inPortIdx input port of this resource. More...
 
virtual UtlBoolean disconnectOutput (int outPortIdx)
 Removes the connection to the outPortIdx output port of this resource. More...
 
void setName (const UtlString &rName)
 Sets the name that is associated with this resource. More...
 

Protected Attributes

MpFlowGraphBasempFlowGraph
 flow graph this resource belongs to More...
 
MpConnectionID mConnectionId
 The ID of connection this resource belongs to. More...
 
int mStreamId
 
UtlBoolean mIsEnabled
 TRUE if resource is enabled, FALSE otherwise. More...
 
OsRWMutex mRWMutex
 reader/writer lock for synchronization More...
 
MpBufPtrmpInBufs
 input buffers for this resource More...
 
MpBufPtrmpOutBufs
 output buffers for this resource More...
 
ConnmpInConns
 input connections for this resource More...
 
ConnmpOutConns
 output connections for this resource More...
 
int mMaxInputs
 maximum number of inputs More...
 
int mMaxOutputs
 maximum number of outputs More...
 
int mMinInputs
 number of required inputs More...
 
int mMinOutputs
 number of required outputs More...
 
int mNumActualInputs
 actual number of connected inputs More...
 
int mNumActualOutputs
 actual number of connected outputs More...
 
int mVisitState
 (used by flow graph topological sort alg.) More...
 
UtlBoolean mNotificationsEnabled
 Whether we should send notifications or not. More...
 
OsBSem mLock
 used mainly to make safe changes to ports More...
 

Static Protected Attributes

static const OsTime sOperationQueueTimeout = OsTime::OS_INFINITY
 The timeout for message operations for all resources when posting to the flowgraph queue. More...
 

Private Member Functions

 MpResource (const MpResource &rMpResource)
 Copy constructor (not implemented for this class) More...
 
MpResourceoperator= (const MpResource &rhs)
 Assignment operator (not implemented for this class) More...
 

Friends

class MpFlowGraphBase
 

Creators

 MpResource (const UtlString &rName, int minInputs, int maxInputs, int minOutputs, int maxOutputs)
 Constructor. More...
 
virtual ~MpResource ()
 Destructor. More...
 

Manipulators

virtual UtlBoolean disable ()
 Disable this resource. More...
 
virtual UtlBoolean enable ()
 Enable this resource. More...
 
virtual void reset ()
 This method is invoked for resources that care about stream discontinuities. More...
 
UtlBoolean handleMessages (OsMsgQ &msgQ)
 Handles a queue full of incoming messages for this media processing object. More...
 
virtual UtlBoolean processFrame ()=0
 This method is called in every flowgraph processing cycle. More...
 
void setVisitState (int newState)
 Sets the visit state for this resource. More...
 
OsStatus sendNotification (MpResNotificationMsg::RNMsgType msgType)
 Send a notification with the given message type if notifications are enabled. More...
 
OsStatus sendNotification (MpResNotificationMsg &msg)
 Send the given notification message if notifications are enabled. More...
 
virtual void setConnectionId (MpConnectionID connectionId)
 Set the ID of a connection this resource belongs to. More...
 
virtual void setStreamId (int streamId)
 Set the ID of a stream inside of the connection this resource belongs to. More...
 
virtual int getStreamId (void)
 Get the ID of a stream within the connection this resource belongs to. More...
 
virtual OsStatus pushBuffer (int inputPort, MpBufPtr &inputBuffer)
 Receive buffer asynchronously from resource at given input port. More...
 
virtual void reassignSSRC (void)
 Broadcast announcement that we are changing our SSRC. More...
 
static OsStatus disable (const UtlString &namedResource, OsMsgQ &fgQ)
 Post a message to disable the resource named. More...
 
static OsStatus enable (const UtlString &namedResource, OsMsgQ &fgQ)
 Post a message to enable the resource named. More...
 
static OsStatus setNotificationsEnabled (UtlBoolean enable, const UtlString &namedResource, OsMsgQ &fgQ)
 Post a message to enable or disable resource notifications on the named resource. More...
 

Accessors

MpFlowGraphBasegetFlowGraph () const
 Returns parent flowgraph. More...
 
void getInputInfo (int inPortIdx, MpResource *&rpUpstreamResource, int &rUpstreamPortIdx)
 Returns information about the upstream end of a connection. More...
 
const UtlString & getName () const
 Returns the name associated with this resource. More...
 
void getOutputInfo (int outPortIdx, MpResource *&rpDownstreamResource, int &rDownstreamPortIdx)
 Returns information about the downstream end of a connection. More...
 
int getVisitState ()
 Returns the current visit state for this resource. More...
 
int maxInputs () const
 Returns the maximum number of inputs supported by this resource. More...
 
int maxOutputs () const
 Returns the maximum number of outputs supported by this resource. More...
 
int minInputs () const
 Returns the minimum number of inputs required by this resource. More...
 
int minOutputs () const
 Returns the minimum number of outputs required by this resource. More...
 
int numInputs () const
 Returns the number of resource inputs that are currently connected. More...
 
int numOutputs () const
 Returns the number of resource outputs that are currently connected. More...
 
virtual MpConnectionID getConnectionId (void) const
 Get the ID of a connection this resource belongs to. More...
 
int reserveFirstUnconnectedInput ()
 Find the first unconnected input port and reserve it. More...
 
int reserveFirstUnconnectedOutput ()
 Find the first unconnected output port and reserve it. More...
 
UtlContainableType getContainableType () const
 Get the ContainableType for a UtlContainable derived class. More...
 
virtual OsStatus getCurrentLatency (int &latency, int input=0, int output=0) const
 Get current input to output latency (in samples) More...
 
static void resourceInfo (MpResource *pResource, int index)
 Displays information on the console about the specified resource. More...
 

Inquiry

UtlBoolean isEnabled () const
 Returns TRUE is this resource is currently enabled, FALSE otherwise. More...
 
UtlBoolean isInputConnected (int portIdx)
 Returns TRUE if portIdx is valid and the indicated input is connected, FALSE otherwise. More...
 
UtlBoolean isInputUnconnected (int portIdx)
 Returns TRUE if portIdx is valid and the indicated input is not connected, FALSE otherwise. More...
 
UtlBoolean isOutputConnected (int portIdx)
 Returns TRUE if portIdx is valid and the indicated output is connected, FALSE otherwise. More...
 
UtlBoolean isOutputUnconnected (int portIdx)
 Returns TRUE if portIdx is valid and the indicated output is not connected, FALSE otherwise. More...
 
UtlBoolean areNotificationsEnabled () const
 Returns TRUE if notification sending is enabled on this resource. More...
 
virtual UtlBoolean isAsynchInput (int inputIndex)
 Takes asynchronous input (pushBuffer). More...
 

Detailed Description

Abstract base class for all media processing objects.

Each resource has zero or more input ports and zero or more output ports. Each frame processing interval, the processFrame() method is invoked to process one interval's worth of media.

Substantive changes to a resource can only be made: 1) when the resource is not part of flow graph, or 2) at the start of a frame processing interval

MpResource inherits from UtlString and stores the resource name in the base class. The resource name is used to uniquely identify the resource within the scope of a flowgraph.

Member Enumeration Documentation

enum VisitState

Graph traversal states that are used when running a topological sort to order resources within a flow graph.

Enumerator
NOT_VISITED 
IN_PROGRESS 
FINISHED 
anonymous enum
Enumerator
ASSOCIATED_LATENCY 

Get input or output latency, associated with a resource.

INF_LATENCY 

Infinite latency, i.e. data from the input is not sent to the output.

Constructor & Destructor Documentation

MpResource ( const UtlString &  rName,
int  minInputs,
int  maxInputs,
int  minOutputs,
int  maxOutputs 
)

Constructor.

~MpResource ( )
virtual

Destructor.

MpResource ( const MpResource rMpResource)
private

Copy constructor (not implemented for this class)

Member Function Documentation

UtlBoolean disable ( void  )
virtual

Disable this resource.

If a resource is disabled, it will perform only minimal processing typically. For example, passing the input straight through to the output in the case of a one input / one output resource.

See also
enable()
Note
This is an asynchronous operation, if this resource is a part of flowgraph. In this case status returned does not indicate that operation succeed - only that it was properly queued. If resource is not part of flowgraph, then operation will be processed synchronously.
Return values
TRUEif successful.
FALSEotherwise.
OsStatus disable ( const UtlString &  namedResource,
OsMsgQ &  fgQ 
)
static

Post a message to disable the resource named.

Post a disable message for the named resource to the flowgraph queue supplied.

See also
disable() for more information.
Note
This is an asynchronous operation. The status returned does not indicate that the disable happened - only that it was properly queued.
Parameters
[in]namedResource- the name of the resource to disable.
[in]fgQ- The flowgraph message queue to post the message to.
Return values
OS_SUCCESSif the message was successfully queued to the message queue.
OS_FAILEDif the message could not be added to the message queue.
UtlBoolean enable ( void  )
virtual

Enable this resource.

If a resource is enabled, it will perform full featured processing typically. For example, apply gain, mix several frames, remove noise, etc. However resources such as MprFromFile should be further started to do what they supposed to.

See also
disable()
Note
This is an asynchronous operation, if this resource is a part of flowgraph. In this case status returned does not indicate that operation succeed - only that it was properly queued. If resource is not part of flowgraph, then operation will be processed synchronously.
Return values
TRUEif successful.
FALSEotherwise.
OsStatus enable ( const UtlString &  namedResource,
OsMsgQ &  fgQ 
)
static

Post a message to enable the resource named.

Post an enable message for the named resource to the flowgraph queue supplied.

See also
enable() for more information.
Note
This is an asynchronous operation. The status returned does not indicate that the enable happened - only that it was properly queued.
Parameters
[in]namedResource- the name of the resource to enable.
[in]fgQ- The flowgraph message queue to post the message to.
Return values
OS_SUCCESSif the message was successfully queued to the message queue.
OS_FAILEDif the message could not be added to the message queue.
void reset ( )
virtual

This method is invoked for resources that care about stream discontinuities.

Reimplemented in MprDecode.

OsStatus setNotificationsEnabled ( UtlBoolean  enable,
const UtlString &  namedResource,
OsMsgQ &  fgQ 
)
static

Post a message to enable or disable resource notifications on the named resource.

Post a message to either enable or disable sending all notifications for the named resource to the flowgraph queue supplied.

Note
This is an asynchronous operation. The status returned does not indicate that notifications are enabled or disabled - only that it was properly queued.
Parameters
[in]enable- whether enabling or disabling is requested.
[in]namedResource- the name of the resource to operate on.
[in]fgQ- The flowgraph message queue to post the message to.
Return values
OS_SUCCESSif the message was successfully queued to the message queue.
OS_FAILEDif the message could not be added to the message queue.
UtlBoolean handleMessages ( OsMsgQ &  msgQ)

Handles a queue full of incoming messages for this media processing object.

This is intended to handle messages directly on a resource, circumventing a flowgraph's queue, and allowing things like the application to get resources to process some operations directly. (usually before a flowgraph is set up, but perhaps else-when too.

Note
This makes an assumption that the destination of these messages is this resource.
Parameters
[in]msgQ- a message queue full of messages intended for this resource.
Returns
TRUE if all the messages were handled, otherwise FALSE.
virtual UtlBoolean processFrame ( )
pure virtual

This method is called in every flowgraph processing cycle.

This method is called for each resource during frame processing cycle to perform data processing and, hence, it should be implemented in all child classes. Note, that this method is called regardless of enabled or disabled state of resource. Resource should handle enabled flag on its own.

Return values
TRUEif successful
FALSEotherwise.

Implemented in MpRtpOutputConnection, MpRtpInputConnection, MpAudioResource, and MpVideoResource.

void setVisitState ( int  newState)

Sets the visit state for this resource.

Used in performing a topological sort on the resources contained within a flow graph.

OsStatus sendNotification ( MpResNotificationMsg::RNMsgType  msgType)

Send a notification with the given message type if notifications are enabled.

Parameters
msgType- the type of message to send.
Return values
OS_SUCCESSif message send succeeded.
OsStatus sendNotification ( MpResNotificationMsg msg)

Send the given notification message if notifications are enabled.

Use this variant if you need to provide a message that is a child of MpResNotificationMsg.

Parameters
msg- the Notification Message to send.
Return values
OS_SUCCESSif message send succeeded.
void setConnectionId ( MpConnectionID  connectionId)
virtual

Set the ID of a connection this resource belongs to.

Warning
This method directly modifies resource structure.

Reimplemented in MprDecode, and MpRtpInputConnection.

void setStreamId ( int  streamId)
virtual

Set the ID of a stream inside of the connection this resource belongs to.

Warning
This method directly modifies resource structure.

Reimplemented in MprDecode.

int getStreamId ( void  )
virtual

Get the ID of a stream within the connection this resource belongs to.

OsStatus pushBuffer ( int  inputPort,
MpBufPtr inputBuffer 
)
virtual

Receive buffer asynchronously from resource at given input port.

Reimplemented in MprDecode.

void reassignSSRC ( void  )
virtual

Broadcast announcement that we are changing our SSRC.

void resourceInfo ( MpResource pResource,
int  index 
)
static

Displays information on the console about the specified resource.

MpFlowGraphBase * getFlowGraph ( void  ) const

Returns parent flowgraph.

Returns
the flow graph that contains this resource or NULL if the resource is not presently part of any flow graph.
void getInputInfo ( int  inPortIdx,
MpResource *&  rpUpstreamResource,
int &  rUpstreamPortIdx 
)

Returns information about the upstream end of a connection.

Returns information about the upstream end of a connection to the inPortIdx input on this resource. If inPortIdx is invalid or there is no connection, then rpUpstreamResource will be set to NULL.

Note
This method locks to avoid contention over port allocation. For this reason it SHOULD NOT be used in process frame.
const UtlString & getName ( void  ) const

Returns the name associated with this resource.

void getOutputInfo ( int  outPortIdx,
MpResource *&  rpDownstreamResource,
int &  rDownstreamPortIdx 
)

Returns information about the downstream end of a connection.

Returns information about the downstream end of a connection to the outPortIdx output on this resource. If outPortIdx is invalid or there is no connection, then rpDownstreamResource will be set to NULL.

Note
This method locks to avoid contention over port allocation. For this reason it SHOULD NOT be used in process frame.
int getVisitState ( void  )

Returns the current visit state for this resource.

Used in performing a topological sort on the resources contained within a flow graph.

int maxInputs ( void  ) const

Returns the maximum number of inputs supported by this resource.

int maxOutputs ( void  ) const

Returns the maximum number of outputs supported by this resource.

int minInputs ( void  ) const

Returns the minimum number of inputs required by this resource.

int minOutputs ( void  ) const

Returns the minimum number of outputs required by this resource.

int numInputs ( void  ) const

Returns the number of resource inputs that are currently connected.

int numOutputs ( void  ) const

Returns the number of resource outputs that are currently connected.

MpConnectionID getConnectionId ( void  ) const
virtual

Get the ID of a connection this resource belongs to.

int reserveFirstUnconnectedInput ( )

Find the first unconnected input port and reserve it.

Reserving a port does not prevent someone from connecting to that port.

Returns
-1 if no free ports
Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
int reserveFirstUnconnectedOutput ( )

Find the first unconnected output port and reserve it.

Reserving a port does not prevent someone from connecting to that port.

Returns
-1 if no free ports
Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
UtlContainableType getContainableType ( ) const

Get the ContainableType for a UtlContainable derived class.

OsStatus getCurrentLatency ( int &  latency,
int  input = 0,
int  output = 0 
) const
virtual

Get current input to output latency (in samples)

Get given input to given output latency in samples.

This method is called from media processing loop and thus should not block.

Note
Resource may cache latency from the last processed frame interval or retrieve/calculate it at every call to this method. I think this freedom shouldn't affect precision in a considerable way. But it is not recommended to return average latency here.
Parameters
[out]latency- value of latency returned. Set to INF_LATENCY if this input does not send data to this output currently.
[in]input- input for data to return latency for. If set to ASSOCIATED_LATENCY, then input latency, associated with this resource to be returned. E.g. driver latency to be returned for MprFromInputDevice.
[in]output- output for data to return latency for. If set to ASSOCIATED_LATENCY, then output latency, associated with this resource to be returned. E.g. driver latency to be returned for MprToOutputDevice.
Return values
OS_SUCCESSif latency has been returned successfully.
OS_NOT_FOUNDif input or output are not connected.

Reimplemented in MprDecode.

UtlBoolean isEnabled ( void  ) const

Returns TRUE is this resource is currently enabled, FALSE otherwise.

UtlBoolean isInputConnected ( int  portIdx)

Returns TRUE if portIdx is valid and the indicated input is connected, FALSE otherwise.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
UtlBoolean isInputUnconnected ( int  portIdx)

Returns TRUE if portIdx is valid and the indicated input is not connected, FALSE otherwise.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
UtlBoolean isOutputConnected ( int  portIdx)

Returns TRUE if portIdx is valid and the indicated output is connected, FALSE otherwise.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
UtlBoolean isOutputUnconnected ( int  portIdx)

Returns TRUE if portIdx is valid and the indicated output is not connected, FALSE otherwise.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
UtlBoolean areNotificationsEnabled ( ) const

Returns TRUE if notification sending is enabled on this resource.

See also
setAllNotificationsEnabled()
MpFlowGraphBase::setNotificationsEnabled()
UtlBoolean isAsynchInput ( int  inputIndex)
virtual

Takes asynchronous input (pushBuffer).

UtlBoolean handleMessage ( MpFlowGraphMsg fgMsg)
protectedvirtual

Handles an incoming flowgraph message for this media processing object.

Returns
TRUE if the message was handled, otherwise FALSE.

Reimplemented in MprBridge, MprFromStream, MprToneGen, MprSpeexPreprocess, MprMixer, and MprToneDetect.

UtlBoolean handleMessage ( MpResourceMsg rMsg)
protectedvirtual

Handles an incoming resource message for this media processing object.

Returns
TRUE if the message was handled, otherwise FALSE.

Reimplemented in MprFromFile, MprRecorder, MprDecode, MprDelay, MprEncode, MprBridge, MprSpeexEchoCancel, MprToneGen, MprToOutputDevice, MpRtpInputConnection, MpRtpOutputConnection, MprSpeakerSelector, MprFromInputDevice, MprVoiceActivityNotifier, MprVad, MprHook, MprToneDetect, and MprNotchFilter.

UtlBoolean handleEnable ( void  )
protectedvirtual

perform the enable operation on the resource

Reimplemented in MprToOutputDevice, and MprSpeakerSelector.

UtlBoolean handleDisable ( void  )
protectedvirtual

perform the disable operation on the resource

Reimplemented in MprRecorder, MprDecode, and MprSpeakerSelector.

void setInputBuffer ( int  inPortIdx,
const MpBufPtr pBuf 
)
protected

If there already is a buffer stored for this input port, delete it. Then store pBuf for the indicated input port.

OsStatus postMessage ( MpFlowGraphMsg rMsg)
protected

Post a message from this resource.

If this resource is not part of a flow graph, then rMsg is immediately passed to the handleMessage() method for this resource. If this resource is part of a flow graph, then rMsg will be sent to the message queue for the flow graph that this resource belongs to. The handleMessage() method for destination resource will be invoked at the start of the next frame processing interval.

Warning
Feel the difference in method behaviour if resource in the flow graph and if it is not.
OsStatus postMessage ( MpResourceMsg rMsg)
protected

Post a message for this resource.

See also
postMessage(MpFlowGraphMsg&) for details.
UtlBoolean pushBufferDownsream ( int  outPortIdx,
const MpBufPtr pBuf 
)
protected

Makes pBuf available to resource connected to the outPortIdx output port of this resource.

Returns
TRUE if there is a resource connected to the specified output port, FALSE otherwise.
OsStatus setFlowGraph ( MpFlowGraphBase pFlowGraph)
protectedvirtual

Associates this resource with the indicated flow graph.

Parameters
[in]pFlowGraph- pointer to a flowgraph owning this resource.
Return values
OS_SUCCESS- for now, this method always returns success

Reimplemented in MprDecode, MprSpeexEchoCancel, MprBridge, MprToneGen, MpRtpInputConnection, MprVoiceActivityNotifier, MprSpeakerSelector, MprSpeexPreprocess, MprVad, MprToneDetect, and MpRtpOutputConnection.

OsStatus setNotificationsEnabled ( UtlBoolean  enable)
protectedvirtual

Sets whether or not this resource should send notifications.

Parameters
[in]enable- TRUE to enable notifications, FALSE to disable.
Return values
OS_SUCCESSif setting worked.
OS_FAILUReif setting failed.
UtlBoolean connectInput ( MpResource rFrom,
int  fromPortIdx,
int  toPortIdx 
)
protectedvirtual

Connects the toPortIdx input port on this resource to the fromPortIdx output port of the rFrom resource.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
Returns
TRUE if successful, FALSE otherwise.

Reimplemented in MprSpeexPreprocess, MpRtpOutputConnection, and MprSpeakerSelector.

UtlBoolean connectOutput ( MpResource rTo,
int  toPortIdx,
int  fromPortIdx 
)
protectedvirtual

Connects the fromPortIdx output port on this resource to the toPortIdx input port of the rTo resource.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
Returns
TRUE if successful, FALSE otherwise.

Reimplemented in MpRtpInputConnection, and MprSpeakerSelector.

UtlBoolean disconnectInput ( int  inPortIdx)
protectedvirtual

Removes the connection to the inPortIdx input port of this resource.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
Returns
TRUE if successful, FALSE otherwise.

Reimplemented in MprSpeexPreprocess, and MprSpeakerSelector.

UtlBoolean disconnectOutput ( int  outPortIdx)
protectedvirtual

Removes the connection to the outPortIdx output port of this resource.

Note
This method locks to avoid contention over port allocation. It SHOULD NOT be used in process frame.
Returns
TRUE if successful, FALSE otherwise.

Reimplemented in MpRtpInputConnection, and MprSpeakerSelector.

void setName ( const UtlString &  rName)
protected

Sets the name that is associated with this resource.

MpResource& operator= ( const MpResource rhs)
private

Assignment operator (not implemented for this class)

Friends And Related Function Documentation

friend class MpFlowGraphBase
friend

Member Data Documentation

const UtlContainableType TYPE = "MpResource"
static

Class name, used for run-time checks.

MpFlowGraphBase* mpFlowGraph
protected

flow graph this resource belongs to

MpConnectionID mConnectionId
protected

The ID of connection this resource belongs to.

int mStreamId
protected

The ID of the stream inside the connection this resource belongs to.

UtlBoolean mIsEnabled
protected

TRUE if resource is enabled, FALSE otherwise.

OsRWMutex mRWMutex
protected

reader/writer lock for synchronization

MpBufPtr* mpInBufs
protected

input buffers for this resource

MpBufPtr* mpOutBufs
protected

output buffers for this resource

Conn* mpInConns
protected

input connections for this resource

Conn* mpOutConns
protected

output connections for this resource

int mMaxInputs
protected

maximum number of inputs

int mMaxOutputs
protected

maximum number of outputs

int mMinInputs
protected

number of required inputs

int mMinOutputs
protected

number of required outputs

int mNumActualInputs
protected

actual number of connected inputs

int mNumActualOutputs
protected

actual number of connected outputs

int mVisitState
protected

(used by flow graph topological sort alg.)

UtlBoolean mNotificationsEnabled
protected

Whether we should send notifications or not.

OsBSem mLock
protected

used mainly to make safe changes to ports

const OsTime sOperationQueueTimeout = OsTime::OS_INFINITY
staticprotected

The timeout for message operations for all resources when posting to the flowgraph queue.