Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
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
17#include "roc_audio/fanout.h"
19#include "roc_core/iallocator.h"
21#include "roc_core/optional.h"
24#include "roc_pipeline/config.h"
27
28namespace roc {
29namespace pipeline {
30
31//! Sender slot.
32//!
33//! Contains:
34//! - one or more related sender endpoints, one per each type
35//! - one session associated with those endpoints
36class SenderSlot : public core::RefCounted<SenderSlot, core::StandardAllocation>,
37 public core::ListNode {
39
40public:
41 //! Initialize.
42 SenderSlot(const SenderConfig& config,
43 const rtp::FormatMap& format_map,
44 audio::Fanout& fanout,
45 packet::PacketFactory& packet_factory,
46 core::BufferFactory<uint8_t>& byte_buffer_factory,
47 core::BufferFactory<audio::sample_t>& sample_buffer_factory,
49
50 //! Add endpoint.
52
53 //! Get audio writer.
54 //! @returns NULL if slot is not ready.
56
57 //! Check if slot configuration is done.
58 bool is_ready() const;
59
60 //! Get deadline when the pipeline should be updated.
62
63 //! Update pipeline.
64 void update();
65
66private:
67 SenderEndpoint* create_source_endpoint_(address::Protocol proto);
68 SenderEndpoint* create_repair_endpoint_(address::Protocol proto);
69 SenderEndpoint* create_control_endpoint_(address::Protocol proto);
70
71 const SenderConfig& config_;
72
73 audio::Fanout& fanout_;
74
75 core::Optional<SenderEndpoint> source_endpoint_;
76 core::Optional<SenderEndpoint> repair_endpoint_;
77 core::Optional<SenderEndpoint> control_endpoint_;
78
79 SenderSession session_;
80};
81
82} // namespace pipeline
83} // namespace roc
84
85#endif // ROC_PIPELINE_SENDER_SLOT_H_
Buffer factory.
Fanout. Duplicates audio stream to multiple output writers.
Definition fanout.h:26
Frame writer interface.
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.
Sender endpoint sub-pipeline.
Sender session sub-pipeline.
core::nanoseconds_t get_update_deadline() const
Get deadline when the pipeline should be updated.
SenderSlot(const SenderConfig &config, const rtp::FormatMap &format_map, audio::Fanout &fanout, packet::PacketFactory &packet_factory, core::BufferFactory< uint8_t > &byte_buffer_factory, core::BufferFactory< audio::sample_t > &sample_buffer_factory, core::IAllocator &allocator)
Initialize.
bool is_ready() const
Check if slot configuration is done.
SenderEndpoint * create_endpoint(address::Interface iface, address::Protocol proto)
Add endpoint.
audio::IFrameWriter * writer()
Get audio writer.
void update()
Update pipeline.
RTP payload format map.
Definition format_map.h:22
Fanout.
Memory allocator interface.
Interface ID.
Interface
Interface ID.
Definition interface.h:19
Protocol
Protocol ID.
Definition protocol.h:19
int64_t nanoseconds_t
Nanoseconds.
Definition time.h:58
Root namespace.
Non-copyable object.
Optionally constructed object.
Packet factory.
Protocol ID.
Base class for reference counted object.
Pipeline config.
Sender endpoint pipeline.
Sender session.
Sender parameters.
Definition config.h:101