Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into auto-push-full-impl
Browse files Browse the repository at this point in the history
  • Loading branch information
FelonEkonom committed May 22, 2023
2 parents f3ef798 + 6a1fb5a commit 74a94e6
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 35 deletions.
21 changes: 0 additions & 21 deletions lib/membrane/core/child/pad_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,4 @@ defmodule Membrane.Core.Child.PadController do
"Invalid keys in options of pad #{inspect(pad_name)} - #{inspect(keys)}"
end
end

@spec assert_all_static_pads_linked!(state) :: :ok
def assert_all_static_pads_linked!(state) do
linked_pads_names = state.pads_data |> Map.values() |> MapSet.new(& &1.name)

static_unlinked_pads =
state.pads_info
|> Map.values()
|> Enum.filter(
&(Pad.availability_mode(&1.availability) == :static and &1.name not in linked_pads_names)
)

unless Enum.empty?(static_unlinked_pads) do
raise LinkError, """
Some static pads remained unlinked: #{inspect(Enum.map(static_unlinked_pads, & &1.name))}
State: #{inspect(state, pretty: true)}
"""
end

:ok
end
end
5 changes: 1 addition & 4 deletions lib/membrane/core/element/lifecycle_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Membrane.Core.Element.LifecycleController do
use Bunch

alias Membrane.{Clock, Element, Sync}
alias Membrane.Core.{CallbackHandler, Child, Element, Message}
alias Membrane.Core.{CallbackHandler, Element, Message}

alias Membrane.Core.Element.{
ActionHandler,
Expand All @@ -17,7 +17,6 @@ defmodule Membrane.Core.Element.LifecycleController do
State
}

require Membrane.Core.Child.PadModel
require Membrane.Core.Message
require Membrane.Logger

Expand Down Expand Up @@ -73,8 +72,6 @@ defmodule Membrane.Core.Element.LifecycleController do

@spec handle_playing(State.t()) :: State.t()
def handle_playing(state) do
Child.PadController.assert_all_static_pads_linked!(state)

Membrane.Logger.debug("Got play request")

state =
Expand Down
4 changes: 0 additions & 4 deletions lib/membrane/core/parent/lifecycle_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ defmodule Membrane.Core.Parent.LifecycleController do
def handle_playing(state) do
Membrane.Logger.debug("Parent play")

if state.__struct__ == Membrane.Core.Bin.State do
Core.Child.PadController.assert_all_static_pads_linked!(state)
end

activate_syncs(state.children)

Enum.each(state.children, fn {_name, %{pid: pid, ready?: ready?}} ->
Expand Down
6 changes: 0 additions & 6 deletions test/membrane/core/element_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@ defmodule Membrane.Core.ElementTest do
state
end

test "should raise when static pads not linked when getting play request" do
assert_raise Membrane.LinkError, fn ->
assert {:noreply, _state} = Element.handle_info(Message.new(:play), get_state())
end
end

test "should return correct clock and should not modify the state" do
original_state = get_state()

Expand Down

0 comments on commit 74a94e6

Please sign in to comment.