#include <icy/av/audiopacketencoder.h>Inherits:
AudioEncoder,PacketProcessor
PacketProcessor that encodes raw audio samples (PlanarAudioPacket or AudioPacket) into compressed packets via AudioEncoder.
Drop this into a PacketStream between a source that emits raw audio (e.g. MediaCapture) and a sink that expects encoded data (e.g. WebRtcTrackSender or MultiplexPacketEncoder).
Example:
auto encoder = std::make_sharedav::AudioPacketEncoder(); encoder->oparams = av::AudioCodec("opus", "libopus", 2, 48000);
PacketStream stream; stream.attachSource(capture); stream.attach(encoder, 1, true); stream.attach(&webrtcSender, 5, false); stream.start();
| Return | Name | Description |
|---|---|---|
AudioPacketEncoder | ||
AudioPacketEncoder | Deleted constructor. | |
void | process virtual | Process an AudioPacket or PlanarAudioPacket from the stream. Encodes the samples and emits the resulting compressed packet. |
bool | accepts virtual | Accept AudioPacket and PlanarAudioPacket types. |
AudioPacketEncoder(AVFormatContext * format)AudioPacketEncoder(const AudioPacketEncoder &) = deleteDeleted constructor.
virtual
virtual void process(IPacket & packet)Process an AudioPacket or PlanarAudioPacket from the stream. Encodes the samples and emits the resulting compressed packet.
virtual
virtual bool accepts(IPacket * packet)Accept AudioPacket and PlanarAudioPacket types.
| Return | Name | Description |
|---|---|---|
bool | _initialized | |
std::mutex | _mutex |
bool _initialized = falsestd::mutex _mutex| Return | Name | Description |
|---|---|---|
void | onStreamStateChange virtual | 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. |
virtual
virtual 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.