Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
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
17#include "roc_audio/mixer.h"
18#include "roc_core/iallocator.h"
19#include "roc_core/list.h"
20#include "roc_core/list_node.h"
26#include "roc_rtp/format_map.h"
27
28namespace roc {
29namespace pipeline {
30
31//! Receiver slot.
32//!
33//! Contains:
34//! - one or more related receiver endpoints, one per each type
35//! - one session group associated with those endpoints
36class ReceiverSlot : public core::RefCounted<ReceiverSlot, core::StandardAllocation>,
37 public core::ListNode {
39
40public:
41 //! Initialize.
42 ReceiverSlot(const ReceiverConfig& receiver_config,
43 ReceiverState& receiver_state,
44 audio::Mixer& mixer,
45 const rtp::FormatMap& format_map,
46 packet::PacketFactory& packet_factory,
47 core::BufferFactory<uint8_t>& byte_buffer_factory,
48 core::BufferFactory<audio::sample_t>& sample_buffer_factory,
50
51 //! Create endpoint.
53
54 //! Delete endpoint.
56
57 //! Pull packets from queues and advance session timestamp.
59
60 //! Adjust session clock to match consumer clock.
62
63 //! Get number of alive sessions.
64 size_t num_sessions() const;
65
66private:
67 ReceiverEndpoint* create_source_endpoint_(address::Protocol proto);
68 ReceiverEndpoint* create_repair_endpoint_(address::Protocol proto);
69 ReceiverEndpoint* create_control_endpoint_(address::Protocol proto);
70
71 const rtp::FormatMap& format_map_;
72
73 ReceiverState& receiver_state_;
74 ReceiverSessionGroup session_group_;
75
76 core::Optional<ReceiverEndpoint> source_endpoint_;
77 core::Optional<ReceiverEndpoint> repair_endpoint_;
78 core::Optional<ReceiverEndpoint> control_endpoint_;
79};
80
81} // namespace pipeline
82} // namespace roc
83
84#endif // ROC_PIPELINE_RECEIVER_SLOT_H_
Mixer. Mixes multiple input streams into one output stream.
Definition: mixer.h:41
Memory allocator interface.
Definition: iallocator.h:23
Base class for list element.
Definition: list_node.h:26
Optionally constructed object.
Definition: optional.h:25
Base class for reference counted object.
Definition: ref_counted.h:39
IAllocator & allocator() const
Get allocator.
Receiver endpoint sub-pipeline.
ReceiverSlot(const ReceiverConfig &receiver_config, ReceiverState &receiver_state, audio::Mixer &mixer, const rtp::FormatMap &format_map, packet::PacketFactory &packet_factory, core::BufferFactory< uint8_t > &byte_buffer_factory, core::BufferFactory< audio::sample_t > &sample_buffer_factory, core::IAllocator &allocator)
Initialize.
ReceiverEndpoint * create_endpoint(address::Interface iface, address::Protocol proto)
Create endpoint.
void reclock(packet::ntp_timestamp_t timestamp)
Adjust session clock to match consumer clock.
void advance(packet::timestamp_t timestamp)
Pull packets from queues and advance session timestamp.
void delete_endpoint(address::Interface iface)
Delete endpoint.
size_t num_sessions() const
Get number of alive sessions.
Receiver pipeline state. Thread-safe.
RTP payload format map.
Definition: format_map.h:22
RTP payload format map.
Memory allocator interface.
Interface ID.
Intrusive doubly-linked list.
Linked list node.
Mixer.
Interface
Interface ID.
Definition: interface.h:19
Protocol
Protocol ID.
Definition: protocol.h:19
uint32_t timestamp_t
Audio packet timestamp.
Definition: units.h:25
uint64_t ntp_timestamp_t
NTP timestamp.
Definition: units.h:91
Root namespace.
Packet factory.
Protocol ID.
Receiver endpoint pipeline.
Receiver session group.
Receiver pipeline state.
Base class for reference counted object.
Receiver parameters.
Definition: config.h:247