# OpalJitterBuffer Class Reference

`#include <jitter.h>`

Inheritance diagram for OpalJitterBuffer:

[legend]

## Public Member Functions

Construction
| OpalJitterBuffer (const Init &init)
virtual | ~OpalJitterBuffer ()
Overrides from PObject
void | PrintOn (ostream &strm) const
Operations
virtual void | Start ()
| Start jitter buffer.
void | SetDelay (const Init &init)
void | Reset ()
virtual PBoolean | WriteData (const RTP_DataFrame &frame, const PTimeInterval &tick=0)
virtual PBoolean | ReadData (RTP_DataFrame &frame, const PTimeInterval &tick=0)
DWORD | GetCurrentJitterDelay () const
DWORD | GetMinJitterDelay () const
DWORD | GetMaxJitterDelay () const
unsigned | GetTimeUnits () const
DWORD | GetPacketsTooLate () const
DWORD | GetBufferOverruns () const
DWORD | GetMaxConsecutiveMarkerBits () const
void | SetMaxConsecutiveMarkerBits (DWORD max)

## Protected Types

typedef std::map< DWORD, RTP_DataFrame > | FrameMap
| e_SynchronisationStart
| e_SynchronisationFill
| e_SynchronisationShrink
| e_SynchronisationDone
enum | { e_SynchronisationStart, e_SynchronisationFill, e_SynchronisationShrink, e_SynchronisationDone }

## Protected Member Functions

DWORD | CalculateRequiredTimestamp (DWORD playOutTimestamp) const
bool | AdjustCurrentJitterDelay (int delta)

## Protected Attributes

unsigned | m_timeUnits
PINDEX | m_packetSize
DWORD | m_minJitterDelay
| Minimum jitter delay in timestamp units.
DWORD | m_maxJitterDelay
| Maximum jitter delay in timestamp units.
int | m_jitterGrowTime
| Amount to increase jitter delay by when get "late" packet.
DWORD | m_jitterShrinkPeriod
int | m_jitterShrinkTime
| Amount to shrink jitter delay by if consistently filled.
DWORD | m_silenceShrinkPeriod
| Reduce jitter delay is silent for this long.
int | m_silenceShrinkTime
| Amount to shrink jitter delay by if consistently silent.
DWORD | m_jitterDriftPeriod
int | m_currentJitterDelay
DWORD | m_packetsTooLate
DWORD | m_bufferOverruns
DWORD | m_consecutiveMarkerBits
DWORD | m_maxConsecutiveMarkerBits
DWORD | m_consecutiveLatePackets
unsigned | m_frameTimeCount
DWORD | m_incomingFrameTime
int | m_lastFrameTime [2]
DWORD | m_lastSequenceNum
DWORD | m_lastTimestamp
DWORD | m_lastSyncSource
DWORD | m_bufferFilledTime
DWORD | m_bufferLowTime
DWORD | m_bufferEmptiedTime
int | m_timestampDelta
enum OpalJitterBuffer:: { ... } | m_synchronisationState
FrameMap | m_frames
PMutex | m_bufferMutex
RTP_JitterBufferAnalyser * | m_analyser

## Data Structures

struct | Init
| Initialisation information. More...

## 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

## Member Typedef Documentation

typedef std::map<DWORD, RTP_DataFrame> OpalJitterBuffer::FrameMap `[protected]`

## Member Enumeration Documentation

anonymous enum`[protected]`

Enumerator:

  e_SynchronisationStart |
  e_SynchronisationFill |
  e_SynchronisationShrink |
  e_SynchronisationDone |

## Constructor & Destructor Documentation

OpalJitterBuffer::OpalJitterBuffer | ( | const Init & | init | ) |

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

Parameters:

  init | Initialisation information

virtual OpalJitterBuffer::~OpalJitterBuffer | ( |  | ) | `[virtual]`

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

## Member Function Documentation

bool OpalJitterBuffer::AdjustCurrentJitterDelay | ( | int | delta | ) | `[protected]`

DWORD OpalJitterBuffer::CalculateRequiredTimestamp | ( | DWORD | playOutTimestamp | ) | const`[protected]`

DWORD OpalJitterBuffer::GetBufferOverruns | ( |  | ) | const`[inline]`

Get total number received packets that overran the jitter buffer.

DWORD OpalJitterBuffer::GetCurrentJitterDelay | ( |  | ) | const`[inline]`

Get current delay for jitter buffer.

DWORD OpalJitterBuffer::GetMaxConsecutiveMarkerBits | ( |  | ) | const`[inline]`

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

DWORD OpalJitterBuffer::GetMaxJitterDelay | ( |  | ) | const`[inline]`

Get maximum delay for jitter buffer.

DWORD OpalJitterBuffer::GetMinJitterDelay | ( |  | ) | const`[inline]`

Get minimum delay for jitter buffer.

DWORD OpalJitterBuffer::GetPacketsTooLate | ( |  | ) | const`[inline]`

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

unsigned OpalJitterBuffer::GetTimeUnits | ( |  | ) | const`[inline]`

Get time units.

void OpalJitterBuffer::PrintOn | ( | ostream & | strm | ) | const

Report the statistics for this jitter instance

virtual PBoolean OpalJitterBuffer::ReadData | ( | RTP_DataFrame & | frame,
|  | const PTimeInterval & | tick = `0` |
| ) |  |  | `[virtual]`

Read a data frame from the jitter buffer. This function never blocks. If no data is available, an RTP packet with zero payload size is returned.

Parameters:

  frame | Frame to extract from jitter buffer
  tick | Real time tick for packet removal

Reimplemented in OpalJitterBufferThread.

void OpalJitterBuffer::Reset | ( |  | ) |

Reset jitter buffer.

void OpalJitterBuffer::SetDelay | ( | const Init & | init | ) |

Set the maximum delay the jitter buffer will operate to.

Parameters:

  init | Initialisation information

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

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

virtual void OpalJitterBuffer::Start | ( |  | ) | `[inline, virtual]`

Start jitter buffer.

Reimplemented in OpalJitterBufferThread.

virtual PBoolean OpalJitterBuffer::WriteData | ( | const RTP_DataFrame & | frame,
|  | const PTimeInterval & | tick = `0` |
| ) |  |  | `[virtual]`

Write data frame from the RTP channel.

Parameters:

  frame | Frame to feed into jitter buffer
  tick | Real time tick for packet arrival

## Field Documentation

RTP_JitterBufferAnalyser* OpalJitterBuffer::m_analyser `[protected]`

DWORD OpalJitterBuffer::m_bufferEmptiedTime `[protected]`

DWORD OpalJitterBuffer::m_bufferFilledTime `[protected]`

DWORD OpalJitterBuffer::m_bufferLowTime `[protected]`

PMutex OpalJitterBuffer::m_bufferMutex `[protected]`

DWORD OpalJitterBuffer::m_bufferOverruns `[protected]`

DWORD OpalJitterBuffer::m_consecutiveLatePackets `[protected]`

DWORD OpalJitterBuffer::m_consecutiveMarkerBits `[protected]`

int OpalJitterBuffer::m_currentJitterDelay `[protected]`

FrameMap OpalJitterBuffer::m_frames `[protected]`

unsigned OpalJitterBuffer::m_frameTimeCount `[protected]`

DWORD OpalJitterBuffer::m_incomingFrameTime `[protected]`

DWORD OpalJitterBuffer::m_jitterDriftPeriod `[protected]`

int OpalJitterBuffer::m_jitterGrowTime `[protected]`

Amount to increase jitter delay by when get "late" packet.

DWORD OpalJitterBuffer::m_jitterShrinkPeriod `[protected]`

Period (in timestamp units) over which buffer is consistently filled before shrinking

int OpalJitterBuffer::m_jitterShrinkTime `[protected]`

Amount to shrink jitter delay by if consistently filled.

int OpalJitterBuffer::m_lastFrameTime[2]`[protected]`

DWORD OpalJitterBuffer::m_lastSequenceNum `[protected]`

DWORD OpalJitterBuffer::m_lastSyncSource `[protected]`

DWORD OpalJitterBuffer::m_lastTimestamp `[protected]`

DWORD OpalJitterBuffer::m_maxConsecutiveMarkerBits `[protected]`

DWORD OpalJitterBuffer::m_maxJitterDelay `[protected]`

Maximum jitter delay in timestamp units.

DWORD OpalJitterBuffer::m_minJitterDelay `[protected]`

Minimum jitter delay in timestamp units.

PINDEX OpalJitterBuffer::m_packetSize `[protected]`

DWORD OpalJitterBuffer::m_packetsTooLate `[protected]`

DWORD OpalJitterBuffer::m_silenceShrinkPeriod `[protected]`

Reduce jitter delay is silent for this long.

int OpalJitterBuffer::m_silenceShrinkTime `[protected]`

Amount to shrink jitter delay by if consistently silent.

enum { ... } OpalJitterBuffer::m_synchronisationState `[protected]`

int OpalJitterBuffer::m_timestampDelta `[protected]`

unsigned OpalJitterBuffer::m_timeUnits `[protected]`

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

- jitter.h