# `Membrane.RTP.AAC.Utils`
[🔗](https://github.com/membraneframework/membrane_rtp_aac_plugin/blob/v0.9.8/lib/membrane_element_rtp_aac/utils.ex#L1)

  This module defines helpers for payloading and depayloading non-encapsulated AAC into RTP payloads in accordance with RFC3640

# `mode`

```elixir
@type mode() :: :lbr | :hbr
```

  Bitrate mode
  Supported modes are low bitrate and high bitrate, with the main difference being the limits they impose on access unit size.
  For more details see validate_max_au_size/2 and bitrate_params/1 defined in this module.

# `make_headers`

```elixir
@spec make_headers([pos_integer()], mode()) :: binary()
```

  Utility function that constructs an AU header section for a payload with the corresponding AU sizes.
  From the RFC:
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. -+-+-+-+-+-+-+-+-+-+
    |AU-headers-length|AU-header|AU-header|      |AU-header|padding|
    |                 |   (1)   |   (2)   |      |   (n)   | bits  |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. -+-+-+-+-+-+-+-+-+-+
  It is important to note that for AAC each individual header is octet aligned, and so padding is not needed.
  The AU-headers-length is measured in bits, and for AAC defined to be coded using 16 bits.
  A single header consists of the size of the corresponding frame measured in bytes,
  followed by an AU-index for the first frame in the payload, and an AU-index-delta otherwise.
  The AU-index MUST be 0. The delta values need not be 0 in general unless one assumes no interleaving, as is done here.

# `parse_packet`

```elixir
@spec parse_packet(binary(), any()) :: {:ok, [binary()]} | {:error, any()}
```

  Parses an RTP payload by first parsing the header section and then the frames themselves.
  For more information about the header size, see make_headers/2 from this module.
  From the RFC:
       +---------+-----------+-----------+---------------+
       | RTP     | AU Header | Auxiliary | Access Unit   |
       | Header  | Section   | Section   | Data Section  |
       +---------+-----------+-----------+---------------+

                 <----------RTP Packet Payload----------->
  For AAC the auxiliary section must always be empty.

# `validate_max_au_size`

```elixir
@spec validate_max_au_size(mode(), binary()) :: boolean()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
