/usr/include/sipxtapi/mp/MprDejitter.h is in libsipxtapi-dev 3.3.0~test17-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | //
// Copyright (C) 2006-2010 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2004-2008 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _MprDejitter_h_
#define _MprDejitter_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "os/OsStatus.h"
#include "os/OsBSem.h"
#include "mp/MpRtpBuf.h"
#include "utl/UtlString.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
/**
* @brief The "Dejitter" utility class.
*
* This class is not thread-safe. For thread-safety it relies on external
* synchronization mechanisms in MprDecode.
*/
class MprDejitter
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
enum {
MAX_RTP_PACKETS = 256 ///< Could be any value, power of 2 is desired.
};
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Constructor
MprDejitter(MpConnectionID connId=MP_INVALID_CONNECTION_ID, int streamId=-1);
/// Destructor
virtual
~MprDejitter();
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// Reset dejitter to initial state and prepare for new stream.
void reset();
/// Add an incoming RTP packet to the dejitter pool
OsStatus pushPacket(MpRtpBufPtr &pRtp);
/**<
* This method places the packet to the pool depending the modulo division
* value.
*
* @warning This method swaps \p pRtp with some other packet in the dejitter
* buffer. So you should dispose \p pRtp pointer asap after calling
* this method.
*
* @return OS_SUCCESS on success
* @return OS_LIMIT_REACHED if too many codecs used in incoming RTP packets
*/
/// Get next RTP packet, or NULL if none is available.
MpRtpBufPtr pullPacket();
/**<
* This buffer is the primary dejitter/reorder buffer for the internal
* codecs. Some codecs may do their own dejitter stuff too. But we can't
* eliminate this buffer because then out-of-order packets would just be
* dumped on the ground.
*
* This buffer does NOT substitute silence packets. That is done in
* MpJitterBuffer called from MprDecode.
*
* If packets arrive out of order, and the newer packet has already been
* pulled due to the size of the jitter buffer set by the codec, this
* buffer will NOT discard the out-of-order packet, but send it along
* anyway it is up to the codec to discard the packets it cannot use. This
* allows this JB to be a no-op buffer for when the commercial library is
* used.
*
* If pulled packet belong to signaling codec (e.g. RFC2833 DTMF), then
* set isSignaling to true. Else packet will be hold for undefined
* amount of time, possible forever.
*/
/// Get next RTP packet with given timestamp, or NULL if none is available.
MpRtpBufPtr pullPacket(RtpTimestamp timestamp,
UtlBoolean *nextFrameAvailable = NULL,
bool lockTimestamp=true);
/**<
* This version of pullPacket() works exactly the same as above version
* of pullPacket() with one exception: if (lockTimestamp == true) it checks
* every found packet's timestamp. And return NULL if there are no packets
* with timestamp less or equal then passed timestamp.
*
* If pulled packet belong to signaling codec (e.g. RFC2833 DTMF), then
* set isSignaling to true. Else packet will be hold for undefined
* amount of time, possible forever.
*/
/// Set connection ID for debug purposes.
void setConnectionId(MpConnectionID connId);
/// Set RTP stream ID for debug purposes.
void setStreamId(int streamId);
/// Set flowgraph name for debug purposes.
void setFlowgrapName(const UtlString &fgName);
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
/// Get number of packets in buffer, arrived in time.
inline int getNumPackets() const;
/// Get number of late packets in buffer.
inline int getNumLatePackets() const;
/// Get RTP header info. for first sequentially available packet
OsStatus getFirstPacketInfo(RtpSeq& packetSeq, RtpTimestamp& packetTime) const;
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/// Buffer for incoming RTP packets
MpRtpBufPtr mpPackets[MAX_RTP_PACKETS];
/// Number of packets in buffer, arrived in time.
int mNumPackets;
/// Number of packets in buffer, arrived late.
int mNumLatePackets;
/// Number of packets overwritten with newly came packets.
int mNumDiscarded;
/// Index of the last inserted packet.
int mLastPushed;
/// Have we returned first RTP packet or not?
UtlBoolean mIsFirstPulledPacket;
/// Keep track of the last sequence number returned, so that
/// we can distinguish out-of-order packets.
RtpSeq mMaxPulledSeqNo;
/// Connection ID for debug purposes.
MpConnectionID mConnectionId;
/// RTP stream ID for debug purposes.
int mStreamId;
/// Parent flowgraph for debug purposes.
UtlString mFlowgraphName;
/// Resource name for debug purposes.
UtlString mResourceName;
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Copy constructor (not implemented for this class)
MprDejitter(const MprDejitter& rMprDejitter);
/// Assignment operator (not implemented for this class)
MprDejitter& operator=(const MprDejitter& rhs);
};
/* ============================ INLINE METHODS ============================ */
int MprDejitter::getNumPackets() const
{
return mNumPackets;
}
int MprDejitter::getNumLatePackets() const
{
return mNumLatePackets;
}
#endif // _MprDejitter_h_
|