# OpalBitRateCalculator Class Reference

`#include <ratectl.h>`

## Public Member Functions

| OpalBitRateCalculator ()
void | Reset ()
void | SetQuanta (unsigned quanta_)
unsigned | GetQuanta () const
void | AddPacket (PINDEX size, bool marker)
unsigned | GetBitRate ()
unsigned | GetAverageBitRate ()
unsigned | GetAveragePacketSize ()
unsigned | GetTrialBitRate (PINDEX size)
PInt64 | GetTotalSize () const
PInt64 | GetTotalTime () const
size_t | GetHistoryCount () const
unsigned | GetHistorySize () const
PInt64 | GetEarliestHistoryTime () const
unsigned | GetHistoryFrames () const
void | Flush ()

## Static Public Member Functions

static PInt64 | GetNow ()

## Protected Member Functions

void | Flush (PInt64 now)

## Protected Attributes

std::deque< History > | m_history
PINDEX | m_historySize
PInt64 | m_totalSize
PINDEX | m_historyFrames
unsigned | m_quanta
unsigned | m_bitRate
bool | m_first
PInt64 | m_baseTimeStamp

## Data Structures

struct | History

## Detailed Description

This class is used to calculate the instantaneous bit rate of a data stream using a one second sliding window

## Constructor & Destructor Documentation

OpalBitRateCalculator::OpalBitRateCalculator | ( |  | ) |

Create the calculator

## Member Function Documentation

void OpalBitRateCalculator::AddPacket | ( | PINDEX | size,
|  | bool | marker |
| ) |  |  |

Add a new packet to the bit rate calculations

void OpalBitRateCalculator::Flush | ( | PInt64 | now | ) | `[protected]`

void OpalBitRateCalculator::Flush | ( |  | ) |

unsigned OpalBitRateCalculator::GetAverageBitRate | ( |  | ) |

Get the average bit rate since SetQuanta was called

unsigned OpalBitRateCalculator::GetAveragePacketSize | ( |  | ) |

Get the average bit rate since SetQuanta was called

unsigned OpalBitRateCalculator::GetBitRate | ( |  | ) |

Get the instantaneous bit rate

PInt64 OpalBitRateCalculator::GetEarliestHistoryTime | ( |  | ) | const`[inline]`

Return earlist timestamp in history

size_t OpalBitRateCalculator::GetHistoryCount | ( |  | ) | const`[inline]`

Return number of frames in history

unsigned OpalBitRateCalculator::GetHistoryFrames | ( |  | ) | const

Return number of marker bits in history

unsigned OpalBitRateCalculator::GetHistorySize | ( |  | ) | const`[inline]`

Return number of bytes in history

static PInt64 OpalBitRateCalculator::GetNow | ( |  | ) | `[static]`

unsigned OpalBitRateCalculator::GetQuanta | ( |  | ) | const`[inline]`

Get the quanta (usually the frame time)

PInt64 OpalBitRateCalculator::GetTotalSize | ( |  | ) | const

Return total bytes sent since SetQuanta was called

PInt64 OpalBitRateCalculator::GetTotalTime | ( |  | ) | const

Return total miliseconds since SetQuanta was called

unsigned OpalBitRateCalculator::GetTrialBitRate | ( | PINDEX | size | ) |

return the bit rate if the specific data size was transmitted

void OpalBitRateCalculator::Reset | ( |  | ) |

Reset the statistics

void OpalBitRateCalculator::SetQuanta | ( | unsigned | quanta_ | ) |

Set the quanta (usually the frame time)

## Field Documentation

PInt64 OpalBitRateCalculator::m_baseTimeStamp `[protected]`

unsigned OpalBitRateCalculator::m_bitRate `[protected]`

bool OpalBitRateCalculator::m_first `[protected]`

std::deque<History> OpalBitRateCalculator::m_history `[protected]`

PINDEX OpalBitRateCalculator::m_historyFrames `[protected]`

PINDEX OpalBitRateCalculator::m_historySize `[protected]`

unsigned OpalBitRateCalculator::m_quanta `[protected]`

PInt64 OpalBitRateCalculator::m_totalSize `[protected]`

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

- ratectl.h