Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
sender_slot.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 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_pipeline/sender_slot.h
10
//! @brief Sender slot.
11
12
#ifndef ROC_PIPELINE_SENDER_SLOT_H_
13
#define ROC_PIPELINE_SENDER_SLOT_H_
14
15
#include "
roc_address/interface.h
"
16
#include "
roc_address/protocol.h
"
17
#include "
roc_audio/fanout.h
"
18
#include "
roc_audio/frame_factory.h
"
19
#include "
roc_core/iarena.h
"
20
#include "
roc_core/noncopyable.h
"
21
#include "
roc_core/optional.h
"
22
#include "
roc_core/ref_counted.h
"
23
#include "
roc_packet/packet_factory.h
"
24
#include "
roc_pipeline/config.h
"
25
#include "
roc_pipeline/metrics.h
"
26
#include "
roc_pipeline/sender_endpoint.h
"
27
#include "
roc_pipeline/sender_session.h
"
28
#include "
roc_pipeline/state_tracker.h
"
29
30
namespace
roc
{
31
namespace
pipeline
{
32
33
//! Sender slot.
34
//!
35
//! Contains:
36
//! - one or more related sender endpoints, one per each type
37
//! - one session associated with those endpoints
38
class
SenderSlot
:
public
core::RefCounted
<SenderSlot, core::ArenaAllocation>,
39
public
core::ListNode
<> {
40
public
:
41
//! Initialize.
42
SenderSlot
(
const
SenderSinkConfig
& sink_config,
43
const
SenderSlotConfig
& slot_config,
44
StateTracker
& state_tracker,
45
const
rtp::EncodingMap
& encoding_map,
46
audio::Fanout
& fanout,
47
packet::PacketFactory
& packet_factory,
48
audio::FrameFactory
& frame_factory,
49
core::IArena
&
arena
);
50
51
~SenderSlot
();
52
53
//! Check if the slot was successfully constructed.
54
bool
is_valid
()
const
;
55
56
//! Add endpoint.
57
SenderEndpoint
*
add_endpoint
(
address::Interface
iface,
58
address::Protocol
proto,
59
const
address::SocketAddr
& outbound_address,
60
packet::IWriter
& outbound_writer);
61
62
//! Refresh pipeline according to current time.
63
//! @returns
64
//! deadline (absolute time) when refresh should be invoked again
65
//! if there are no frames
66
core::nanoseconds_t
refresh
(
core::nanoseconds_t
current_time);
67
68
//! Get metrics for slot and its participants.
69
void
get_metrics
(
SenderSlotMetrics
& slot_metrics,
70
SenderParticipantMetrics
* party_metrics,
71
size_t
* party_count)
const
;
72
73
private
:
74
SenderEndpoint
* create_source_endpoint_(
address::Protocol
proto,
75
const
address::SocketAddr
& outbound_address,
76
packet::IWriter
& outbound_writer);
77
SenderEndpoint
* create_repair_endpoint_(
address::Protocol
proto,
78
const
address::SocketAddr
& outbound_address,
79
packet::IWriter
& outbound_writer);
80
SenderEndpoint
* create_control_endpoint_(
address::Protocol
proto,
81
const
address::SocketAddr
& outbound_address,
82
packet::IWriter
& outbound_writer);
83
84
const
SenderSinkConfig
sink_config_;
85
86
audio::Fanout
& fanout_;
87
88
core::Optional<SenderEndpoint>
source_endpoint_;
89
core::Optional<SenderEndpoint>
repair_endpoint_;
90
core::Optional<SenderEndpoint>
control_endpoint_;
91
92
StateTracker
& state_tracker_;
93
SenderSession
session_;
94
95
bool
valid_;
96
};
97
98
}
// namespace pipeline
99
}
// namespace roc
100
101
#endif
// ROC_PIPELINE_SENDER_SLOT_H_
roc::address::SocketAddr
Socket address.
Definition
socket_addr.h:26
roc::audio::Fanout
Fanout. Duplicates audio stream to multiple output writers.
Definition
fanout.h:26
roc::audio::FrameFactory
Frame factory.
Definition
frame_factory.h:38
roc::core::ArenaAllocation::arena
IArena & arena() const
Get arena.
Definition
allocation_policy.h:37
roc::core::IArena
Memory arena interface.
Definition
iarena.h:23
roc::core::ListNode
Base class for List element.
Definition
list_node.h:48
roc::core::Optional
Optionally constructed object.
Definition
optional.h:25
roc::core::RefCounted
Base class for object with reference counter.
Definition
ref_counted.h:40
roc::packet::IWriter
Packet writer interface.
Definition
iwriter.h:23
roc::packet::PacketFactory
Packet factory.
Definition
packet_factory.h:36
roc::pipeline::SenderEndpoint
Sender endpoint sub-pipeline.
Definition
sender_endpoint.h:40
roc::pipeline::SenderSession
Sender session sub-pipeline.
Definition
sender_session.h:52
roc::pipeline::SenderSlot::add_endpoint
SenderEndpoint * add_endpoint(address::Interface iface, address::Protocol proto, const address::SocketAddr &outbound_address, packet::IWriter &outbound_writer)
Add endpoint.
roc::pipeline::SenderSlot::is_valid
bool is_valid() const
Check if the slot was successfully constructed.
roc::pipeline::SenderSlot::SenderSlot
SenderSlot(const SenderSinkConfig &sink_config, const SenderSlotConfig &slot_config, StateTracker &state_tracker, const rtp::EncodingMap &encoding_map, audio::Fanout &fanout, packet::PacketFactory &packet_factory, audio::FrameFactory &frame_factory, core::IArena &arena)
Initialize.
roc::pipeline::SenderSlot::get_metrics
void get_metrics(SenderSlotMetrics &slot_metrics, SenderParticipantMetrics *party_metrics, size_t *party_count) const
Get metrics for slot and its participants.
roc::pipeline::SenderSlot::refresh
core::nanoseconds_t refresh(core::nanoseconds_t current_time)
Refresh pipeline according to current time.
roc::pipeline::StateTracker
Pipeline state tracker.
Definition
state_tracker.h:30
roc::rtp::EncodingMap
RTP encoding map. Thread-safe. Returned encodings are immutable and can be safely used from any threa...
Definition
encoding_map.h:33
fanout.h
Fanout.
frame_factory.h
Frame factory.
iarena.h
Memory arena interface.
interface.h
Interface ID.
metrics.h
Pipeline metrics.
roc::address::Interface
Interface
Interface ID.
Definition
interface.h:19
roc::address::Protocol
Protocol
Protocol ID.
Definition
protocol.h:19
roc::core::nanoseconds_t
int64_t nanoseconds_t
Nanoseconds.
Definition
time.h:58
roc::pipeline
Sender and receiver processing pipelines.
roc
Root namespace.
noncopyable.h
Non-copyable object.
optional.h
Optionally constructed object.
packet_factory.h
Packet factory.
protocol.h
Protocol ID.
ref_counted.h
Base class for object with reference counter.
config.h
Pipeline config.
sender_endpoint.h
Sender endpoint pipeline.
sender_session.h
Sender session.
state_tracker.h
Pipeline state tracker.
roc::pipeline::SenderParticipantMetrics
Sender-side metrics specific to one participant (remote receiver).
Definition
metrics.h:24
roc::pipeline::SenderSinkConfig
Parameters of sender sink and sender session.
Definition
config.h:58
roc::pipeline::SenderSlotConfig
Parameters of sender slot.
Definition
config.h:115
roc::pipeline::SenderSlotMetrics
Sender-side metrics of the whole slot.
Definition
metrics.h:36
roc_pipeline
sender_slot.h
Generated by
1.17.0