sipxmedialib  Version 3.3
MprDejitter.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2010 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2008 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 #ifndef _MprDejitter_h_
15 #define _MprDejitter_h_
16 
17 // SYSTEM INCLUDES
18 // APPLICATION INCLUDES
19 #include "os/OsStatus.h"
20 #include "os/OsBSem.h"
21 #include "mp/MpRtpBuf.h"
22 #include "utl/UtlString.h"
23 
24 // DEFINES
25 // MACROS
26 // EXTERNAL FUNCTIONS
27 // EXTERNAL VARIABLES
28 // CONSTANTS
29 // STRUCTS
30 // TYPEDEFS
31 // FORWARD DECLARATIONS
32 
40 {
41 /* //////////////////////////// PUBLIC //////////////////////////////////// */
42 public:
43 
44  enum {
46  };
47 
48 /* ============================ CREATORS ================================== */
50 
51 
53  MprDejitter(MpConnectionID connId=MP_INVALID_CONNECTION_ID, int streamId=-1);
54 
56  virtual
57  ~MprDejitter();
58 
60 
61 /* ============================ MANIPULATORS ============================== */
63 
64 
66  void reset();
67 
69  OsStatus pushPacket(MpRtpBufPtr &pRtp);
107  UtlBoolean *nextFrameAvailable = NULL,
108  bool lockTimestamp=true);
120  void setConnectionId(MpConnectionID connId);
122 
124  void setStreamId(int streamId);
125 
127  void setFlowgrapName(const UtlString &fgName);
128 
130 
131 /* ============================ ACCESSORS ================================= */
133 
134 
136  inline int getNumPackets() const;
137 
139  inline int getNumLatePackets() const;
140 
142  OsStatus getFirstPacketInfo(RtpSeq& packetSeq, RtpTimestamp& packetTime) const;
143 
145 
146 /* ============================ INQUIRY =================================== */
148 
149 
151 
152 /* //////////////////////////// PROTECTED ///////////////////////////////// */
153 protected:
154 
175  UtlString mFlowgraphName;
177  UtlString mResourceName;
178 
179 /* //////////////////////////// PRIVATE /////////////////////////////////// */
180 private:
181 
183  MprDejitter(const MprDejitter& rMprDejitter);
184 
186  MprDejitter& operator=(const MprDejitter& rhs);
187 
188 };
189 
190 /* ============================ INLINE METHODS ============================ */
191 
193 {
194  return mNumPackets;
195 }
196 
198 {
199  return mNumLatePackets;
200 }
201 
202 #endif // _MprDejitter_h_
int mNumLatePackets
Number of packets in buffer, arrived late.
Definition: MprDejitter.h:160
MpRtpBufPtr mpPackets[MAX_RTP_PACKETS]
Buffer for incoming RTP packets.
Definition: MprDejitter.h:156
OsStatus getFirstPacketInfo(RtpSeq &packetSeq, RtpTimestamp &packetTime) const
Get RTP header info. for first sequentially available packet.
Definition: MprDejitter.cpp:327
virtual ~MprDejitter()
Destructor.
Definition: MprDejitter.cpp:74
UtlBoolean mIsFirstPulledPacket
Have we returned first RTP packet or not?
Definition: MprDejitter.h:166
void setFlowgrapName(const UtlString &fgName)
Set flowgraph name for debug purposes.
Definition: MprDejitter.cpp:315
Smart pointer to MpRtpBuf.
Definition: MpRtpBuf.h:348
int getNumPackets() const
Get number of packets in buffer, arrived in time.
Definition: MprDejitter.h:192
UtlString mResourceName
Resource name for debug purposes.
Definition: MprDejitter.h:177
int getNumLatePackets() const
Get number of late packets in buffer.
Definition: MprDejitter.h:197
MprDejitter(MpConnectionID connId=MP_INVALID_CONNECTION_ID, int streamId=-1)
Constructor.
Definition: MprDejitter.cpp:60
OsStatus pushPacket(MpRtpBufPtr &pRtp)
Add an incoming RTP packet to the dejitter pool.
Definition: MprDejitter.cpp:98
MpConnectionID mConnectionId
Connection ID for debug purposes.
Definition: MprDejitter.h:171
uint32_t RtpTimestamp
RTP timestamp.
Definition: MpTypes.h:60
MpRtpBufPtr pullPacket()
Get next RTP packet, or NULL if none is available.
Definition: MprDejitter.cpp:193
RtpSeq mMaxPulledSeqNo
Definition: MprDejitter.h:169
uint16_t RtpSeq
RTP sequence number.
Definition: MpTypes.h:59
int mNumPackets
Number of packets in buffer, arrived in time.
Definition: MprDejitter.h:158
void setConnectionId(MpConnectionID connId)
Set connection ID for debug purposes.
Definition: MprDejitter.cpp:299
UtlString mFlowgraphName
Parent flowgraph for debug purposes.
Definition: MprDejitter.h:175
void setStreamId(int streamId)
Set RTP stream ID for debug purposes.
Definition: MprDejitter.cpp:307
void reset()
Reset dejitter to initial state and prepare for new stream.
Definition: MprDejitter.cpp:80
Could be any value, power of 2 is desired.
Definition: MprDejitter.h:45
int mLastPushed
Index of the last inserted packet.
Definition: MprDejitter.h:164
int mNumDiscarded
Number of packets overwritten with newly came packets.
Definition: MprDejitter.h:162
MprDejitter & operator=(const MprDejitter &rhs)
Assignment operator (not implemented for this class)
int MpConnectionID
Flowgraph connection ID.
Definition: MpTypes.h:56
#define MP_INVALID_CONNECTION_ID
Definition: MpTypes.h:57
The "Dejitter" utility class.
Definition: MprDejitter.h:39
int mStreamId
RTP stream ID for debug purposes.
Definition: MprDejitter.h:173