OpalJitterBuffer Class Reference

#include <jitter.h>

Inheritance diagram for OpalJitterBuffer:

RTP_JitterBuffer

List of all members.

Classes

class  Entry
class  FrameQueue

Public Member Functions

 OpalJitterBuffer (unsigned minJitterDelay, unsigned maxJitterDelay, unsigned timeUnits=8, PINDEX stackSize=30000)
virtual ~OpalJitterBuffer ()
void PrintOn (ostream &strm) const
virtual PBoolean OnReadPacket (RTP_DataFrame &frame, PBoolean loop)=0
void SetDelay (unsigned minJitterDelay, unsigned maxJitterDelay)
void UseImmediateReduction (PBoolean state)
virtual PBoolean ReadData (RTP_DataFrame &frame)
DWORD GetJitterTime () const
unsigned GetTimeUnits () const
DWORD GetPacketsTooLate () const
DWORD GetBufferOverruns () const
DWORD GetMaxConsecutiveMarkerBits () const
void SetMaxConsecutiveMarkerBits (DWORD max)
virtual void Resume ()
 PDECLARE_NOTIFIER (PThread, OpalJitterBuffer, JitterThreadMain)
PBoolean WaitForTermination (const PTimeInterval &t)
bool IsEmpty ()

Protected Member Functions

void Start (unsigned _minJitterTime, unsigned _maxJitterTime)
EntryGetNewest (bool pop)
EntryGetOldest (bool pop)
PBoolean Init (Entry *&currentReadFrame, PBoolean &markerWarning)
PBoolean PreRead (Entry *&currentReadFrame, PBoolean &markerWarning)
PBoolean OnRead (Entry *&currentReadFrame, PBoolean &markerWarning, PBoolean loop)
void DeInit (Entry *&currentReadFrame, PBoolean &markerWarning)

Protected Attributes

PINDEX bufferSize
DWORD minJitterTime
DWORD maxJitterTime
DWORD maxConsecutiveMarkerBits
unsigned timeUnits
DWORD currentJitterTime
DWORD packetsTooLate
unsigned bufferOverruns
unsigned consecutiveBufferOverruns
DWORD consecutiveMarkerBits
PTimeInterval consecutiveEarlyPacketStartTime
DWORD lastWriteTimestamp
PTimeInterval lastWriteTick
DWORD jitterCalc
DWORD targetJitterTime
unsigned jitterCalcPacketCount
bool doJitterReductionImmediately
FrameQueue freeFrames
FrameQueue jitterBuffer
EntrycurrentFrame
PMutex bufferMutex
bool shuttingDown
bool preBuffering
bool firstReadData
RTP_JitterBufferAnalyser * analyser
PThread * jitterThread
PINDEX jitterStackSize


Detailed Description

This is an Abstract jitter buffer, which can be used simply in any application. The user is required to use a descendant of this class, and provide a "OnReadPacket" method, so that network packets can be placed in this class instance

Constructor & Destructor Documentation

OpalJitterBuffer::OpalJitterBuffer ( unsigned  minJitterDelay,
unsigned  maxJitterDelay,
unsigned  timeUnits = 8,
PINDEX  stackSize = 30000 
)

Constructor for this jitter buffer. The size of this buffer can be altered later with the SetDelay method

Parameters:
minJitterDelay Minimum delay in RTP timestamp units
maxJitterDelay Maximum delay in RTP timestamp units
timeUnits Time units, usually 8 or 16
stackSize Stack size for jitter thread

virtual OpalJitterBuffer::~OpalJitterBuffer (  )  [virtual]

Destructor, which closes this down and deletes the internal list of frames


Member Function Documentation

void OpalJitterBuffer::DeInit ( Entry *&  currentReadFrame,
PBoolean &  markerWarning 
) [protected]

DWORD OpalJitterBuffer::GetBufferOverruns (  )  const [inline]

Get total number received packets that overran the jitter buffer.

References bufferOverruns.

DWORD OpalJitterBuffer::GetJitterTime (  )  const [inline]

Get current delay for jitter buffer.

References currentJitterTime.

DWORD OpalJitterBuffer::GetMaxConsecutiveMarkerBits (  )  const [inline]

Get maximum consecutive marker bits before buffer starts to ignore them.

References maxConsecutiveMarkerBits.

Entry* OpalJitterBuffer::GetNewest ( bool  pop  )  [inline, protected]

References jitterBuffer.

Entry* OpalJitterBuffer::GetOldest ( bool  pop  )  [inline, protected]

References jitterBuffer.

DWORD OpalJitterBuffer::GetPacketsTooLate (  )  const [inline]

Get total number received packets too late to go into jitter buffer.

References packetsTooLate.

unsigned OpalJitterBuffer::GetTimeUnits (  )  const [inline]

Get time units.

References timeUnits.

PBoolean OpalJitterBuffer::Init ( Entry *&  currentReadFrame,
PBoolean &  markerWarning 
) [protected]

bool OpalJitterBuffer::IsEmpty (  )  [inline]

References jitterBuffer.

PBoolean OpalJitterBuffer::OnRead ( Entry *&  currentReadFrame,
PBoolean &  markerWarning,
PBoolean  loop 
) [protected]

virtual PBoolean OpalJitterBuffer::OnReadPacket ( RTP_DataFrame frame,
PBoolean  loop 
) [pure virtual]

This method is where this OpalJitterBuffer collects data from the outside world. A descendant class of OpalJitterBuffer will override this method

Returns:
PTrue on successful read, PFalse on faulty read.
Parameters:
frame Frame read from the RTP session
loop If PTrue, loop as long as data is available, if PFalse, only process once

Implemented in RTP_JitterBuffer.

OpalJitterBuffer::PDECLARE_NOTIFIER ( PThread  ,
OpalJitterBuffer  ,
JitterThreadMain   
)

PBoolean OpalJitterBuffer::PreRead ( Entry *&  currentReadFrame,
PBoolean &  markerWarning 
) [protected]

void OpalJitterBuffer::PrintOn ( ostream &  strm  )  const

Report the statistics for this jitter instance

virtual PBoolean OpalJitterBuffer::ReadData ( RTP_DataFrame frame  )  [virtual]

Read a data frame from the RTP channel. Any control frames received are dispatched to callbacks and are not returned by this function. It will block until a data frame is available or an error occurs.

Parameters:
frame Frame read from the RTP session

virtual void OpalJitterBuffer::Resume (  )  [virtual]

Start jitter thread

void OpalJitterBuffer::SetDelay ( unsigned  minJitterDelay,
unsigned  maxJitterDelay 
)

Set the maximum delay the jitter buffer will operate to.

Parameters:
minJitterDelay Minimum delay in RTP timestamp units
maxJitterDelay Maximum delay in RTP timestamp units

void OpalJitterBuffer::SetMaxConsecutiveMarkerBits ( DWORD  max  )  [inline]

Set maximum consecutive marker bits before buffer starts to ignore them.

References maxConsecutiveMarkerBits.

void OpalJitterBuffer::Start ( unsigned  _minJitterTime,
unsigned  _maxJitterTime 
) [protected]

void OpalJitterBuffer::UseImmediateReduction ( PBoolean  state  )  [inline]

PBoolean OpalJitterBuffer::WaitForTermination ( const PTimeInterval &  t  )  [inline]

References jitterThread, and shuttingDown.


Member Data Documentation

RTP_JitterBufferAnalyser* OpalJitterBuffer::analyser [protected]

PMutex OpalJitterBuffer::bufferMutex [protected]

unsigned OpalJitterBuffer::bufferOverruns [protected]

Referenced by GetBufferOverruns().

PINDEX OpalJitterBuffer::bufferSize [protected]

Referenced by GetJitterTime().

Referenced by UseImmediateReduction().

Referenced by GetNewest(), GetOldest(), and IsEmpty().

DWORD OpalJitterBuffer::jitterCalc [protected]

PThread* OpalJitterBuffer::jitterThread [protected]

Referenced by WaitForTermination().

PTimeInterval OpalJitterBuffer::lastWriteTick [protected]

Referenced by GetPacketsTooLate().

Referenced by WaitForTermination().

unsigned OpalJitterBuffer::timeUnits [protected]

Referenced by GetTimeUnits().


The documentation for this class was generated from the following file:

Generated on Fri Apr 10 21:32:55 2009 for OPAL by  doxygen 1.5.8