sipxmedialib
Version 3.3
|
The "Dejitter" utility class. More...
#include <MprDejitter.h>
Public Types | |
enum | { MAX_RTP_PACKETS = 256 } |
Public Member Functions | |
Creators | |
MprDejitter (MpConnectionID connId=MP_INVALID_CONNECTION_ID, int streamId=-1) | |
Constructor. More... | |
virtual | ~MprDejitter () |
Destructor. More... | |
Manipulators | |
void | reset () |
Reset dejitter to initial state and prepare for new stream. More... | |
OsStatus | pushPacket (MpRtpBufPtr &pRtp) |
Add an incoming RTP packet to the dejitter pool. More... | |
MpRtpBufPtr | pullPacket () |
Get next RTP packet, or NULL if none is available. More... | |
MpRtpBufPtr | pullPacket (RtpTimestamp timestamp, UtlBoolean *nextFrameAvailable=NULL, bool lockTimestamp=true) |
Get next RTP packet with given timestamp, or NULL if none is available. More... | |
void | setConnectionId (MpConnectionID connId) |
Set connection ID for debug purposes. More... | |
void | setStreamId (int streamId) |
Set RTP stream ID for debug purposes. More... | |
void | setFlowgrapName (const UtlString &fgName) |
Set flowgraph name for debug purposes. More... | |
Accessors | |
int | getNumPackets () const |
Get number of packets in buffer, arrived in time. More... | |
int | getNumLatePackets () const |
Get number of late packets in buffer. More... | |
OsStatus | getFirstPacketInfo (RtpSeq &packetSeq, RtpTimestamp &packetTime) const |
Get RTP header info. for first sequentially available packet. More... | |
Protected Attributes | |
MpRtpBufPtr | mpPackets [MAX_RTP_PACKETS] |
Buffer for incoming RTP packets. More... | |
int | mNumPackets |
Number of packets in buffer, arrived in time. More... | |
int | mNumLatePackets |
Number of packets in buffer, arrived late. More... | |
int | mNumDiscarded |
Number of packets overwritten with newly came packets. More... | |
int | mLastPushed |
Index of the last inserted packet. More... | |
UtlBoolean | mIsFirstPulledPacket |
Have we returned first RTP packet or not? More... | |
RtpSeq | mMaxPulledSeqNo |
MpConnectionID | mConnectionId |
Connection ID for debug purposes. More... | |
int | mStreamId |
RTP stream ID for debug purposes. More... | |
UtlString | mFlowgraphName |
Parent flowgraph for debug purposes. More... | |
UtlString | mResourceName |
Resource name for debug purposes. More... | |
Private Member Functions | |
MprDejitter (const MprDejitter &rMprDejitter) | |
Copy constructor (not implemented for this class) More... | |
MprDejitter & | operator= (const MprDejitter &rhs) |
Assignment operator (not implemented for this class) More... | |
The "Dejitter" utility class.
This class is not thread-safe. For thread-safety it relies on external synchronization mechanisms in MprDecode.
MprDejitter | ( | MpConnectionID | connId = MP_INVALID_CONNECTION_ID , |
int | streamId = -1 |
||
) |
Constructor.
|
virtual |
Destructor.
|
private |
Copy constructor (not implemented for this class)
void reset | ( | ) |
Reset dejitter to initial state and prepare for new stream.
OsStatus pushPacket | ( | MpRtpBufPtr & | pRtp | ) |
Add an incoming RTP packet to the dejitter pool.
This method places the packet to the pool depending the modulo division value.
pRtp
with some other packet in the dejitter buffer. So you should dispose pRtp
pointer asap after calling this method.MpRtpBufPtr pullPacket | ( | ) |
Get next RTP packet, or NULL if none is available.
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.
MpRtpBufPtr pullPacket | ( | RtpTimestamp | timestamp, |
UtlBoolean * | nextFrameAvailable = NULL , |
||
bool | lockTimestamp = true |
||
) |
Get next RTP packet with given timestamp, or NULL if none is available.
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.
< RTP packet we will return
void setConnectionId | ( | MpConnectionID | connId | ) |
Set connection ID for debug purposes.
void setStreamId | ( | int | streamId | ) |
Set RTP stream ID for debug purposes.
void setFlowgrapName | ( | const UtlString & | fgName | ) |
Set flowgraph name for debug purposes.
|
inline |
Get number of packets in buffer, arrived in time.
|
inline |
Get number of late packets in buffer.
OsStatus getFirstPacketInfo | ( | RtpSeq & | packetSeq, |
RtpTimestamp & | packetTime | ||
) | const |
Get RTP header info. for first sequentially available packet.
|
private |
Assignment operator (not implemented for this class)
|
protected |
Buffer for incoming RTP packets.
|
protected |
Number of packets in buffer, arrived in time.
|
protected |
Number of packets in buffer, arrived late.
|
protected |
Number of packets overwritten with newly came packets.
|
protected |
Index of the last inserted packet.
|
protected |
Have we returned first RTP packet or not?
|
protected |
Keep track of the last sequence number returned, so that we can distinguish out-of-order packets.
|
protected |
Connection ID for debug purposes.
|
protected |
RTP stream ID for debug purposes.
|
protected |
Parent flowgraph for debug purposes.
|
protected |
Resource name for debug purposes.