#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.
| 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(PacketSignal & emitter)Construct the adapter, binding it to the given packet signal.
emitter The outgoing packet signal owned by the subclass.virtual
virtual void emit(char * data, size_t len, unsigned flags)Emit a mutable raw buffer as a packet.
data Pointer to the buffer (not copied; caller retains ownership).
len Number of bytes in the buffer.
flags Optional packet flags (see PacketFlags).
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).
data Pointer to the buffer.
len Number of bytes in the buffer.
flags Optional packet flags (see PacketFlags).
virtual
virtual void emit(const std::string & str, unsigned flags)Emit a string as a packet (data is copied internally).
str String payload.
flags Optional packet flags (see PacketFlags).
virtual
virtual void emit(unsigned flags)Emit a flag-only packet carrying no payload data.
flags Packet flags to embed in the emitted FlagPacket.virtual
virtual void emit(IPacket & packet)Emit an existing packet directly onto the outgoing signal.
packet The packet to forward; must remain valid for the duration of the call.PacketSignal & getEmitter()Returns a reference to the outgoing packet signal.
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.
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.
| Return | Name | Description |
|---|---|---|
PacketSignal & | _emitter |
PacketSignal & _emitter| Return | Name | Description |
|---|---|---|
PacketStreamAdapter | NonCopyable and NonMovable. | |
PacketStreamAdapter | Deleted constructor. |
PacketStreamAdapter(const PacketStreamAdapter &) = deleteNonCopyable and NonMovable.
PacketStreamAdapter(PacketStreamAdapter &&) = deleteDeleted constructor.