Skip to content

Commit

Permalink
Rename ForwardingFilter to Connector (#908)
Browse files Browse the repository at this point in the history
* Rename ForwardingFilter to Connector

* Fix test, rename file
  • Loading branch information
FelonEkonom authored Nov 22, 2024
1 parent ca055af commit 8505648
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.2.0
* Add `:max_instances` option for dynamic pads. [#876](https://github.com/membraneframework/membrane_core/pull/876)
* Implement `Membrane.ForwardingFilter`. [#904](https://github.com/membraneframework/membrane_core/pull/904)
* Implement `Membrane.Connector`. [#904](https://github.com/membraneframework/membrane_core/pull/904)

## 1.1.2
* Add new callback `handle_child_terminated/3` along with new assertions. [#894](https://github.com/membraneframework/membrane_core/pull/894)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.ForwardingFilter do
defmodule Membrane.Connector do
@moduledoc """
Membrane Filter with input and output dynamic pads, that forwards incoming data to the opposite
side than the one from which it came.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defmodule Membrane.Integration.ForwardingFilterTest do
defmodule Membrane.Integration.ConnectorTest do
use ExUnit.Case, async: true

import Membrane.ChildrenSpec
import Membrane.Testing.Assertions

alias Membrane.Buffer
alias Membrane.ForwardingFilter
alias Membrane.Connector
alias Membrane.Testing

require Membrane.Pad, as: Pad
Expand All @@ -23,12 +23,12 @@ defmodule Membrane.Integration.ForwardingFilterTest do
do: {[{action, {:output, item}}], state}
end

test "Membrane.ForwardingFilter buffers data until output pad is linked" do
test "Membrane.Connector buffers data until output pad is linked" do
pipeline =
Testing.Pipeline.start_link_supervised!(
spec:
child(:source, Source)
|> child(:filter, %ForwardingFilter{
|> child(:connector, %Connector{
notify_on_event?: true,
notify_on_stream_format?: true
})
Expand All @@ -41,11 +41,11 @@ defmodule Membrane.Integration.ForwardingFilterTest do
Testing.Pipeline.notify_child(pipeline, :source, {type, item})

if type in [:stream_format, :event] do
assert_pipeline_notified(pipeline, :filter, {^type, Pad.ref(:input, _id), ^item})
assert_pipeline_notified(pipeline, :connector, {^type, Pad.ref(:input, _id), ^item})
end
end)

spec = get_child(:filter) |> child(:sink, Testing.Sink)
spec = get_child(:connector) |> child(:sink, Testing.Sink)
Testing.Pipeline.execute_actions(pipeline, spec: spec)

data
Expand All @@ -62,7 +62,7 @@ defmodule Membrane.Integration.ForwardingFilterTest do
Testing.Pipeline.notify_child(pipeline, :source, {type, item})

if type in [:stream_format, :event] do
assert_pipeline_notified(pipeline, :filter, {^type, Pad.ref(:input, _id), ^item})
assert_pipeline_notified(pipeline, :connector, {^type, Pad.ref(:input, _id), ^item})
end

case type do
Expand All @@ -75,7 +75,7 @@ defmodule Membrane.Integration.ForwardingFilterTest do
Testing.Pipeline.terminate(pipeline)
end

test "Membrane.ForwardingFilter pauses input demand if output pad is not linked" do
test "Membrane.Connector pauses input demand if output pad is not linked" do
atomics_ref = :atomics.new(1, [])
:atomics.put(atomics_ref, 1, 0)

Expand All @@ -90,15 +90,15 @@ defmodule Membrane.Integration.ForwardingFilterTest do
spec =
child(:source, %Testing.Source{output: {nil, generator}})
|> via_in(:input, auto_demand_size: auto_demand_size)
|> child(:forwarding_filter, ForwardingFilter)
|> child(:connector, Connector)

pipeline = Testing.Pipeline.start_link_supervised!(spec: spec)

Process.sleep(500)

assert :atomics.get(atomics_ref, 1) == auto_demand_size

spec = get_child(:forwarding_filter) |> child(:sink, Testing.Sink)
spec = get_child(:connector) |> child(:sink, Testing.Sink)
Testing.Pipeline.execute_actions(pipeline, spec: spec)

Process.sleep(500)
Expand Down

0 comments on commit 8505648

Please sign in to comment.