Skip to content

Commit

Permalink
Small refactor in structs fields names
Browse files Browse the repository at this point in the history
  • Loading branch information
FelonEkonom committed Jan 31, 2024
1 parent 379871c commit 9018e3c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/membrane/core/element.ex
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ defmodule Membrane.Core.Element do
setup_incomplete?: false,
effective_flow_control: :push,
handling_action?: false,
popping_queue?: false,
popping_auto_flow_queue?: false,
pads_to_snapshot: MapSet.new(),
stalker: options.stalker,
satisfied_auto_output_pads: MapSet.new(),
Expand Down
10 changes: 5 additions & 5 deletions lib/membrane/core/element/demand_controller/auto_flow_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defmodule Membrane.Core.Element.DemandController.AutoFlowUtils do
# - satisfied_auto_output_pads - MapSet of auto output pads, whose demand is less than or equal to 0.
# We consider only pads with the end_of_stream? flag set to false
# - awaiting_auto_input_pads - MapSet of auto input pads, which have a non-empty auto_flow_queue
# - popping_queue? - a flag determining whether we are on the stack somewhere above popping a queue.
# - popping_auto_flow_queue? - a flag determining whether we are on the stack somewhere above popping a queue.
# It's used to avoid situations where the function that pops from the queue calls itself multiple times,
# what could potentially lead to things like altering the order of sent buffers.

Expand All @@ -38,7 +38,7 @@ defmodule Membrane.Core.Element.DemandController.AutoFlowUtils do

# The introduced mechanism consists of two parts, the pseudocode for which is included below

# def onBufferArrivedInMessage() do
# def onBufferArrived() do
# if element uncorked do
# exec handle_buffer
# else
Expand Down Expand Up @@ -199,14 +199,14 @@ defmodule Membrane.Core.Element.DemandController.AutoFlowUtils do
end

@spec pop_queues_and_bump_demand(State.t()) :: State.t()
def pop_queues_and_bump_demand(%State{popping_queue?: true} = state), do: state
def pop_queues_and_bump_demand(%State{popping_auto_flow_queue?: true} = state), do: state

def pop_queues_and_bump_demand(%State{} = state) do
%{state | popping_queue?: true}
%{state | popping_auto_flow_queue?: true}
|> bump_demand()
|> pop_auto_flow_queues_while_needed()
|> bump_demand()
|> Map.put(:popping_queue?, false)
|> Map.put(:popping_auto_flow_queue?, false)
end

defp bump_demand(state) do
Expand Down
4 changes: 2 additions & 2 deletions lib/membrane/core/element/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule Membrane.Core.Element.State do
setup_incomplete?: boolean(),
effective_flow_control: EffectiveFlowController.effective_flow_control(),
handling_action?: boolean(),
popping_queue?: boolean(),
popping_auto_flow_queue?: boolean(),
pads_to_snapshot: MapSet.t(),
stalker: Membrane.Core.Stalker.t(),
satisfied_auto_output_pads: MapSet.t(),
Expand Down Expand Up @@ -75,7 +75,7 @@ defmodule Membrane.Core.Element.State do
:setup_incomplete?,
:supplying_demand?,
:handling_action?,
:popping_queue?,
:popping_auto_flow_queue?,
:stalker,
:resource_guard,
:subprocess_supervisor,
Expand Down
4 changes: 2 additions & 2 deletions test/membrane/core/element/action_handler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defmodule Membrane.Core.Element.ActionHandlerTest do
},
satisfied_auto_output_pads: MapSet.new(),
awaiting_auto_input_pads: MapSet.new(),
popping_queue?: false
popping_auto_flow_queue?: false
)

[state: state]
Expand Down Expand Up @@ -146,7 +146,7 @@ defmodule Membrane.Core.Element.ActionHandlerTest do
},
satisfied_auto_output_pads: MapSet.new(),
awaiting_auto_input_pads: MapSet.new(),
popping_queue?: false
popping_auto_flow_queue?: false
)

[state: state]
Expand Down

0 comments on commit 9018e3c

Please sign in to comment.