sipxmedialib  Version 3.3
MprFromNet.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2012 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 _MprFromNet_h_
15 #define _MprFromNet_h_
16 
17 #include "rtcp/RtcpConfig.h"
18 
19 // SYSTEM INCLUDES
20 #ifdef _WIN32 /* [ */
21 #include <winsock2.h>
22 #endif /* _WIN32 ] */
23 
24 // APPLICATION INCLUDES
25 #include <os/OsMsgQ.h>
26 #include "os/OsDefs.h"
27 #include "mp/MpUdpBuf.h"
28 #include "mp/MpRtpBuf.h"
29 #ifdef INCLUDE_RTCP /* [ */
30 #include "rtcp/IRTPDispatch.h"
31 #include "rtcp/INetDispatch.h"
32 #else
33 #include <mp/NetInTask.h>
34 #endif /* INCLUDE_RTCP ] */
35 
36 // DEFINES
37 // MACROS
38 // EXTERNAL FUNCTIONS
39 // EXTERNAL VARIABLES
40 // CONSTANTS
41 // STRUCTS
42 // TYPEDEFS
43 // FORWARD DECLARATIONS
44 class MprDecode;
45 class MprDejitter;
46 class MprRtpDispatcher;
47 class OsEvent;
48 class OsSocket;
49 class MpResourceMsg;
50 class NetInTask;
51 class UtlString;
52 class MpFlowGraphBase;
53 
56 {
57 /* //////////////////////////// PUBLIC //////////////////////////////////// */
58 public:
59 
60 /* ============================ CREATORS ================================== */
62 
63 
65  MprFromNet();
66 
68  virtual ~MprFromNet();
69 
71 
72 /* ============================ MANIPULATORS ============================== */
74 
75  UtlBoolean handleMessage(MpResourceMsg& rMsg);
77 
79  static OsStatus setSockets(const UtlString& resourceName, OsMsgQ& flowgraphMessageQueue, OsSocket* rtpSocket, OsSocket* rtcpSocket);
80 
82  OsStatus setSockets(OsSocket& rRtpSocket, OsSocket& rRtcpSocket);
86  static OsStatus resetSockets(const UtlString& resourceName, OsMsgQ& flowgraphMessageQueue);
88 
90  OsStatus resetSockets();
93  OsStatus pushPacket(const MpUdpBufPtr &buf, bool isRtcp);
95 
97  OsStatus enableSsrcDiscard(UtlBoolean enable, RtpSRC ssrc);
109  OsStatus setRtpDispatcher(MprRtpDispatcher *pRtpDispatcher);
116 
117 /* ============================ ACCESSORS ================================= */
119 
120 
121 #ifdef INCLUDE_RTCP /* [ */
122  void setDispatchers(IRTPDispatch *piRTPDispatch, INetDispatch *piRTCPDispatch);
125 
126 #else /* INCLUDE_RTCP ] [ */
127  OsStatus getRtcpStats(MprRtcpStats& stats);
129 #endif /* INCLUDE_RTCP ] */
130 
131  // For debug purposes allow labeling this with the containing flowgraph
132  OsStatus setFlowGraph(MpFlowGraphBase* flowgraph);
133 
135 
136 /* ============================ INQUIRY =================================== */
138 
139 
141 
142 /* //////////////////////////// PROTECTED ///////////////////////////////// */
143 protected:
144 
145 /* //////////////////////////// PRIVATE /////////////////////////////////// */
146 private:
150  UtlBoolean mRegistered;
155 #ifdef INCLUDE_RTCP /* [ */
156  INetDispatch* mpiRTCPDispatch;
157  IRTPDispatch* mpiRTPDispatch;
158 
159 #else /* INCLUDE_RTCP ] [ */
162 #endif /* INCLUDE_RTCP ] */
163 
169 
170 #ifndef INCLUDE_RTCP /* [ */
171  OsStatus rtcpStats(struct RtpHeader *h);
173 #endif /* INCLUDE_RTCP ] */
174 
176  UtlBoolean resetSocketsInternal(OsEvent *pEvent = NULL);
184  static MpRtpBufPtr parseRtpPacket(const MpUdpBufPtr &buf);
186 
188  MprFromNet(const MprFromNet& rMprFromNet);
189 
191  MprFromNet& operator=(const MprFromNet& rhs);
192 
193 };
194 
195 /* ============================ INLINE METHODS ============================ */
196 #endif // _MprFromNet_h_
Definition: NetInTask.h:62
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
MprFromNet()
Constructor.
Definition: MprFromNet.cpp:60
virtual ~MprFromNet()
Destructor.
Definition: MprFromNet.cpp:90
int mNumPktsRtp
Total RTP packets received from NetIn.
Definition: MprFromNet.h:166
MprRtpDispatcher * mpRtpDispatcher
Definition: MprFromNet.h:151
OsMutex mRegistrationSyncMutex
Definition: MprFromNet.h:148
Class for RTP stream dispatcher abstraction.
Definition: MprRtpDispatcher.h:42
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
int mNumPktsRtcp
Total RTCP packets received from NetIn.
Definition: MprFromNet.h:165
OsStatus rtcpStats(struct RtpHeader *h)
Update the RR info for the current incoming packet.
Definition: MprFromNet.cpp:213
NetInTask * mNetInTask
Definition: MprFromNet.h:149
Smart pointer to MpRtpBuf.
Definition: MpRtpBuf.h:348
int mNumEncDropped
Encoded RTP packets dropped due to no key.
Definition: MprFromNet.h:167
Definition: NetInTask.h:85
OsStatus enableSsrcDiscard(UtlBoolean enable, RtpSRC ssrc)
Enable/disable discarding of given RTP stream.
Definition: MprFromNet.cpp:341
MpFlowGraphBase * mpFlowGraph
Definition: MprFromNet.h:154
rtpHandle mInRtpHandle
Definition: MprFromNet.h:160
int mRtcpCount
Definition: MprFromNet.h:161
UtlBoolean mRegistered
Definition: MprFromNet.h:150
static MpRtpBufPtr parseRtpPacket(const MpUdpBufPtr &buf)
Parse UDP packet and return filled RTP packet buffer.
Definition: MprFromNet.cpp:419
UtlBoolean handleMessage(MpResourceMsg &rMsg)
Handle message to manipulate this.
Definition: MprFromNet.cpp:177
OsStatus resetSockets()
Unregister the inbound RTP and RTCP sockets.
Definition: MprFromNet.cpp:158
OsStatus setRtpDispatcher(MprRtpDispatcher *pRtpDispatcher)
Set RTP dispatcher instance.
Definition: MprFromNet.cpp:350
Task that listen for packets in incoming RTP streams.
Definition: NetInTask.h:109
Smart pointer to MpUdpBuf.
Definition: MpUdpBuf.h:142
RtpSRC mDiscardedSSRC
Definition: MprFromNet.h:153
MprFromNet & operator=(const MprFromNet &rhs)
Assignment operator (not implemented for this class)
The "Decode" media processing resource.
Definition: MprDecode.h:45
int mNumPushed
Total RTP+RTCP pkts received from NetIn.
Definition: MprFromNet.h:164
interface rtpts_t rtpts_t ssrc_t ssrc
Definition: ISetSenderStatistics.h:68
OsStatus pushPacket(const MpUdpBufPtr &buf, bool isRtcp)
Take in a buffer from the NetIn task.
Definition: MprFromNet.cpp:251
UtlBoolean mDiscardSelectedStream
Definition: MprFromNet.h:152
RTP header as described in RFC 3550.
Definition: RtpHeader.h:43
OsStatus setFlowGraph(MpFlowGraphBase *flowgraph)
Definition: MprFromNet.cpp:408
The "From Network" media processing resource.
Definition: MprFromNet.h:55
OsMutex mDiscardCtlMutex
Definition: MprFromNet.h:147
static OsStatus setSockets(const UtlString &resourceName, OsMsgQ &flowgraphMessageQueue, OsSocket *rtpSocket, OsSocket *rtcpSocket)
send a message to a resource containing a MprFromNet to set sockets
Definition: MprFromNet.cpp:121
UtlBoolean resetSocketsInternal(OsEvent *pEvent=NULL)
Unregister the inbound RTP and RTCP sockets.
Definition: MprFromNet.cpp:520
OsStatus getRtcpStats(MprRtcpStats &stats)
retrieve the RR info needed to complete an RTCP packet
Definition: MprFromNet.cpp:205
uint32_t RtpSRC
RTP SSRC or CSRC identifier.
Definition: MpTypes.h:61
int mNumLoopDropped
Looped-back mcast RTP packets dropped.
Definition: MprFromNet.h:168
The "Dejitter" utility class.
Definition: MprDejitter.h:39