OpalJitterBuffer Class Reference

#include <jitter.h>

Inheritance diagram for OpalJitterBuffer:

RTP_JitterBuffer

List of all members.

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

Classes

class  Entry
class  FrameQueue


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::PrintOn ( ostream &  strm  )  const

Report the statistics for this jitter instance

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.

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::UseImmediateReduction ( PBoolean  state  )  [inline]

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

DWORD OpalJitterBuffer::GetJitterTime (  )  const [inline]

Get current delay for jitter buffer.

References currentJitterTime.

unsigned OpalJitterBuffer::GetTimeUnits (  )  const [inline]

Get time units.

References timeUnits.

DWORD OpalJitterBuffer::GetPacketsTooLate (  )  const [inline]

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

References packetsTooLate.

DWORD OpalJitterBuffer::GetBufferOverruns (  )  const [inline]

Get total number received packets that overran the jitter buffer.

References bufferOverruns.

DWORD OpalJitterBuffer::GetMaxConsecutiveMarkerBits (  )  const [inline]

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

References maxConsecutiveMarkerBits.

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

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

References maxConsecutiveMarkerBits.

virtual void OpalJitterBuffer::Resume (  )  [virtual]

Start jitter thread

OpalJitterBuffer::PDECLARE_NOTIFIER ( PThread  ,
OpalJitterBuffer  ,
JitterThreadMain   
)

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

References jitterThread, and shuttingDown.

bool OpalJitterBuffer::IsEmpty (  )  [inline]

References jitterBuffer.

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

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

References jitterBuffer.

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

References jitterBuffer.

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

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

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

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


Member Data Documentation

PINDEX OpalJitterBuffer::bufferSize [protected]

unsigned OpalJitterBuffer::timeUnits [protected]

Referenced by GetTimeUnits().

Referenced by GetJitterTime().

Referenced by GetPacketsTooLate().

unsigned OpalJitterBuffer::bufferOverruns [protected]

Referenced by GetBufferOverruns().

PTimeInterval OpalJitterBuffer::lastWriteTick [protected]

DWORD OpalJitterBuffer::jitterCalc [protected]

Referenced by UseImmediateReduction().

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

PMutex OpalJitterBuffer::bufferMutex [protected]

Referenced by WaitForTermination().

RTP_JitterBufferAnalyser* OpalJitterBuffer::analyser [protected]

PThread* OpalJitterBuffer::jitterThread [protected]

Referenced by WaitForTermination().


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

Generated on Fri Dec 11 06:24:14 2009 for OPAL by  doxygen 1.5.6