Skip to content

Commit cc9039d

Browse files
committed
Fix typos in the algorithm description
1 parent 07fcfd1 commit cc9039d

File tree

1 file changed

+43
-45
lines changed

1 file changed

+43
-45
lines changed

lib/membrane/core/element/diamond_detection_controller.ex

+43-45
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,71 @@ defmodule Membrane.Core.Element.DiamondDetectionController do
55

66
# Definitions:
77

8-
# diamond - directed graph, that has at least two distinct elements (sink and source) and
8+
# diamond - directed graph that has at least two distinct elements (sink and source) and
99
# has two vertex-disjoint paths from the source to the sink.
1010

11-
# This algotithm takes the directed graph made by all Elements within single Pipeline and
12-
# finds some diamond-subgraphs having all the edges (links) working in the :pull mode,
13-
# it means in :manual flow control or in :auto flow controll if the effective flow control
11+
# This algorithm takes the directed graph made by all elements within a single pipeline and
12+
# finds some diamond-subgraphs where all the edges (links) work in the :pull mode,
13+
# it means in :manual flow control or in :auto flow control if the effective flow control
1414
# is set to :pull.
1515

1616
# These diamonds can be dangerous when used with pull flow control, e.g. let's consider
17-
# a pipeline, that contains:
18-
# * MP4 demuxer that has two output pads
19-
# * MKV muxer that is linked to both of them
20-
# and let's assume, that MP4 container that is consumed by MP4 demuxer is unbalanced.
21-
# If MKV muxer has pads working in pull mode, then demand on one pad will be satisified,
22-
# but on the another won't, because the MP4 container is unbalanced. Then, if MP4 demuxer
17+
# a pipeline that contains:
18+
# * MP4 demuxer that has two output pads
19+
# * MKV muxer that is linked to both of them
20+
# and let's assume that the MP4 container that is consumed by the MP4 demuxer is unbalanced.
21+
# If the MKV muxer has pads working in pull mode, then demand on one pad will be satisfied,
22+
# but on the other won't, because the MP4 container is unbalanced. Then, if MP4 demuxer
2323
# has pads in auto flow control and its effective flow control is set to :pull, it won't
2424
# demand on the input, because one of the pads output with :auto flow control doesn't
2525
# have positive demand, so the whole pipeline will get stuck and won't process more data.
2626

27-
# The algorithms is made of two phases: (1) triggering and (2) proper searching.
27+
# The algorithm is made of two phases: (1) triggering and (2) proper searching.
2828

2929
# (1) Triggering
3030

31-
# Let's notice, that:
32-
# * new diamond can be created only after linking new spec
33-
# * if the new spec caused some new diamond to occur, this diamond will contain some of
34-
# the links spawned in this spec
31+
# Let's notice that:
32+
# * a new diamond can be created only after linking a new spec
33+
# * if the new spec caused some new diamond to occur, this diamond will contain some of
34+
# the links spawned in this spec
35+
# If the diamond contains a link, it must also contain an element whose output pad
36+
# is part of this link.
3537

36-
# If the diamond contains a link, it must also contain an element which output pad takes
37-
# is the part of this link.
38-
39-
# After spec status is set to :done, parent component that returned the spec will trigger
40-
# all elements, which output pads has been linked in this spec. Reference of the trigger
38+
# After the spec status is set to :done, the parent component that returned the spec will trigger
39+
# all elements whose output pads have been linked in this spec. The reference of the trigger
4140
# is always set to the spec reference.
4241

4342
# If the element is triggered with a specific reference for the first time, it does two
4443
# things:
45-
# * the element forwards the trigger with the same reference via all input pads working
46-
# in the pull mode
47-
# * if the element has at least two output pads working in the pull mode, it postpones
48-
# a proper searching that will be spawned from itself. Time between postponing and the
49-
# proper searching is one second. If in this time an element will be triggered once
50-
# again with a different reference, it won't cause another postponing a proper
51-
# searching, this means that at the time there is at most one proper searching
52-
# postponed in the single element
44+
# * the element forwards the trigger with the same reference via all input pads working
45+
# in the pull mode
46+
# * if the element has at least two output pads working in the pull mode, it postpones
47+
# the proper searching that will be spawned from itself. The time between postponing and the
48+
# proper searching is one second. If during this time an element is triggered once
49+
# again with a different reference, it won't cause another postponement of the proper
50+
# searching, this means that at the time there is at most one proper searching
51+
# postponed in the single element
5352

5453
# (2) Proper searching:
5554

56-
# Proper searching is started only in the elements that have at lest two output pads
57-
# working in the pull mode. When an elements starts proper searching, it assings
55+
# Proper searching is started only in elements that have at least two output pads
56+
# working in the pull mode. When an element starts proper searching, it assigns
5857
# a new reference to it, different from the reference of the related trigger.
5958

60-
# When a proper searching enters the element (no matter if it is the element that has
61-
# hust started the proper searching, or maybe it was forwarded to it via link):
62-
# * if the element sees the proper searching reference for the first time, then:
63-
# - it forwards proper searching via all output pads working in the pull mode
64-
# - when the proper searching is forwarded, it remembers the path in grapth through
65-
# the elments that is has already passed
66-
# * if the element has already seen the reference of proper searching, but there is
67-
# a repeated element on the path, that proper searching traversed to this element,
68-
# the element does nothing
69-
# * if the element has already seen the reference of proper searching and the traversed
70-
# path doesn't contain any repeated elements, it means that the current traversed path
71-
# and the path that the proper searching traversed when it entered the element
72-
# previous time together make a diamond. Then, the element logs the found diamond
73-
# and doesn't forward proper searching fruther
59+
# When proper searching enters the element (no matter if it is the element that has
60+
# just started the proper searching, or maybe it was forwarded to it via a link):
61+
# * if the element sees the proper searching reference for the first time, then:
62+
# - it forwards proper searching via all output pads working in the pull mode
63+
# - when proper searching is forwarded, it remembers the path in the graph through
64+
# the elements that it has already passed
65+
# * if the element has already seen the reference of proper searching, but there is
66+
# a repeated element on the path that proper searching traversed to this element,
67+
# the element does nothing
68+
# * if the element has already seen the reference of proper searching and the traversed
69+
# path doesn't contain any repeated elements, it means that the current traversed path
70+
# and the path that the proper searching traversed when it entered the element
71+
# the previous time together make a diamond. Then, the element logs the found diamond
72+
# and doesn't forward proper searching further.
7473

7574
alias __MODULE__.{DiamondLogger, PathInGraph}
7675
alias __MODULE__.PathInGraph.Vertex
@@ -96,7 +95,6 @@ defmodule Membrane.Core.Element.DiamondDetectionController do
9695
optional(:pad_ref) => Pad.ref()
9796
}
9897

99-
10098
@spec handle_diamond_detection_message(diamond_detection_message(), State.t()) :: State.t()
10199
def handle_diamond_detection_message(%{type: type} = message, state) do
102100
case type do

0 commit comments

Comments
 (0)