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

Element responsible for dropping silent audio packets.

For a packet to be discarded it needs to contain a RTP.HeaderExtension struct in its metadata under :rtp key. The header should 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: 6
    ID of a VAD extension.

Pads

:input

Availability:always
Caps:any
Demand unit:buffers
Direction:input
Mode:pull
Name:input

:output

Availability:always
Caps:any
Direction:output
Mode:pull
Name:output

Link to this section Summary

Types

t()

Struct containing options for Membrane.RTP.SilenceDiscarder

Functions

Returns pads descriptions for Membrane.RTP.SilenceDiscarder

Returns description of options available for this module

Link to this section Types

Specs

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

Link to this section Functions

Specs

membrane_pads() :: [{Membrane.Pad.name_t(), Membrane.Pad.description_t()}]

Returns pads descriptions for Membrane.RTP.SilenceDiscarder

Specs

options() :: keyword()

Returns description of options available for this module