Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
sender_session.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_session.h
10//! @brief Sender session.
11
12#ifndef ROC_PIPELINE_SENDER_SESSION_H_
13#define ROC_PIPELINE_SENDER_SESSION_H_
14
23#include "roc_core/iallocator.h"
25#include "roc_core/optional.h"
26#include "roc_core/scoped_ptr.h"
28#include "roc_fec/writer.h"
31#include "roc_packet/router.h"
32#include "roc_pipeline/config.h"
34#include "roc_rtcp/composer.h"
35#include "roc_rtcp/session.h"
36#include "roc_rtp/format_map.h"
37
38namespace roc {
39namespace pipeline {
40
41//! Sender session sub-pipeline.
42//!
43//! Contains:
44//! - a pipeline for processing audio frames from single sender and converting
45//! them into packets
47public:
48 //! Initialize.
50 const rtp::FormatMap& format_map,
51 packet::PacketFactory& packet_factory,
52 core::BufferFactory<uint8_t>& byte_buffer_factory,
53 core::BufferFactory<audio::sample_t>& sample_buffer_factory,
54 core::IAllocator& allocator);
55
56 //! Create transport sub-pipeline.
58 SenderEndpoint* repair_endpoint);
59
60 //! Create control sub-pipeline.
61 bool create_control_pipeline(SenderEndpoint* control_endpoint);
62
63 //! Get audio writer.
65
66 //! Get deadline when the pipeline should be updated.
68
69 //! Update pipeline.
70 void update();
71
72private:
73 // Implementation of rtcp::ISenderHooks interface.
74 // These methods are invoked by rtcp::Session.
75 virtual size_t on_get_num_sources();
76 virtual packet::source_t on_get_sending_source(size_t source_index);
78 on_get_sending_metrics(packet::ntp_timestamp_t report_time);
79 virtual void on_add_reception_metrics(const rtcp::ReceptionMetrics& metrics);
80 virtual void on_add_link_metrics(const rtcp::LinkMetrics& metrics);
81
82 core::IAllocator& allocator_;
83
84 const SenderConfig& config_;
85
86 const rtp::FormatMap& format_map_;
87
88 packet::PacketFactory& packet_factory_;
89 core::BufferFactory<uint8_t>& byte_buffer_factory_;
90 core::BufferFactory<audio::sample_t>& sample_buffer_factory_;
91
93
95
98
101
102 core::Optional<audio::ChannelMapperWriter> channel_mapper_writer_;
103
104 core::Optional<audio::PoisonWriter> resampler_poisoner_;
107
108 core::Optional<rtcp::Composer> rtcp_composer_;
109 core::Optional<rtcp::Session> rtcp_session_;
110
111 audio::IFrameWriter* audio_writer_;
112
113 size_t num_sources_;
114};
115
116} // namespace pipeline
117} // namespace roc
118
119#endif // ROC_PIPELINE_SENDER_SESSION_H_
Buffer factory.
Channel mapper writer.
Frame writer interface.
Memory allocator interface.
Definition iallocator.h:23
Base class for non-copyable objects.
Definition noncopyable.h:23
Optionally constructed object.
Definition optional.h:25
Unique ownrship pointer.
Definition scoped_ptr.h:32
Sender endpoint sub-pipeline.
Sender session sub-pipeline.
bool create_control_pipeline(SenderEndpoint *control_endpoint)
Create control sub-pipeline.
audio::IFrameWriter * writer() const
Get audio writer.
void update()
Update pipeline.
core::nanoseconds_t get_update_deadline() const
Get deadline when the pipeline should be updated.
bool create_transport_pipeline(SenderEndpoint *source_endpoint, SenderEndpoint *repair_endpoint)
Create transport sub-pipeline.
SenderSession(const SenderConfig &config, 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.
Sender hooks interface.
RTP payload format map.
Definition format_map.h:22
RTP payload format map.
Memory allocator interface.
FEC block encoder interface.
Audio frame encoder interface.
Interleaves packets before transmit.
Audio resampler interface.
int64_t nanoseconds_t
Nanoseconds.
Definition time.h:58
uint32_t source_t
Packet source ID identifying packet stream.
Definition units.h:22
uint64_t ntp_timestamp_t
NTP timestamp.
Definition units.h:91
Root namespace.
Non-copyable object.
Optionally constructed object.
Packet factory.
Packetizer.
Poison writer.
Resampler map.
Pipeline config.
RTCP packet composer.
Route packets to writers.
Unique ownrship pointer.
Sender endpoint pipeline.
RTCP session.
Sender parameters.
Definition config.h:101
Metrics for network link. Calculated independently on both sender and receiver.
Definition metrics.h:52
Metrics sent from receiver to sender per source.
Definition metrics.h:37
Metrics sent from sender to receiver.
Definition metrics.h:23
FEC writer.