Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
sender_encoder.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Roc Streaming authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_node/sender_encoder.h
10//! @brief Sender encoder node.
11
12#ifndef ROC_NODE_SENDER_ENCODER_H_
13#define ROC_NODE_SENDER_ENCODER_H_
14
18#include "roc_core/atomic.h"
19#include "roc_core/attributes.h"
20#include "roc_core/mutex.h"
21#include "roc_core/optional.h"
22#include "roc_node/context.h"
23#include "roc_node/node.h"
25#include "roc_packet/ireader.h"
28
29namespace roc {
30namespace node {
31
32//! Sender encoder node.
34public:
35 //! Initialize.
37
38 //! Deinitialize.
40
41 //! Check if successfully constructed.
42 bool is_valid() const;
43
44 //! Activate interface.
46
47 //! Get metrics.
49 pipeline::SenderSessionMetrics& sess_metrics);
50
51 //! Check if everything is connected.
53
54 //! Read encoded packet.
56 packet::PacketPtr& packet);
57
58 //! Sink for writing frames for encoding.
60
61private:
62 virtual void schedule_task_processing(pipeline::PipelineLoop&,
64 virtual void cancel_task_processing(pipeline::PipelineLoop&);
65
66 core::Mutex mutex_;
67
68 address::SocketAddr address_;
69
72
73 pipeline::SenderLoop pipeline_;
76
77 bool valid_;
78};
79
80} // namespace node
81} // namespace roc
82
83#endif // ROC_NODE_SENDER_ENCODER_H_
Atomic.
Compiler attributes.
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition attributes.h:31
Process pending pipeline tasks on control thread.
Node context.
Definition context.h:44
Base class for nodes.
Definition node.h:23
Context & context()
All nodes hold reference to context.
Sender encoder node.
bool activate(address::Interface iface, address::Protocol proto)
Activate interface.
sndio::ISink & sink()
Sink for writing frames for encoding.
bool is_valid() const
Check if successfully constructed.
bool get_metrics(pipeline::SenderSlotMetrics &slot_metrics, pipeline::SenderSessionMetrics &sess_metrics)
Get metrics.
bool is_complete()
Check if everything is connected.
SenderEncoder(Context &context, const pipeline::SenderConfig &pipeline_config)
Initialize.
~SenderEncoder()
Deinitialize.
ROC_ATTR_NODISCARD status::StatusCode read(address::Interface iface, packet::PacketPtr &packet)
Read encoded packet.
Pipeline task scheduler interface. PipelineLoop uses this interface to schedule asynchronous work....
Base class for task-based pipelines.
Sender pipeline loop.
Definition sender_loop.h:44
struct SlotHandle * SlotHandle
Opaque slot handle.
Definition sender_loop.h:47
Sink interface.
Definition isink.h:22
Concurrent blocking packet queue.
Node context.
Interface ID.
Pipeline task scheduler interface.
Packet reader interface.
Mutex.
Interface
Interface ID.
Definition interface.h:19
@ Iface_Max
Number of interfaces.
Definition interface.h:36
Protocol
Protocol ID.
Definition protocol.h:19
int64_t nanoseconds_t
Nanoseconds.
Definition time.h:58
Root namespace.
Base class for nodes.
Optionally constructed object.
Protocol ID.
Sender pipeline loop.
Socket address.
StatusCode
Status code.
Definition status_code.h:19
Sender parameters.
Definition config.h:102
Metrics of sender session (connection to receiver).
Definition metrics.h:22
Metrics of sender slot.
Definition metrics.h:28