AV module

RealtimePacketQueue

[Queue]({#ref classicy_1_1Queue #}) that emits media packets in presentation-timestamp order relative to a realtime clock.

RealtimePacketQueue

#include <icy/av/realtimepacketqueue.h>

Inherits: AsyncPacketQueue< PacketT >

Queue that emits media packets in presentation-timestamp order relative to a realtime clock.

Packets are sorted by their time field on insertion. On each pop attempt the queue checks whether the wall-clock time since stream activation has reached the next packet's timestamp; if not, the packet is held back. This provides a soft realtime playback scheduler.

Public Methods

ReturnNameDescription
RealtimePacketQueue inlineConstruct the queue with a maximum capacity.
voidpush virtual inlineInsert a packet into the queue and re-sort by presentation timestamp.
int64_trealTime inlineReturn the elapsed time since stream activation in microseconds.

RealtimePacketQueue

inline

inline RealtimePacketQueue(int maxSize)

Construct the queue with a maximum capacity.

Parameters

  • maxSize The maximum number of packets the queue will hold.

push

virtual inline

virtual inline void push(PacketT * item)

Insert a packet into the queue and re-sort by presentation timestamp.

Parameters

  • item The packet to enqueue; ownership is transferred.

realTime

inline

inline int64_t realTime()

Return the elapsed time since stream activation in microseconds.

Protected Attributes

ReturnNameDescription
int64_t_startTime

_startTime

int64_t _startTime

Protected Methods

ReturnNameDescription
PacketT *popNext virtual inlineReturn the next packet whose timestamp is <= realTime(), or nullptr if none is ready.
voidonStreamStateChange virtual inlineRecord the stream start time when the stream becomes active.

popNext

virtual inline

virtual inline PacketT * popNext()

Return the next packet whose timestamp is <= realTime(), or nullptr if none is ready.


onStreamStateChange

virtual inline

virtual inline void onStreamStateChange(const PacketStreamState & state)

Record the stream start time when the stream becomes active.

Public Types

NameDescription
BaseQueue

BaseQueue

AsyncPacketQueue< PacketT > BaseQueue()