RealtimePacketQueue
RealtimePacketQueue
#include <icy/av/realtimepacketqueue.h>template<class PacketT>
class RealtimePacketQueueDefined in src/av/include/icy/av/realtimepacketqueue.h:30
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.
List of all members
| Name | Kind | Owner |
|---|---|---|
RealtimePacketQueue | function | Declared here |
~RealtimePacketQueue | function | Declared here |
push | function | Declared here |
realTime | function | Declared here |
_startTime | variable | Declared here |
popNext | function | Declared here |
onStreamStateChange | function | Declared here |
BaseQueue | typedef | Declared here |
emitter | variable | Inherited from AsyncPacketQueue |
AsyncPacketQueue | function | Inherited from AsyncPacketQueue |
~AsyncPacketQueue | function | Inherited from AsyncPacketQueue |
close | function | Inherited from AsyncPacketQueue |
process | function | Inherited from AsyncPacketQueue |
accepts | function | Inherited from AsyncPacketQueue |
retention | function | Inherited from AsyncPacketQueue |
dispatch | function | Inherited from AsyncPacketQueue |
onStreamStateChange | function | Inherited from AsyncPacketQueue |
Queue | typedef | Inherited from AsyncPacketQueue |
Processor | typedef | Inherited from AsyncPacketQueue |
AsyncQueue | function | Inherited from AsyncQueue |
cancel | function | Inherited from AsyncQueue |
_thread | variable | Inherited from AsyncQueue |
~AsyncQueue | function | Inherited from AsyncQueue |
Queue | typedef | Inherited from AsyncQueue |
ondispatch | variable | Inherited from RunnableQueue |
RunnableQueue | function | Inherited from RunnableQueue |
~RunnableQueue | function | Inherited from RunnableQueue |
push | function | Inherited from RunnableQueue |
flush | function | Inherited from RunnableQueue |
clear | function | Inherited from RunnableQueue |
run | function | Inherited from RunnableQueue |
runTimeout | function | Inherited from RunnableQueue |
dispatch | function | Inherited from RunnableQueue |
timeout | function | Inherited from RunnableQueue |
setTimeout | function | Inherited from RunnableQueue |
dropped | function | Inherited from RunnableQueue |
_limit | variable | Inherited from RunnableQueue |
_timeout | variable | Inherited from RunnableQueue |
_dropped | variable | Inherited from RunnableQueue |
RunnableQueue | function | Inherited from RunnableQueue |
operator= | function | Inherited from RunnableQueue |
RunnableQueue | function | Inherited from RunnableQueue |
operator= | function | Inherited from RunnableQueue |
popNext | function | Inherited from RunnableQueue |
dispatchNext | function | Inherited from RunnableQueue |
push | function | Inherited from Queue |
push | function | Inherited from Queue |
empty | function | Inherited from Queue |
front | function | Inherited from Queue |
back | function | Inherited from Queue |
pop | function | Inherited from Queue |
sort | function | Inherited from Queue |
size | function | Inherited from Queue |
queue | function | Inherited from Queue |
_queue | variable | Inherited from Queue |
_mutex | variable | Inherited from Queue |
Runnable | function | Inherited from Runnable |
~Runnable | function | Inherited from Runnable |
run | function | Inherited from Runnable |
cancel | function | Inherited from Runnable |
cancelled | function | Inherited from Runnable |
exit | variable | Inherited from Runnable |
PacketProcessor | function | Inherited from PacketProcessor |
process | function | Inherited from PacketProcessor |
accepts | function | Inherited from PacketProcessor |
operator<< | function | Inherited from PacketProcessor |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
~PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
getEmitter | function | Inherited from PacketStreamAdapter |
retention | function | Inherited from PacketStreamAdapter |
onStreamStateChange | function | Inherited from PacketStreamAdapter |
_emitter | variable | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
Inherited from AsyncPacketQueue
| Kind | Name | Description |
|---|---|---|
variable | emitter | |
function | AsyncPacketQueue inline | |
function | ~AsyncPacketQueue virtual inline | |
function | close virtual inline | Flushes remaining packets, cancels the queue, and joins the dispatch thread. |
function | process virtual inline override | Clones the incoming packet and pushes it onto the async queue. This queue is therefore an explicit PacketStream ownership boundary. Drops the packet with a warning if the queue has been cancelled. |
function | accepts virtual inline override | Returns true if the packet can be cast to type T. |
function | retention virtual const inline override | Returns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph. |
function | dispatch virtual inline override | Emits the packet to downstream processors from the async thread. |
function | onStreamStateChange virtual inline override | Closes the queue on [Error](icy-Error.html#error) or Closed stream state transitions. |
typedef | Queue | |
typedef | Processor |
Inherited from AsyncQueue
| Kind | Name | Description |
|---|---|---|
function | AsyncQueue inline | |
function | cancel virtual inline override | Cancels the queue and joins the dispatch thread. |
variable | _thread | |
function | ~AsyncQueue virtual inline | |
typedef | Queue |
Inherited from RunnableQueue
| Kind | Name | Description |
|---|---|---|
variable | ondispatch | The default dispatch function. Must be set before the queue is running. |
function | RunnableQueue inline | |
function | ~RunnableQueue virtual inline | |
function | push virtual inline | Push an item onto the queue. The queue takes ownership of the item pointer. |
function | flush virtual inline | Flush all outgoing items. |
function | clear inline | |
function | run virtual inline override | Called asynchronously to dispatch queued items. If not timeout is set this method blocks until cancel() is called, otherwise runTimeout() will be called. |
function | runTimeout virtual inline | Called asynchronously to dispatch queued items until the queue is empty or the timeout expires. Pseudo protected for std::bind compatability. |
function | dispatch virtual inline | Dispatch a single item to listeners. |
function | timeout inline | |
function | setTimeout inline | Sets the dispatch timeout. Must only be called when the queue is empty. |
function | dropped const inline | |
variable | _limit | |
variable | _timeout | |
variable | _dropped | |
function | RunnableQueue | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | RunnableQueue | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | popNext virtual inline | Pops the next waiting item. |
function | dispatchNext virtual inline | Pops and dispatches the next waiting item. |
Inherited from Queue
| Kind | Name | Description |
|---|---|---|
function | push inline | Appends an item to the back of the queue (thread-safe). |
function | push inline | Appends an item to the back of the queue by move (thread-safe). |
function | empty const inline | |
function | front const inline | |
function | back const inline | |
function | pop inline | Removes the front item from the queue (thread-safe). |
function | sort inline | Sorts all queued items using the given comparator (thread-safe). |
function | size const inline | |
function | queue const inline | |
variable | _queue | |
variable | _mutex |
Inherited from Runnable
| Kind | Name | Description |
|---|---|---|
function | Runnable inline | |
function | ~Runnable virtual | Defaulted destructor. |
function | run virtual | The run method will be called by the asynchronous context. |
function | cancel virtual inline | Cancel the current task. The run() method should return ASAP. |
function | cancelled virtual const inline | Returns true when the task has been cancelled. |
variable | exit |
Inherited from PacketProcessor
| Kind | Name | Description |
|---|---|---|
function | PacketProcessor inline | |
function | process virtual | This method performs processing on the given packet and emits the result. |
function | accepts virtual inline | This method ensures compatibility with the given packet type. Return false to reject the packet. |
function | operator<< virtual inline | Stream operator alias for process() |
Inherited from PacketStreamAdapter
| Kind | Name | Description |
|---|---|---|
function | PacketStreamAdapter | Construct the adapter, binding it to the given packet signal. |
function | ~PacketStreamAdapter virtual inline | |
function | emit virtual | Emit a mutable raw buffer as a packet. |
function | emit virtual | Emit a read-only raw buffer as a packet (data is copied internally). |
function | emit virtual | Emit a string as a packet (data is copied internally). |
function | emit virtual | Emit a flag-only packet carrying no payload data. |
function | emit virtual | Emit an existing packet directly onto the outgoing signal. |
function | getEmitter | Returns a reference to the outgoing packet signal. |
function | retention virtual const | Returns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph. |
function | onStreamStateChange virtual inline | Called by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios. |
variable | _emitter | |
function | PacketStreamAdapter | NonCopyable and NonMovable. |
function | operator= | Deleted assignment operator. |
function | PacketStreamAdapter | Deleted constructor. |
function | operator= | Deleted assignment operator. |
Public Methods
| Return | Name | Description |
|---|---|---|
RealtimePacketQueue inline | Construct the queue with a maximum capacity. | |
void | push virtual inline override | Insert a packet into the queue and re-sort by presentation timestamp. |
int64_t | realTime inline | Return the elapsed time since stream activation in microseconds. |
RealtimePacketQueue
inline
inline RealtimePacketQueue(int maxSize = 1024)Defined in src/av/include/icy/av/realtimepacketqueue.h:37
Construct the queue with a maximum capacity.
Parameters
maxSizeThe maximum number of packets the queue will hold.
push
virtual inline override
virtual inline void push(PacketT * item) overrideDefined in src/av/include/icy/av/realtimepacketqueue.h:48
Insert a packet into the queue and re-sort by presentation timestamp.
Parameters
itemThe packet to enqueue; ownership is transferred.
realTime
inline
inline int64_t realTime()Defined in src/av/include/icy/av/realtimepacketqueue.h:55
Return the elapsed time since stream activation in microseconds.
Protected Attributes
| Return | Name | Description |
|---|---|---|
int64_t | _startTime |
_startTime
int64_t _startTimeDefined in src/av/include/icy/av/realtimepacketqueue.h:98
Protected Methods
| Return | Name | Description |
|---|---|---|
PacketT * | popNext virtual inline override | Return the next packet whose timestamp is <= realTime(), or nullptr if none is ready. |
void | onStreamStateChange virtual inline override | Record the stream start time when the stream becomes active. |
popNext
virtual inline override
virtual inline PacketT * popNext() overrideDefined in src/av/include/icy/av/realtimepacketqueue.h:62
Return the next packet whose timestamp is <= realTime(), or nullptr if none is ready.
Reimplements
onStreamStateChange
virtual inline override
virtual inline void onStreamStateChange(const PacketStreamState & state) overrideDefined in src/av/include/icy/av/realtimepacketqueue.h:78
Record the stream start time when the stream becomes active.
Reimplements
Public Types
| Name | Description |
|---|---|
BaseQueue |
BaseQueue
using BaseQueue = AsyncPacketQueue< PacketT >