sipxmedialib  Version 3.3
MpRtpInputConnection.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2013 SIPez LLC. All rights reserved.
3 //
4 // Copyright (C) 2004-2008 SIPfoundry Inc.
5 // Licensed by SIPfoundry under the LGPL license.
6 //
7 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
8 // Licensed to SIPfoundry under a Contributor Agreement.
9 //
10 // $$
12 
13 
14 #ifndef _MpRtpInputConnection_h_
15 #define _MpRtpInputConnection_h_
16 
17 #include "rtcp/RtcpConfig.h"
18 
19 // SYSTEM INCLUDES
20 // APPLICATION INCLUDES
21 #include <mp/MpResource.h>
22 #include <mp/MpResourceMsg.h>
23 #include <mp/MprRtpDispatcher.h>
24 #include <mp/MpTypes.h>
25 #include <utl/UtlString.h>
26 #include <os/OsMutex.h>
27 
28 // DEFINES
29 // MACROS
30 // EXTERNAL FUNCTIONS
31 // EXTERNAL VARIABLES
32 // CONSTANTS
33 // STRUCTS
34 // TYPEDEFS
35 // FORWARD DECLARATIONS
36 class MprFromNet;
37 class MprRtpDispatcher;
38 class OsSocket;
39 struct IRTCPSession;
40 struct IRTCPConnection;
41 
47 {
48 /* //////////////////////////// PUBLIC //////////////////////////////////// */
49 public:
50 
51 /* ============================ CREATORS ================================== */
53 
54 
56  MpRtpInputConnection(const UtlString& resourceName,
57  MpConnectionID myID,
58  IRTCPSession *piRTCPSession = NULL,
59  int maxRtpStreams = 1,
66  virtual
69 
71 
72 /* ============================ MANIPULATORS ============================== */
74 
75 
77  UtlBoolean processFrame();
78 
80  void setSockets(OsSocket& rRtpSocket, OsSocket& rRtcpSocket);
86  void releaseSockets();
93  void setConnectionId(MpConnectionID connectionId);
95 
97  static OsStatus setRtpInactivityTimeout(const UtlString& namedResource,
98  OsMsgQ& fgQ,
99  int timeoutMs);
100 
102  static OsStatus enableSsrcDiscard(const UtlString& namedResource,
103  OsMsgQ& fgQ,
104  UtlBoolean enable, RtpSRC ssrc);
105 
107 
108 /* ============================ ACCESSORS ================================= */
110 
111 
112 #ifdef INCLUDE_RTCP /* [ */
113 
115 
117  IRTCPConnection *getRTCPConnection();
118 #endif /* INCLUDE_RTCP ] */
119 
121 
122 /* ============================ INQUIRY =================================== */
124 
125 
127 
128 /* //////////////////////////// PROTECTED ///////////////////////////////// */
129 protected:
130 
131  enum
132  {
136  };
137 
142  UtlBoolean mIsRtpStarted;
143 
144 #ifdef INCLUDE_RTCP /* [ */
145  IRTCPConnection *mpiRTCPConnection;
146 #endif /* INCLUDE_RTCP ] */
147 
149  UtlBoolean connectOutput(MpResource& rTo, int toPortIdx, int fromPortIdx);
150 
152  UtlBoolean disconnectOutput(int outPortIdx);
153 
155  OsStatus setFlowGraph(MpFlowGraphBase* pFlowGraph);
156 
158  virtual UtlBoolean handleMessage(MpResourceMsg& rMsg);
159 
161  void handleSetInactivityTimeout(const OsTime &timeout);
162 
164  void handleEnableSsrcDiscard(UtlBoolean enable, RtpSRC ssrc);
165 
166 /* //////////////////////////// PRIVATE /////////////////////////////////// */
167 private:
168 
170  MpRtpInputConnection(const MpRtpInputConnection& rMpRtpInputConnection);
171 
174 };
175 
176 /* ============================ INLINE METHODS ============================ */
177 
178 #endif // _MpRtpInputConnection_h_
int mMaxRtpStreams
Maximum number of RTP streams.
Definition: MpRtpInputConnection.h:140
void setConnectionId(MpConnectionID connectionId)
Set the ID of a connection this resource belongs to.
Definition: MpRtpInputConnection.cpp:128
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
RtpStreamAffinity
Definition: MprRtpDispatcher.h:47
Definition: MpResourceMsg.h:56
OsStatus setFlowGraph(MpFlowGraphBase *pFlowGraph)
Associates this resource with the indicated flow graph.
Definition: MpRtpInputConnection.cpp:194
void handleSetInactivityTimeout(const OsTime &timeout)
Handle message to set MpRtpDispatcher inactivity timeout.
Definition: MpRtpInputConnection.cpp:287
MpRtpInputConnection & operator=(const MpRtpInputConnection &rhs)
Assignment operator (not implemented for this type)
Connection container for the inbound and outbound network paths to a single remote party...
Definition: MpRtpInputConnection.h:46
Class for RTP stream dispatcher abstraction.
Definition: MprRtpDispatcher.h:42
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
MprRtpDispatcher * mpRtpDispatcher
RTP stream dispatcher.
Definition: MpRtpInputConnection.h:139
MprRtpDispatcher::RtpStreamAffinity mRtpStreamAffinity
Algorithm used to dispatch incoming RTP packets.
Definition: MpRtpInputConnection.h:141
UtlBoolean processFrame()
Process one frame of audio.
Definition: MpRtpInputConnection.cpp:107
MprFromNet * mpFromNet
UDP to RTP converter.
Definition: MpRtpInputConnection.h:138
Definition: MpRtpInputConnection.h:133
virtual ~MpRtpInputConnection()
Destructor.
Definition: MpRtpInputConnection.cpp:90
void releaseSockets()
Stops receiving RTP and RTCP packets.
Definition: MpRtpInputConnection.cpp:121
static OsStatus setRtpInactivityTimeout(const UtlString &namedResource, OsMsgQ &fgQ, int timeoutMs)
Definition: MpRtpInputConnection.cpp:137
void handleEnableSsrcDiscard(UtlBoolean enable, RtpSRC ssrc)
Handle message to enable/disable stream discard.
Definition: MpRtpInputConnection.cpp:292
interface rtpts_t rtpts_t ssrc_t ssrc
Definition: ISetSenderStatistics.h:68
MpRtpInputConnection(const UtlString &resourceName, MpConnectionID myID, IRTCPSession *piRTCPSession=NULL, int maxRtpStreams=1, MprRtpDispatcher::RtpStreamAffinity rtpStreamAffinity=MprRtpDispatcher::ADDRESS_AND_PORT)
Constructor.
Definition: MpRtpInputConnection.cpp:48
The "From Network" media processing resource.
Definition: MprFromNet.h:55
virtual UtlBoolean enable()
Enable this resource.
Definition: MpResource.cpp:145
Definition: MpRtpInputConnection.h:135
int MpConnectionID
Flowgraph connection ID.
Definition: MpTypes.h:56
uint32_t RtpSRC
RTP SSRC or CSRC identifier.
Definition: MpTypes.h:61
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...
Definition: MpRtpInputConnection.cpp:170
Definition: MprRtpDispatcher.h:49
Abstract base class for all media processing objects.
Definition: MpResource.h:56
UtlBoolean mIsRtpStarted
Are we currently receiving RTP stream?
Definition: MpRtpInputConnection.h:142
virtual UtlBoolean handleMessage(MpResourceMsg &rMsg)
Handle resource messages for this resource.
Definition: MpRtpInputConnection.cpp:242
void setSockets(OsSocket &rRtpSocket, OsSocket &rRtcpSocket)
Starts receiving RTP and RTCP packets.
Definition: MpRtpInputConnection.cpp:114
static OsStatus enableSsrcDiscard(const UtlString &namedResource, OsMsgQ &fgQ, UtlBoolean enable, RtpSRC ssrc)
Definition: MpRtpInputConnection.cpp:146
UtlBoolean disconnectOutput(int outPortIdx)
Removes the connection to the outPortIdx output port of this resource.
Definition: MpRtpInputConnection.cpp:184
Definition: MpRtpInputConnection.h:134