Home
AV module

FPSLimiter

PacketStream processor that caps packet throughput to a maximum FPS.

FPSLimiter

#include <icy/av/fpscounter.h>
class FPSLimiter

Defined in src/av/include/icy/av/fpscounter.h:152

Inherits: PacketProcessor

PacketStream processor that caps packet throughput to a maximum FPS.

If the observed frame rate exceeds the configured FPS budget, packets are dropped until the rate falls back under the limit.

Note that previous processors must not fragment packets, otherwise this class will not be accurate, and the packet drop rate will be too high.

List of all members

NameKindOwner
emittervariableDeclared here
FPSLimiterfunctionDeclared here
processfunctionDeclared here
onStreamStateChangefunctionDeclared here
_maxvariableDeclared here
_videoOnlyvariableDeclared here
_countervariableDeclared here
PacketProcessorfunctionInherited from PacketProcessor
processfunctionInherited from PacketProcessor
acceptsfunctionInherited from PacketProcessor
operator<<functionInherited from PacketProcessor
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
~PacketStreamAdapterfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
getEmitterfunctionInherited from PacketStreamAdapter
retentionfunctionInherited from PacketStreamAdapter
onStreamStateChangefunctionInherited from PacketStreamAdapter
_emittervariableInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter

Inherited from PacketProcessor

KindNameDescription
functionPacketProcessor inline
functionprocess virtualThis method performs processing on the given packet and emits the result.
functionaccepts virtual inlineThis method ensures compatibility with the given packet type. Return false to reject the packet.
functionoperator<< virtual inlineStream operator alias for process()

Inherited from PacketStreamAdapter

KindNameDescription
functionPacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
function~PacketStreamAdapter virtual inline
functionemit virtualEmit a mutable raw buffer as a packet.
functionemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
functionemit virtualEmit a string as a packet (data is copied internally).
functionemit virtualEmit a flag-only packet carrying no payload data.
functionemit virtualEmit an existing packet directly onto the outgoing signal.
functiongetEmitterReturns a reference to the outgoing packet signal.
functionretention virtual constReturns 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.
functiononStreamStateChange virtual inlineCalled 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
functionPacketStreamAdapterNonCopyable and NonMovable.
functionoperator=Deleted assignment operator.
functionPacketStreamAdapterDeleted constructor.
functionoperator=Deleted assignment operator.

Public Attributes

ReturnNameDescription
PacketSignalemitter

emitter

PacketSignal emitter

Defined in src/av/include/icy/av/fpscounter.h:192

Public Methods

ReturnNameDescription
FPSLimiter inlineConstruct the limiter.
voidprocess virtual inlineProcess a packet: forward it if within the rate limit, drop it otherwise.
voidonStreamStateChange virtual inlineReset the FPS counter when the stream state changes.

FPSLimiter

inline

inline FPSLimiter(int max, bool videoOnly = false)

Defined in src/av/include/icy/av/fpscounter.h:158

Construct the limiter.

Parameters

  • max The maximum allowed frame rate in frames per second.

  • videoOnly If true, non-VideoPacket packets are always forwarded regardless of rate.


process

virtual inline

virtual inline void process(IPacket & packet)

Defined in src/av/include/icy/av/fpscounter.h:167

Process a packet: forward it if within the rate limit, drop it otherwise.

Parameters

  • packet The incoming packet to evaluate.
Reimplements

onStreamStateChange

virtual inline

virtual inline void onStreamStateChange(const PacketStreamState &)

Defined in src/av/include/icy/av/fpscounter.h:187

Reset the FPS counter when the stream state changes.

Reimplements

Protected Attributes

ReturnNameDescription
int_max
bool_videoOnly
legacy::FPSCounter_counter

_max

int _max

Defined in src/av/include/icy/av/fpscounter.h:195


_videoOnly

bool _videoOnly

Defined in src/av/include/icy/av/fpscounter.h:196


_counter

legacy::FPSCounter _counter

Defined in src/av/include/icy/av/fpscounter.h:197