class Node
Defined at line 120 of file ../../src/media/audio/services/mixer/fidl/node.h
This file exists to break circular dependencies.
Since shared_ptr use is ubiquitous, we use XPtr as a more concise name for std::shared_ptr
<X
>.
Public Methods
fpromise::result<void, fuchsia_audio_mixer::CreateEdgeError> CreateEdge (const GraphContext &ctx,NodePtrsource,NodePtrdest,CreateEdgeOptionsoptions)
Defined at line 82 of file ../../src/media/audio/services/mixer/fidl/node.cc
Type type ()
Returns the type of this node.
Defined at line 162 of file ../../src/media/audio/services/mixer/fidl/node.h
std::string_view name ()
Returns the node's name. This is used for diagnostics only.
The name may not be a unique identifier.
Defined at line 166 of file ../../src/media/audio/services/mixer/fidl/node.h
std::shared_ptr<Clock> reference_clock ()
Returns the reference clock used by this node. For ordinary nodes, this corresponds
to the same clock used by the underlying `pipeline_stage()`.
Defined at line 170 of file ../../src/media/audio/services/mixer/fidl/node.h
PipelineDirection pipeline_direction ()
Reports the kind of pipeline this node participates in.
Defined at line 173 of file ../../src/media/audio/services/mixer/fidl/node.h
fpromise::result<void, fuchsia_audio_mixer::DeleteEdgeError> DeleteEdge (const GraphContext &ctx,NodePtrsource,NodePtrdest)
Deletes the edge from `source` -> `dest`. This is the inverse of `CreateEdge`.
Returns an error if the edge does not exist.
Defined at line 259 of file ../../src/media/audio/services/mixer/fidl/node.cc
void PrepareToDelete (const GraphContext & ctx, NodePtr node)
Calls `DeleteEdge` for each incoming and outgoing edge, then deletes all child nodes. After
this is called, all references to this `node` can be dropped.
Defined at line 385 of file ../../src/media/audio/services/mixer/fidl/node.cc
const std::vector<NodePtr> & sources ()
Returns this ordinary node's source edges.
REQUIRED: type() != Type::kMeta
Defined at line 466 of file ../../src/media/audio/services/mixer/fidl/node.cc
NodePtr dest ()
Returns this ordinary node's destination edge, or nullptr if none.
REQUIRED: type() != Type::kMeta
Defined at line 471 of file ../../src/media/audio/services/mixer/fidl/node.cc
const std::vector<NodePtr> & child_sources ()
Returns this meta node's child source nodes.
REQUIRED: type() == Type::kMeta
Defined at line 476 of file ../../src/media/audio/services/mixer/fidl/node.cc
const std::vector<NodePtr> & child_dests ()
Returns this meta node's child destination nodes.
REQUIRED: type() == Type::kMeta
Defined at line 481 of file ../../src/media/audio/services/mixer/fidl/node.cc
NodePtr parent ()
Returns the parent of this node, or nullptr if this is not a child of a meta node.
REQUIRED: type() != Type::kMeta
Defined at line 486 of file ../../src/media/audio/services/mixer/fidl/node.cc
PipelineStagePtr pipeline_stage ()
Returns the PipelineStage owned by this node.
REQUIRED: type() != Type::kMeta
Defined at line 491 of file ../../src/media/audio/services/mixer/fidl/node.cc
std::shared_ptr<GraphThread> thread ()
Returns the thread which controls this node's PipelineStage. This is eventually-consistent with
value returned by `pipeline_stage()->thread()`.
REQUIRED: type() != Type::kMeta
Defined at line 496 of file ../../src/media/audio/services/mixer/fidl/node.cc
void set_thread (std::shared_ptr<GraphThread> t)
Set the Thread which controls our PipelineStage. Caller is responsible for asynchronously
updating `PipelineStage::thread()` as described in ../docs/execution_model.md.
REQUIRED: type() != Type::kMeta
Defined at line 501 of file ../../src/media/audio/services/mixer/fidl/node.cc
zx::duration max_downstream_output_pipeline_delay ()
Reports the maximum presentation delay of all output pipelines downstream of this node. This is
the maximum delay over all longest paths `this -> ... -> X`, where all nodes from `this` to `X`
have `pipeline_direction() == kOutput` and the path hops over meta nodes using implicit edges
from each child_source to each child_dest.
If `this` is a leaf consumer node at the bottom of the graph, we return the "external" delay
between this consumer and the physical speaker at the end of the output pipeline.
See ../docs/delay.md.
REQUIRED: type() != Type::kMeta
&
&
pipeline_direction() == PipelineDirection::kOutput
Defined at line 514 of file ../../src/media/audio/services/mixer/fidl/node.cc
zx::duration max_downstream_input_pipeline_delay ()
Reports the maximum presentation delay of all input pipelines downstream of this node. This can
be called in two cases:
* When this node has `pipeline_direction() == kInput`, in which case this returns the
downstream delay of that input pipeline. This is the maximum delay over all longest paths
`this -> ... -> X`, where all nodes have `pipeline_direction() == kInput`.
* When this node has `pipeline_direction() == kOutput`, in which case this returns the
largest delay of any downstream input pipeline, which must start after a loopback interface.
More formally, this is the maximum delay over all longest paths `L -> ... -> X`, where there
exists a path `this -> ... -> L` such that:
* all nodes before `L` have `pipeline_direction() == kOutput`, and
* all nodes from `L` onwards have `pipeline_direction() == kInput`
These paths hop over meta nodes using implicit edges from each child_source to each child_dest.
See ../docs/delay.md.
REQUIRED: type() != Type::kMeta
Defined at line 520 of file ../../src/media/audio/services/mixer/fidl/node.cc
zx::duration max_upstream_input_pipeline_delay ()
Reports the maximum presentation delay of all input pipelines upstream of this node. This is
the maximum delay over all paths `X -> ... -> this`, where all nodes from `X` to `this` have
`pipeline_direction() == kInput` and the path hops over meta nodes using implicit edges from
each child_source to each child_dest.
If `this` is a leaf producer node at the top of the graph, we return the "external" delay
between the physical microphone (at the start of the input pipeline) and this producer node.
See ../docs/delay.md.
REQUIRED: type() != Type::kMeta
&
&
pipeline_direction() == PipelineDirection::kInput
Defined at line 525 of file ../../src/media/audio/services/mixer/fidl/node.cc
std::optional<std::pair<ThreadId, fit::closure>> SetMaxDelays (Delays delays)
Defined at line 531 of file ../../src/media/audio/services/mixer/fidl/node.cc
zx::duration PresentationDelayForSourceEdge (const Node * source)
Returns total presentation delay of a source edge.
If `source != nullptr`, we return the delay of the edge `source -> this`. This typically
consists of processing delays and buffering delays, as disussed in ../docs/delay.md.
If `source == nullptr`, then this node must be a child_dest of a parent meta node. At meta
nodes, data typically flows into the child_source nodes, then into an intermediate buffer, then
into the child_dest nodes. In this case, PresentationDelayForSourceEdge returns the delay
introduced by the child_dest node processing and reading data from the intermediate buffer.
REQUIRED: type() != Type::kMeta
REQUIRED: (source == nullptr and source in parent->child_dests()) or source in sources()
Protected Methods
void ~Node ()
Defined at line 295 of file ../../src/media/audio/services/mixer/fidl/node.h
void Node (const Node & )
Defined at line 297 of file ../../src/media/audio/services/mixer/fidl/node.h
Node & operator= (const Node & )
Defined at line 298 of file ../../src/media/audio/services/mixer/fidl/node.h
void Node (Node && )
Defined at line 300 of file ../../src/media/audio/services/mixer/fidl/node.h
Node & operator= (Node && )
Defined at line 301 of file ../../src/media/audio/services/mixer/fidl/node.h
void PrepareToDeleteChildSource (NodePtr child_source)
Called just after a source edge is removed from a meta node. This allows subclasses to delete
any bookkeeping for that edge. This does not need to be reimplemented by all subclasses. The
default implementation is a no-op.
REQUIRED: type() == Type::kMeta
Defined at line 326 of file ../../src/media/audio/services/mixer/fidl/node.h
void PrepareToDeleteChildDest (NodePtr child_dest)
Called just after a destination edge is removed from a meta node. This allows subclasses to
delete any bookkeeping for that edge. This does not need to be reimplemented by all subclasses.
The default implementation is a no-op.
REQUIRED: type() == Type::kMeta
Defined at line 333 of file ../../src/media/audio/services/mixer/fidl/node.h
void PrepareToDeleteSelf ()
Called by `PrepareToDelete` just after incoming links, outgoing links, and child nodes have
been removed. This allows subclasses to delete any references to this node which would prevent
this node from being deleted. The default implementation is a no-op.
This is called for both meta and ordinary nodes.
Defined at line 340 of file ../../src/media/audio/services/mixer/fidl/node.h
void Node (Typetype,std::string_viewname,std::shared_ptr<Clock>reference_clock,PipelineDirectionpipeline_direction,PipelineStagePtrpipeline_stage,NodePtrparent)
Defined at line 59 of file ../../src/media/audio/services/mixer/fidl/node.cc
NodePtr CreateNewChildSource ()
Creates an ordinary child node to accept the next source edge. Returns nullptr if no more child
source nodes can be created. If this mutates any internal state, that state must be reverted
back accordingly by a corresponding `PrepareToDeleteChildSource` call.
REQUIRED: type() == Type::kMeta
NodePtr CreateNewChildDest ()
Creates an ordinary child node to accept the next destination edge. Returns nullptr if no more
child destination nodes can be created. If this mutates any internal state, that state must be
reverted back accordingly by a corresponding `PrepareToDeleteChildDest` call.
REQUIRED: type() == Type::kMeta
bool CanAcceptSourceFormat (const Format & format)
Reports whether this node can accept a source edge with the given format. If MaxSources() is 0,
this should return false.
REQUIRED: type() != Type::kMeta
std::optional<size_t> MaxSources ()
Reports the maximum number of source edges allowed, or `std::nullopt` for no limit.
REQUIRED: type() != Type::kMeta
bool AllowsDest ()
Reports whether this node can accept a destination edge, i.e. whether it can be a source for
any other node.
REQUIRED: type() != Type::kMeta
void SetBuiltInChildren (std::vector<NodePtr> child_sources, std::vector<NodePtr> child_dests)
Sets built-in child nodes for this meta node. If a meta node has built-in children, this must
be called immediately after the meta node is created. See "META NODE CHILDREN" in the class
comments.
REQUIRED: type() == Type::kMeta
Defined at line 551 of file ../../src/media/audio/services/mixer/fidl/node.cc
Enumerations
enum class Type
| Name | Value | Comments |
|---|---|---|
| kConsumer | 0 | -- |
| kProducer | 1 | -- |
| kMixer | 2 | -- |
| kCustom | 3 | -- |
| kMeta | 4 | -- |
| kFake | 5 |
for test use only |
Node type. Except for `kMeta`, all types refer to ordinary nodes.
Defined at line 152 of file ../../src/media/audio/services/mixer/fidl/node.h
Records
Friends
class FakeGraph