Skip to content

Commit 8e8fd6b

Browse files
committed
Impelement comments from CR
1 parent a114faa commit 8e8fd6b

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

lib/membrane/child_entry.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defmodule Membrane.ChildEntry do
2121
module: module,
2222
options: struct | nil,
2323
component_type: :element | :bin,
24-
playback: Membrane.Playback.t(),
24+
# playback: Membrane.Playback.t(),
2525
pid: pid,
2626
clock: Membrane.Clock.t(),
2727
sync: Membrane.Sync.t(),
@@ -41,7 +41,7 @@ defmodule Membrane.ChildEntry do
4141
:group,
4242
initialized?: false,
4343
ready?: false,
44-
terminating?: false,
45-
playback: :stopped
44+
terminating?: false
45+
# playback: :stopped
4646
]
4747
end

lib/membrane/core/parent/child_life_controller.ex

+7-16
Original file line numberDiff line numberDiff line change
@@ -403,24 +403,15 @@ defmodule Membrane.Core.Parent.ChildLifeController do
403403
defp do_proceed_spec_startup(_spec_ref, %{status: :ready} = spec_data, state) do
404404
state =
405405
Enum.reduce(spec_data.children_names, state, fn child, state ->
406-
child_entry = get_in(state, [:children, child])
406+
%{pid: pid, terminating?: terminating?} = state.children[child]
407407

408-
child_entry =
409-
case child_entry do
410-
%{terminating?: true} ->
411-
Message.send(child_entry.pid, :terminate)
412-
child_entry
413-
414-
%{terminating?: false} when state.playback == :playing ->
415-
Message.send(child_entry.pid, :play)
416-
%{child_entry | playback: :playing}
417-
418-
%{terminating?: false} ->
419-
child_entry
420-
end
421-
|> Map.put(:ready?, true)
408+
cond do
409+
terminating? -> Message.send(pid, :terminate)
410+
state.playback == :playing -> Message.send(pid, :play)
411+
true -> :ok
412+
end
422413

423-
put_in(state, [:children, child], child_entry)
414+
put_in(state.children[child].ready?, true)
424415
end)
425416

426417
state =

lib/membrane/core/parent/lifecycle_controller.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ defmodule Membrane.Core.Parent.LifecycleController do
4545

4646
{pinged_children, state} =
4747
Enum.flat_map_reduce(state.children, state, fn
48-
{child, %{ready?: true, terminating?: false, playback: :stopped, pid: pid}}, state ->
48+
{child, %{ready?: true, terminating?: false, pid: pid}}, state ->
4949
Message.send(pid, :play)
5050
state = put_in(state, [:children, child, :playback], :playing)
5151
{[child], state}

0 commit comments

Comments
 (0)