View Source ExRTCP.Packet (ex_rtcp v0.4.0)
RTCP packet encoding and decoding functionalities.
Examples
iex> packet = %ExRTCP.Packet.SenderReport{
...> ssrc: 123_456,
...> ntp_timestamp: 5_000_000,
...> rtp_timestamp: 436_133,
...> packet_count: 5,
...> octet_count: 89
...> }
iex> encoded = ExRTCP.Packet.encode(packet, padding: 8)
iex> {:ok, ^packet} = ExRTCP.Packet.decode(encoded)
Summary
Functions
Decodes RTCP packet. Returns a struct representing the packet based on its type.
Encodes the packet and returns the resulting binary.
Types
@type decode_error() :: :invalid_packet | :unknown_type
Possible decode/1
errors.
:invalid_packet
- this binary could not be parsed as a valid RTCP packet:unknown_type
- this type of RTCP packet is not supported or does not exist
@type int16() :: -32768..32767
@type int24() :: -8_388_608..8_388_607
@type packet() :: ExRTCP.Packet.SenderReport.t() | ExRTCP.Packet.ReceiverReport.t() | ExRTCP.Packet.SourceDescription.t() | ExRTCP.Packet.Goodbye.t() | ExRTCP.Packet.TransportFeedback.NACK.t() | ExRTCP.Packet.TransportFeedback.CC.t() | ExRTCP.Packet.PayloadFeedback.PLI.t() | ExRTCP.Packet.PayloadFeedback.FIR.t()
@type uint8() :: 0..255
@type uint13() :: 0..8191
@type uint16() :: 0..65535
@type uint24() :: 0..16_777_216
@type uint32() :: 0..4_294_967_295
@type uint64() :: 0..18_446_744_073_709_551_615
Functions
@spec decode(binary()) :: {:ok, packet()} | {:error, decode_error()}
Decodes RTCP packet. Returns a struct representing the packet based on its type.
Encodes the packet and returns the resulting binary.
Options:
padding
- number of padding bytes added to packet, no padding is added by default, must be multiple of 4, and smaller than 256