View Source Membrane.RTP.SilenceDiscarder (Membrane RTP plugin v0.27.1)

Element responsible for dropping silent audio packets.

For a packet to be discarded it needs to contain a RTP.Header.Extension struct with identifier equal to vad_id in its extensions list. The header extension will contain information about audio level (VAD extension is required). The element will only drop packets whose audio level is above given silence threshold (muted audio is of value 127).

Elixir.Membrane.RTP.SilenceDiscarder will drop as many silent packets as possible and on reaching dropping limit it will send the current buffer, reset dropped packets counter and emit Membrane.RTP.DroppedPacketEvent with a number of packets that have been dropped until that point. The event gets sent on both reaching dropping limit and when a non-silent packet arrives.

Element options

Passed via struct Membrane.RTP.SilenceDiscarder.t/0

  • max_consecutive_drops

    non_neg_integer() | :infinity

    Default value: 1000
    A number indicating how many consecutive silent packets can be dropped before a single packet will be passed and dropped packet event will we emitted.

    Passing a single packets once in a while is necessary for element such as jitter buffer or encryptor as they can update their ROCs based on sequence numbers and when we drop to many packets we may roll it over.

  • silence_threshold

    1..127

    Default value: 127
    Audio level threshold that will be compared against incoming packets. Packet will be dropped if its audio level is above or equal to the given threshold.

  • vad_id

    1..14

    Default value: 1
    ID of a VAD extension.

Pads

:input

Accepted formats:

_any
Direction::input
Availability::always
Flow control::auto

:output

Accepted formats:

_any
Direction::output
Availability::always
Flow control::auto

Summary

Types

t()

Struct containing options for Membrane.RTP.SilenceDiscarder

Functions

Returns description of options available for this module

Types

@type t() :: %Membrane.RTP.SilenceDiscarder{
  max_consecutive_drops: non_neg_integer() | :infinity,
  silence_threshold: 1..127,
  vad_id: 1..14
}

Struct containing options for Membrane.RTP.SilenceDiscarder

Functions

@spec options() :: keyword()

Returns description of options available for this module