Skip to content

Commit

Permalink
update to core 1.0 API
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-hek committed Nov 8, 2023
1 parent e37ae33 commit a38f5c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/membrane_funnel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ defmodule Membrane.Funnel do

alias Membrane.Funnel

def_input_pad :input, demand_mode: :auto, accepted_format: _any, availability: :on_request
def_output_pad :output, accepted_format: _any, demand_mode: :auto
def_input_pad :input, accepted_format: _any, flow_control: :auto, availability: :on_request
def_output_pad :output, accepted_format: _any, flow_control: :auto

def_options end_of_stream: [spec: :on_last_pad | :never, default: :on_last_pad]

Expand All @@ -19,7 +19,7 @@ defmodule Membrane.Funnel do
end

@impl true
def handle_process(Pad.ref(:input, _id), buffer, _ctx, state) do
def handle_buffer(Pad.ref(:input, _id), buffer, _ctx, state) do
{[buffer: {:output, buffer}], state}
end

Expand Down
6 changes: 2 additions & 4 deletions test/membrane_funnel_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ defmodule Membrane.FunnelTest do

{:ok, _supervisor_pid, pipeline} =
Testing.Pipeline.start_link(
structure: [
spec: [
child(:funnel, Funnel),
child(:src1, %Testing.Source{output: data}) |> get_child(:funnel),
child(:src2, %Testing.Source{output: data}) |> get_child(:funnel),
get_child(:funnel) |> child(:sink, Testing.Sink)
]
)

assert_pipeline_play(pipeline)

data
|> Enum.flat_map(&[&1, &1])
|> Enum.each(fn payload ->
Expand All @@ -30,6 +28,6 @@ defmodule Membrane.FunnelTest do
assert_end_of_stream(pipeline, :sink)
refute_sink_buffer(pipeline, :sink, _buffer, 0)

Membrane.Pipeline.terminate(pipeline, blocking?: true)
Membrane.Pipeline.terminate(pipeline)
end
end

0 comments on commit a38f5c8

Please sign in to comment.