Membrane.Testing.Sink (Membrane Core v0.8.1) View Source

Sink Element that notifies the pipeline about buffers and events it receives.

By default Sink will demand buffers automatically, but you can override that behaviour by using autodemand option. If set to false no automatic demands shall be made. Demands can be then triggered by sending {:make_demand, size} message.

This element can be used in conjunction with Membrane.Testing.Pipeline to enable asserting on buffers and events it receives.

alias Membrane.Testing
{:ok, pid} = Testing.Pipeline.start_link(Testing.Pipeline.Options{
  elements: [
    ...,
    sink: %Testing.Sink{}
  ]
})

Asserting that Membrane.Testing.Sink element processed a buffer that matches a specific pattern can be achieved using Membrane.Testing.Assertions.assert_sink_buffer/3.

assert_sink_buffer(pid, :sink ,%Membrane.Buffer{payload: 255})

Element options

Passed via struct Membrane.Testing.Sink.t/0

  • autodemand

    boolean

    Default value: true
    If true element will automatically make demands. If it is set to false demand has to be triggered manually by sending :make_demand message.

Pads

:input

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

Link to this section Summary

Types

t()

Struct containing options for Membrane.Testing.Sink

Functions

Returns pads descriptions for Membrane.Testing.Sink

Returns description of options available for this module

Link to this section Types

Specs

t() :: %Membrane.Testing.Sink{autodemand: boolean()}

Struct containing options for Membrane.Testing.Sink

Link to this section Functions

Specs

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

Returns pads descriptions for Membrane.Testing.Sink

Specs

options() :: keyword()

Returns description of options available for this module