Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
receiver_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/receiver_slot.h
10
//! @brief Receiver slot.
11
12
#ifndef ROC_PIPELINE_RECEIVER_SLOT_H_
13
#define ROC_PIPELINE_RECEIVER_SLOT_H_
14
15
#include "
roc_address/interface.h
"
16
#include "
roc_address/protocol.h
"
17
#include "
roc_audio/frame_factory.h
"
18
#include "
roc_audio/mixer.h
"
19
#include "
roc_core/iarena.h
"
20
#include "
roc_core/list_node.h
"
21
#include "
roc_core/ref_counted.h
"
22
#include "
roc_packet/packet_factory.h
"
23
#include "
roc_pipeline/metrics.h
"
24
#include "
roc_pipeline/receiver_endpoint.h
"
25
#include "
roc_pipeline/receiver_session_group.h
"
26
#include "
roc_pipeline/state_tracker.h
"
27
#include "
roc_rtp/encoding_map.h
"
28
29
namespace
roc
{
30
namespace
pipeline
{
31
32
//! Receiver slot.
33
//!
34
//! Contains:
35
//! - one or more related receiver endpoints, one per each type
36
//! - one session group associated with those endpoints
37
class
ReceiverSlot
:
public
core::RefCounted
<ReceiverSlot, core::ArenaAllocation>,
38
public
core::ListNode
<> {
39
public
:
40
//! Initialize.
41
ReceiverSlot
(
const
ReceiverSourceConfig
& source_config,
42
const
ReceiverSlotConfig
& slot_config,
43
StateTracker
& state_tracker,
44
audio::Mixer
& mixer,
45
const
rtp::EncodingMap
& encoding_map,
46
packet::PacketFactory
& packet_factory,
47
audio::FrameFactory
& frame_factory,
48
core::IArena
&
arena
);
49
50
//! Check if the slot was succefully constructed.
51
bool
is_valid
()
const
;
52
53
//! Add endpoint.
54
ReceiverEndpoint
*
add_endpoint
(
address::Interface
iface,
55
address::Protocol
proto,
56
const
address::SocketAddr
& inbound_address,
57
packet::IWriter
* outbound_writer);
58
59
//! Pull packets and refresh sessions according to current time.
60
//! @returns
61
//! deadline (absolute time) when refresh should be invoked again
62
//! if there are no frames
63
core::nanoseconds_t
refresh
(
core::nanoseconds_t
current_time);
64
65
//! Adjust sessions clock to match consumer clock.
66
//! @remarks
67
//! @p playback_time specified absolute time when first sample of last frame
68
//! retrieved from pipeline will be actually played on sink
69
void
reclock
(
core::nanoseconds_t
playback_time);
70
71
//! Get number of alive sessions.
72
size_t
num_sessions
()
const
;
73
74
//! Get metrics for slot and its participants.
75
void
get_metrics
(
ReceiverSlotMetrics
& slot_metrics,
76
ReceiverParticipantMetrics
* party_metrics,
77
size_t
* party_count)
const
;
78
79
private
:
80
ReceiverEndpoint
* create_source_endpoint_(
address::Protocol
proto,
81
const
address::SocketAddr
& inbound_address,
82
packet::IWriter
* outbound_writer);
83
ReceiverEndpoint
* create_repair_endpoint_(
address::Protocol
proto,
84
const
address::SocketAddr
& inbound_address,
85
packet::IWriter
* outbound_writer);
86
ReceiverEndpoint
* create_control_endpoint_(
address::Protocol
proto,
87
const
address::SocketAddr
& inbound_address,
88
packet::IWriter
* outbound_writer);
89
90
const
rtp::EncodingMap
& encoding_map_;
91
92
StateTracker
& state_tracker_;
93
ReceiverSessionGroup
session_group_;
94
95
core::Optional<ReceiverEndpoint>
source_endpoint_;
96
core::Optional<ReceiverEndpoint>
repair_endpoint_;
97
core::Optional<ReceiverEndpoint>
control_endpoint_;
98
99
bool
valid_;
100
};
101
102
}
// namespace pipeline
103
}
// namespace roc
104
105
#endif
// ROC_PIPELINE_RECEIVER_SLOT_H_
roc::address::SocketAddr
Socket address.
Definition
socket_addr.h:26
roc::audio::FrameFactory
Frame factory.
Definition
frame_factory.h:38
roc::audio::Mixer
Mixer. Mixes multiple input streams into one output stream.
Definition
mixer.h:46
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::ReceiverEndpoint
Receiver endpoint sub-pipeline.
Definition
receiver_endpoint.h:44
roc::pipeline::ReceiverSessionGroup
Receiver session group.
Definition
receiver_session_group.h:48
roc::pipeline::ReceiverSlot::refresh
core::nanoseconds_t refresh(core::nanoseconds_t current_time)
Pull packets and refresh sessions according to current time.
roc::pipeline::ReceiverSlot::get_metrics
void get_metrics(ReceiverSlotMetrics &slot_metrics, ReceiverParticipantMetrics *party_metrics, size_t *party_count) const
Get metrics for slot and its participants.
roc::pipeline::ReceiverSlot::ReceiverSlot
ReceiverSlot(const ReceiverSourceConfig &source_config, const ReceiverSlotConfig &slot_config, StateTracker &state_tracker, audio::Mixer &mixer, const rtp::EncodingMap &encoding_map, packet::PacketFactory &packet_factory, audio::FrameFactory &frame_factory, core::IArena &arena)
Initialize.
roc::pipeline::ReceiverSlot::is_valid
bool is_valid() const
Check if the slot was succefully constructed.
roc::pipeline::ReceiverSlot::reclock
void reclock(core::nanoseconds_t playback_time)
Adjust sessions clock to match consumer clock.
roc::pipeline::ReceiverSlot::num_sessions
size_t num_sessions() const
Get number of alive sessions.
roc::pipeline::ReceiverSlot::add_endpoint
ReceiverEndpoint * add_endpoint(address::Interface iface, address::Protocol proto, const address::SocketAddr &inbound_address, packet::IWriter *outbound_writer)
Add endpoint.
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
encoding_map.h
RTP encoding map.
frame_factory.h
Frame factory.
iarena.h
Memory arena interface.
interface.h
Interface ID.
list_node.h
Linked list node.
metrics.h
Pipeline metrics.
mixer.h
Mixer.
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.
packet_factory.h
Packet factory.
protocol.h
Protocol ID.
receiver_endpoint.h
Receiver endpoint pipeline.
receiver_session_group.h
Receiver session group.
ref_counted.h
Base class for object with reference counter.
state_tracker.h
Pipeline state tracker.
roc::pipeline::ReceiverParticipantMetrics
Receiver-side metrics specific to one participant (remote sender).
Definition
metrics.h:54
roc::pipeline::ReceiverSlotConfig
Parameters of receiver slot.
Definition
config.h:202
roc::pipeline::ReceiverSlotMetrics
Receiver-side metrics of the whole slot.
Definition
metrics.h:66
roc::pipeline::ReceiverSourceConfig
Parameters of receiver session.
Definition
config.h:184
roc_pipeline
receiver_slot.h
Generated by
1.17.0