From 9018e3c66463f27ffd8866c617b13ba832f288f5 Mon Sep 17 00:00:00 2001 From: "feliks.pobiedzinski@swmansion.com" Date: Wed, 31 Jan 2024 19:06:06 +0100 Subject: [PATCH] Small refactor in structs fields names --- lib/membrane/core/element.ex | 2 +- .../core/element/demand_controller/auto_flow_utils.ex | 10 +++++----- lib/membrane/core/element/state.ex | 4 ++-- test/membrane/core/element/action_handler_test.exs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/membrane/core/element.ex b/lib/membrane/core/element.ex index 01b085358..7684fa0e9 100644 --- a/lib/membrane/core/element.ex +++ b/lib/membrane/core/element.ex @@ -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(), diff --git a/lib/membrane/core/element/demand_controller/auto_flow_utils.ex b/lib/membrane/core/element/demand_controller/auto_flow_utils.ex index 786ce942a..9b59c7c48 100644 --- a/lib/membrane/core/element/demand_controller/auto_flow_utils.ex +++ b/lib/membrane/core/element/demand_controller/auto_flow_utils.ex @@ -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. @@ -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 @@ -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 diff --git a/lib/membrane/core/element/state.ex b/lib/membrane/core/element/state.ex index 8b972c70e..4febe6293 100644 --- a/lib/membrane/core/element/state.ex +++ b/lib/membrane/core/element/state.ex @@ -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(), @@ -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, diff --git a/test/membrane/core/element/action_handler_test.exs b/test/membrane/core/element/action_handler_test.exs index d33c66aec..5a82d92cd 100644 --- a/test/membrane/core/element/action_handler_test.exs +++ b/test/membrane/core/element/action_handler_test.exs @@ -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] @@ -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]