14 #ifndef _MpFlowGraphBase_h_ 15 #define _MpFlowGraphBase_h_ 22 #include <utl/UtlHashMap.h> 24 #include "utl/UtlString.h" 25 #include "os/OsDefs.h" 26 #include "os/OsMsgQ.h" 27 #include "os/OsStatus.h" 28 #include "os/OsRWMutex.h" 29 #include "os/OsTime.h" 31 #include "os/OsMsgDispatcher.h" 121 int samplesPerSec = 0,
122 OsMsgDispatcher *pNotifDispatcher = NULL);
343 const UtlString& resourceName = NULL);
346 OsStatus
start(
void);
423 int startResourceInput,
424 const UtlString &endResourceName,
425 int endResourceOutput,
426 UtlBoolean includeEndResourceLatency,
453 int startResourceOutput,
454 const UtlString &endResourceName,
455 int endResourceInput,
456 UtlBoolean includeEndResourceLatency,
466 IRTCPSession* getRTCPSessionPtr(
void);
469 IRTCPConnection* getRTCPConnectionPtr(
MpConnectionID connId,
int mediaType,
int streamId);
511 unsigned long GetEventInterest(
void);
535 IRTCPSession *piRTCPSession);
560 IRTCPSession *piRTCPSession);
589 const OsTime& rTimeout=OsTime::OS_INFINITY);
658 int hashRtcpConnection(
MpConnectionID connId,
int mediaType,
int streamId);
659 UtlBoolean createRtcpConnection(
MpConnectionID connId,
int mediaType,
int streamId);
660 UtlBoolean deleteRtcpConnection(
MpConnectionID connId,
int mediaType,
int streamId);
662 IRTCPSession* mpiRTCPSession;
664 unsigned long mulEventInterest;
665 OsMutex mRtcpConnMutex;
666 UtlHashMap mRtcpConnMap;
711 UtlBoolean makeNameUnique);
754 int startResourceInput,
755 const UtlString &endResourceName,
756 int endResourceOutput,
757 UtlBoolean includeEndResourceLatency,
762 int startResourceOutput,
763 const UtlString &endResourceName,
764 int endResourceInput,
765 UtlBoolean includeEndResourceLatency,
856 inline IRTCPSession *MpFlowGraphBase::getRTCPSessionPtr(
void)
858 return(mpiRTCPSession);
881 inline unsigned long MpFlowGraphBase::GetEventInterest(
void)
884 return(mulEventInterest);
888 #endif // _MpFlowGraphBase_h_ UtlBoolean handleSynchronize(MpFlowGraphMsg &rMsg)
Handle the FLOWGRAPH_SYNCHRONIZE message.
Definition: MpFlowGraphBase.cpp:1304
Message object used to communicate with the media processing task.
Definition: MpFlowGraphMsg.h:33
UtlBoolean handleDestroyResource(const UtlString &name)
Handle the FLOWGRAPH_DESTROY_RESOURCE message.
Definition: MpFlowGraphBase.cpp:1672
UtlString getFlowgraphName() const
Get flowgraph's name based on its sequence number (use for debug purposes only!)
Definition: MpFlowGraphBase.h:848
int mPeriodCnt
number of frames processed by this flow graph
Definition: MpFlowGraphBase.h:646
Definition: MpFlowGraphBase.h:110
int mCurState
current flow graph state
Definition: MpFlowGraphBase.h:643
UtlBoolean disconnectAllInputs(MpResource *pResource)
Disconnects all inputs (and the corresponding upstream outputs) for the indicated resource...
Definition: MpFlowGraphBase.cpp:1114
virtual OsStatus postMessage(const MpFlowGraphMsg &rMsg, const OsTime &rTimeout=OsTime::OS_INFINITY)
Posts a message to this flow graph.
Definition: MpFlowGraphBase.cpp:1846
virtual OsStatus loseFocus(void)
Informs the flow graph that it has lost the MpMediaTask focus.
Definition: MpFlowGraphBase.cpp:473
UtlBoolean handleDestroyResources(void)
Handle the FLOWGRAPH_DESTROY_RESOURCES message.
Definition: MpFlowGraphBase.cpp:1435
Definition: MpFlowGraphBase.h:111
MpFlowGraphBase & operator=(const MpFlowGraphBase &rhs)
Assignment operator (not implemented for this task)
MpResource * mExecOrder[MAX_FLOWGRAPH_RESOURCES]
resource execution order
Definition: MpFlowGraphBase.h:641
OsStatus computeOrder(void)
Computes the execution order for the flow graph by performing a topological sort on the resource grap...
Definition: MpFlowGraphBase.cpp:1083
virtual UtlBoolean handleMessage(OsMsg &rMsg)
Handles an incoming message for the flow graph.
Definition: MpFlowGraphBase.cpp:1165
virtual OsStatus postNotification(const MpResNotificationMsg &msg)
posts a resource notification message to the Notification dispatcher.
Definition: MpFlowGraphBase.cpp:480
int mSamplesPerSec
number of samples per second
Definition: MpFlowGraphBase.h:651
int getExecOrderIndex(const MpResource *resource) const
Find the index of the given resource in the compute order array.
Definition: MpFlowGraphBase.cpp:1097
Definition: MpFlowGraphBase.h:632
UtlHashMap mResourceDict
resource dictionary
Definition: MpFlowGraphBase.h:640
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.
Definition: MpFlowGraphBase.cpp:959
OsStatus destroyResource(const UtlString &resourceName)
Removes the indicated media processing object from the flowgraph and destroys it. ...
Definition: MpFlowGraphBase.cpp:632
OsMsgQ mMessages
message queue for this flow graph
Definition: MpFlowGraphBase.h:644
FlowGraphState
Definition: MpFlowGraphBase.h:101
int getState(void) const
Returns the current state of flow graph.
Definition: MpFlowGraphBase.h:813
virtual ~MpFlowGraphBase()
Destructor.
Definition: MpFlowGraphBase.cpp:110
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
OsStatus disable(void)
Invokes the disable() method for each resource in the flow graph.
Definition: MpFlowGraphBase.cpp:294
int getFlowgraphNum() const
Get flowgraph's sequence number (use for debug purposes only!)
Definition: MpFlowGraphBase.h:843
int numResources(void) const
Returns the number of resources in the flow graph.
Definition: MpFlowGraphBase.h:833
flow graph has been started (is processing media streams)
Definition: MpFlowGraphBase.h:103
UtlBoolean isStarted(void) const
Is flow graph in STARTED state.
Definition: MpFlowGraphBase.cpp:1070
OsStatus setNotificationsEnabled(bool enabled, const UtlString &resourceName=NULL)
Definition: MpFlowGraphBase.cpp:650
int numFramesProcessed(void) const
Returns the number of frames this flow graph has processed.
Definition: MpFlowGraphBase.h:828
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 ...
Definition: MpFlowGraphBase.cpp:935
OsStatus destroyResources(void)
Stops the flow graph, removes all of the resources in the flow graph and destroys them...
Definition: MpFlowGraphBase.cpp:270
UtlBoolean handleRemoveLink(MpResource *pFrom, int outPortIdx)
Handle the FLOWGRAPH_REMOVE_LINK message.
Definition: MpFlowGraphBase.cpp:1540
UtlBoolean handleEnable(void)
Handle the FLOWGRAPH_ENABLE message.
Definition: MpFlowGraphBase.cpp:1513
Definition: MpFlowGraphBase.h:633
OsStatus addResource(MpResource &rResource, UtlBoolean makeNameUnique=TRUE)
Adds the indicated media processing object to the flow graph.
Definition: MpFlowGraphBase.cpp:234
Definition: MpFlowGraphBase.h:109
UtlBoolean handleRemoveResource(MpResource *pResource)
Handle the FLOWGRAPH_REMOVE_RESOURCE message.
Definition: MpFlowGraphBase.cpp:1583
int mSamplesPerFrame
number of samples per frame
Definition: MpFlowGraphBase.h:650
int getSamplesPerFrame(void) const
Returns the number of samples expected per frame.
Definition: MpFlowGraphBase.h:803
UtlBoolean handleAddLink(MpResource *pFrom, int outPortIdx, MpResource *pTo, int inPortIdx)
Handle the FLOWGRAPH_ADD_LINK message.
Definition: MpFlowGraphBase.cpp:1333
OsStatus handleGetLatencyForPathReverse(MpResource *pStartResource, int startResourceOutput, const UtlString &endResourceName, int endResourceInput, UtlBoolean includeEndResourceLatency, int &latency)
Do the real work for getLatencyForPathReverse()
Definition: MpFlowGraphBase.cpp:1778
int getSamplesPerSec(void) const
Returns the number of samples expected per second.
Definition: MpFlowGraphBase.h:808
virtual void RemoteSSRCCollision(IRTCPConnection *piRTCPConnection=NULL, IRTCPSession *piRTCPSession=NULL)
Definition: IRTCPNotify.h:401
OsStatus start(void)
Start this flow graph.
Definition: MpFlowGraphBase.cpp:683
UtlBoolean handleAddResource(MpResource *pResource, UtlBoolean makeNameUnique)
Handle the FLOWGRAPH_ADD_RESOURCE message.
Definition: MpFlowGraphBase.cpp:1388
OsStatus stop(void)
Stop this flow graph.
Definition: MpFlowGraphBase.cpp:701
OsStatus insertResourceBefore(MpResource &rResource, MpResource &rDownstreamResource, int inPortIdx)
Definition: MpFlowGraphBase.cpp:416
virtual OsStatus processNextFrame(void)
Processes the next frame interval's worth of media for the flow graph.
Definition: MpFlowGraphBase.cpp:496
FlowGraphType
Definition: MpFlowGraphBase.h:107
static int gFgMaxNumber
mFgNumber (for debug purposes only!)
Definition: MpFlowGraphBase.h:635
MpFlowGraphBase(int samplesPerFrame=0, int samplesPerSec=0, OsMsgDispatcher *pNotifDispatcher=NULL)
Constructor.
Definition: MpFlowGraphBase.cpp:54
MpResource * mpResourceInProcess
For debugging, keep track of what.
Definition: MpFlowGraphBase.h:652
virtual OsStatus gainFocus(void)
Informs the flow graph that it now has the MpMediaTask focus.
Definition: MpFlowGraphBase.cpp:337
OsStatus processMessages(void)
Processes all of the messages currently queued for this flow graph.
Definition: MpFlowGraphBase.cpp:1857
UtlBoolean mRecomputeOrder
TRUE ==> the execution order needs computing.
Definition: MpFlowGraphBase.h:649
OsStatus enable(void)
Invokes the enable() method for each resource in the flow graph.
Definition: MpFlowGraphBase.cpp:318
flow graph is stopped (not processing media streams)
Definition: MpFlowGraphBase.h:104
MpResource * mUnsorted[MAX_FLOWGRAPH_RESOURCES]
unsorted resources
Definition: MpFlowGraphBase.h:642
Definition: MpResNotificationMsg.h:31
int mFgNumber
Definition: MpFlowGraphBase.h:637
#define DECLARE_IBASE_M
Definition: BaseClass.h:368
int mLinkCnt
number of links in this flow graph
Definition: MpFlowGraphBase.h:647
int numLinks(void) const
Returns the number of links in the flow graph.
Definition: MpFlowGraphBase.h:823
OsMsgDispatcher * mNotifyDispatcher
Dispatcher for notification messages.
Definition: MpFlowGraphBase.h:645
static const OsTime smProcessMessagesTimeout
from the flowgraph queue.
Definition: MpFlowGraphBase.h:654
OsMsgDispatcher * getNotificationDispatcher() const
Returns the current notification dispatcher, if any. If none, returns NULL.
Definition: MpFlowGraphBase.h:818
void synchronize(const char *tag=NULL, int val=0)
Sends a message to self, and waits for reply.
Definition: MpFlowGraphBase.cpp:711
UtlBoolean handleStop(void)
Handle the FLOWGRAPH_STOP message.
Definition: MpFlowGraphBase.cpp:1704
Definition: BaseClass.h:118
OsStatus removeLink(MpResource &rFrom, int outPortIdx)
Removes the link between the outPortIdx port of the rFrom resource and its downstream counterpart...
Definition: MpFlowGraphBase.cpp:587
OsStatus lookupResourcePrivate(const UtlString &name, MpResource *&rpResource)
Sets rpResource to point to the resource that corresponds to name or to NULL if no matching resource ...
Definition: MpFlowGraphBase.cpp:945
#define INCLUDE_RTCP
Definition: RtcpConfig.h:55
virtual void LocalSSRCCollision(IRTCPConnection *piRTCPConnection=NULL, IRTCPSession *piRTCPSession=NULL)
Definition: IRTCPNotify.h:376
int MpConnectionID
Flowgraph connection ID.
Definition: MpTypes.h:56
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.
Definition: MpFlowGraphBase.cpp:1013
OsStatus insertResourceAfter(MpResource &rResource, MpResource &rUpstreamResource, int outPortIdx)
Inserts rResource into the flow graph downstream of the designated rUpstreamResource resource...
Definition: MpFlowGraphBase.cpp:352
UtlBoolean handleStart(void)
Handle the FLOWGRAPH_START message.
Definition: MpFlowGraphBase.cpp:1695
OsRWMutex mRWMutex
Definition: MpFlowGraphBase.h:585
OsMsgDispatcher * setNotificationDispatcher(OsMsgDispatcher *notifyDispatcher)
Adds a dispatcher for notifications to the flowgraph.
Definition: MpFlowGraphBase.cpp:218
int mResourceCnt
number of resources in this flow graph
Definition: MpFlowGraphBase.h:648
Abstract base class for all media processing objects.
Definition: MpResource.h:56
OsStatus handleGetLatencyForPath(MpResource *pStartResource, int startResourceInput, const UtlString &endResourceName, int endResourceOutput, UtlBoolean includeEndResourceLatency, int &latency)
Do the real work for getLatencyForPath()
Definition: MpFlowGraphBase.cpp:1712
UtlBoolean disconnectAllOutputs(MpResource *pResource)
Disconnects all outputs (and the corresponding downstream inputs) for the indicated resource...
Definition: MpFlowGraphBase.cpp:1141
virtual FlowGraphType getType()
Returns the type of this flow graph.
Definition: MpFlowGraphBase.cpp:879
#define TRUE
Definition: PlgDefsV1.h:41
OsStatus removeResource(MpResource &rResource)
Removes the indicated media processing object from the flow graph.
Definition: MpFlowGraphBase.cpp:614
OsMsgQ * getMsgQ(void)
Returns the message queue used by the flow graph.
Definition: MpFlowGraphBase.h:838
OsStatus postMessage(MpFlowGraphMsg &rMsg)
Post a message from this resource.
Definition: MpResource.cpp:678
UtlBoolean handleDisable(void)
Handle the FLOWGRAPH_DISABLE message.
Definition: MpFlowGraphBase.cpp:1486
OsStatus addLink(MpResource &rFrom, int outPortIdx, MpResource &rTo, int inPortIdx)
Creates a link between resources.
Definition: MpFlowGraphBase.cpp:182
static void flowGraphInfo(MpFlowGraphBase *pFlowGraph)
Displays information on the console about the specified flow graph.
Definition: MpFlowGraphBase.cpp:886