MythTV  master
Public Member Functions | Protected Attributes | List of all members
PacketBuffer Class Referenceabstract

#include <packetbuffer.h>

Inheritance diagram for PacketBuffer:
Inheritance graph
[legend]

Public Member Functions

 PacketBuffer (unsigned int bitrate)
 
virtual ~PacketBuffer ()=default
 
virtual void PushDataPacket (const UDPPacket &)=0
 
virtual void PushFECPacket (const UDPPacket &, unsigned int)=0
 
bool HasAvailablePacket (void) const
 Returns true if there are ordered packets ready for processing. More...
 
UDPPacket PopDataPacket (void)
 Fetches a data packet for processing. More...
 
UDPPacket GetEmptyPacket (void)
 Gets a packet for use in PushDataPacket/PushFECPacket. More...
 
void FreePacket (const UDPPacket &)
 Frees an RTPDataPacket returned by PopDataPacket. More...
 

Protected Attributes

uint m_bitrate
 
uint64_t m_next_empty_packet_key
 Packets key to use for next empty packet. More...
 
QMap< uint64_t, UDPPacketm_empty_packets
 Packets ready for reuse. More...
 
QList< UDPPacketm_available_packets
 Ordered list of available packets. More...
 

Detailed Description

Definition at line 15 of file packetbuffer.h.

Constructor & Destructor Documentation

◆ PacketBuffer()

PacketBuffer::PacketBuffer ( unsigned int  bitrate)
explicit

Definition at line 14 of file packetbuffer.cpp.

◆ ~PacketBuffer()

virtual PacketBuffer::~PacketBuffer ( )
virtualdefault

Member Function Documentation

◆ PushDataPacket()

virtual void PacketBuffer::PushDataPacket ( const UDPPacket )
pure virtual

◆ PushFECPacket()

virtual void PacketBuffer::PushFECPacket ( const UDPPacket ,
unsigned int   
)
pure virtual

◆ HasAvailablePacket()

bool PacketBuffer::HasAvailablePacket ( void  ) const

Returns true if there are ordered packets ready for processing.

Definition at line 26 of file packetbuffer.cpp.

Referenced by IPTVStreamHandlerWriteHelper::timerEvent().

◆ PopDataPacket()

UDPPacket PacketBuffer::PopDataPacket ( void  )

Fetches a data packet for processing.

Call FreePacket() when done with the packet.

Definition at line 31 of file packetbuffer.cpp.

Referenced by IPTVStreamHandlerWriteHelper::timerEvent().

◆ GetEmptyPacket()

UDPPacket PacketBuffer::GetEmptyPacket ( void  )

Gets a packet for use in PushDataPacket/PushFECPacket.

Definition at line 42 of file packetbuffer.cpp.

Referenced by IPTVStreamHandlerReadHelper::ReadPending().

◆ FreePacket()

void PacketBuffer::FreePacket ( const UDPPacket packet)

Frees an RTPDataPacket returned by PopDataPacket.

Note
Since we return UDPPackets and not pointers to packets we don't leak if this isn't called, but by preventing the reference count on the QByteArrays from going to 0 we can reuse the byte array and avoid mallocs.

Definition at line 56 of file packetbuffer.cpp.

Referenced by UDPPacketBuffer::PushFECPacket(), and IPTVStreamHandlerWriteHelper::timerEvent().

Member Data Documentation

◆ m_bitrate

uint PacketBuffer::m_bitrate
protected

Definition at line 44 of file packetbuffer.h.

◆ m_next_empty_packet_key

uint64_t PacketBuffer::m_next_empty_packet_key
protected

Packets key to use for next empty packet.

Definition at line 47 of file packetbuffer.h.

Referenced by FreePacket(), GetEmptyPacket(), and PacketBuffer().

◆ m_empty_packets

QMap<uint64_t, UDPPacket> PacketBuffer::m_empty_packets
protected

Packets ready for reuse.

Definition at line 50 of file packetbuffer.h.

Referenced by FreePacket(), and GetEmptyPacket().

◆ m_available_packets

QList<UDPPacket> PacketBuffer::m_available_packets
protected

Ordered list of available packets.

Definition at line 53 of file packetbuffer.h.

Referenced by HasAvailablePacket(), PopDataPacket(), and UDPPacketBuffer::PushDataPacket().


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