PacketStreamAdapter
PacketStreamAdapter
#include <icy/packetstream.h>Subclassed by:
PacketProcessor,ThreadedStreamReader,ICapture,FormWriter,WebRtcTrackReceiver
This class is a wrapper for integrating external classes with the a PacketStream's data flow and state machine.
Public Methods
| Return | Name | Description |
|---|---|---|
PacketStreamAdapter | Construct the adapter, binding it to the given packet signal. | |
void | emit virtual | Emit a mutable raw buffer as a packet. |
void | emit virtual | Emit a read-only raw buffer as a packet (data is copied internally). |
void | emit virtual | Emit a string as a packet (data is copied internally). |
void | emit virtual | Emit a flag-only packet carrying no payload data. |
void | emit virtual | Emit an existing packet directly onto the outgoing signal. |
PacketSignal & | getEmitter | Returns a reference to the outgoing packet signal. |
PacketRetention | 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. |
void | 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. |
PacketStreamAdapter
PacketStreamAdapter(PacketSignal & emitter)Construct the adapter, binding it to the given packet signal.
Parameters
emitterThe outgoing packet signal owned by the subclass.
emit
virtual
virtual void emit(char * data, size_t len, unsigned flags)Emit a mutable raw buffer as a packet.
Parameters
dataPointer to the buffer (not copied; caller retains ownership).lenNumber of bytes in the buffer.flagsOptional packet flags (see PacketFlags).
emit
virtual
virtual void emit(const char * data, size_t len, unsigned flags)Emit a read-only raw buffer as a packet (data is copied internally).
Parameters
dataPointer to the buffer.lenNumber of bytes in the buffer.flagsOptional packet flags (see PacketFlags).
emit
virtual
virtual void emit(const std::string & str, unsigned flags)Emit a string as a packet (data is copied internally).
Parameters
strString payload.flagsOptional packet flags (see PacketFlags).
emit
virtual
virtual void emit(unsigned flags)Emit a flag-only packet carrying no payload data.
Parameters
flagsPacket flags to embed in the emitted FlagPacket.
emit
virtual
virtual void emit(IPacket & packet)Emit an existing packet directly onto the outgoing signal.
Parameters
packetThe packet to forward; must remain valid for the duration of the call.
getEmitter
PacketSignal & getEmitter()Returns a reference to the outgoing packet signal.
retention
virtual const
virtual PacketRetention retention() 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.
onStreamStateChange
virtual inline
virtual inline void onStreamStateChange(const PacketStreamState &)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.
Protected Attributes
| Return | Name | Description |
|---|---|---|
PacketSignal & | _emitter |
_emitter
PacketSignal & _emitterProtected Methods
| Return | Name | Description |
|---|---|---|
PacketStreamAdapter | NonCopyable and NonMovable. | |
PacketStreamAdapter | Deleted constructor. |
PacketStreamAdapter
PacketStreamAdapter(const PacketStreamAdapter &) = deleteNonCopyable and NonMovable.
PacketStreamAdapter
PacketStreamAdapter(PacketStreamAdapter &&) = deleteDeleted constructor.
