Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
config.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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/config.h
10 //! @brief Pipeline config.
11 
12 #ifndef ROC_PIPELINE_CONFIG_H_
13 #define ROC_PIPELINE_CONFIG_H_
14 
15 #include "roc_address/protocol.h"
18 #include "roc_audio/profiler.h"
20 #include "roc_audio/sample_spec.h"
21 #include "roc_audio/watchdog.h"
22 #include "roc_core/stddefs.h"
23 #include "roc_core/time.h"
24 #include "roc_fec/codec_config.h"
25 #include "roc_fec/reader.h"
26 #include "roc_fec/writer.h"
27 #include "roc_packet/units.h"
29 #include "roc_rtcp/config.h"
30 #include "roc_rtp/filter.h"
31 
32 namespace roc {
33 namespace pipeline {
34 
35 //! Default sample rate, number of samples per second.
36 const size_t DefaultSampleRate = 44100;
37 
38 //! Default sample specification.
39 static const audio::SampleSpec DefaultSampleSpec(DefaultSampleRate,
43  audio::ChanMask_Surround_Stereo);
44 
45 //! Default packet length.
46 //! @remarks
47 //! 5ms works well on majority Wi-Fi networks and allows rather low latencies. However,
48 //! a lower length may be required depending on network MTU, e.g. for Internet.
50 
51 //! Default latency.
52 //! @remarks
53 //! 200ms works well on majority Wi-Fi networks and is not too annoying. However, many
54 //! networks allow lower latencies, and some networks require higher.
56 
57 //! Parameters of sender sink and sender session.
59  //! Input sample spec
61 
62  //! Task processing parameters.
64 
65  //! RTP payload type for audio packets.
66  unsigned payload_type;
67 
68  //! Packet length, in nanoseconds.
70 
71  //! FEC writer parameters.
73 
74  //! FEC encoder parameters.
76 
77  //! Latency parameters.
79 
80  //! Feedback parameters.
82 
83  //! Resampler parameters.
85 
86  //! Profiler configuration.
88 
89  //! RTCP config.
91 
92  //! Constrain receiver speed using a CPU timer according to the sample rate.
94 
95  //! Automatically fill duration of input frames.
97 
98  //! Automatically fill capture timestamps of input frames with invocation time.
100 
101  //! Profile moving average of frames being written.
103 
104  //! Interleave packets.
106 
107  //! Initialize config.
109 
110  //! Fill unset values with defaults.
112 };
113 
114 //! Parameters of sender slot.
116  //! Initialize config.
118 
119  //! Fill unset values with defaults.
121 };
122 
123 //! Parameters common for all receiver sessions.
125  //! Output sample spec.
127 
128  //! Profiler configuration.
130 
131  //! RTP filter parameters.
133 
134  //! RTCP config.
136 
137  //! Constrain receiver speed using a CPU timer according to the sample rate.
139 
140  //! Automatically invoke reclock before returning frames with invocation time.
142 
143  //! Profile moving average of frames being written.
145 
146  //! Initialize config.
148 
149  //! Fill unset values with defaults.
151 };
152 
153 //! Parameters of receiver session.
155  //! Packet payload type.
156  unsigned int payload_type;
157 
158  //! FEC reader parameters.
160 
161  //! FEC decoder parameters.
163 
164  //! Latency parameters.
166 
167  //! Watchdog parameters.
169 
170  //! Resampler parameters.
172 
173  //! Insert weird beeps instead of silence on packet loss.
175 
176  //! Initialize config.
178 
179  //! Fill unset values with defaults.
181 };
182 
183 //! Parameters of receiver session.
185  //! Task processing parameters.
187 
188  //! Parameters common for all sessions.
190 
191  //! Default parameters for a session.
193 
194  //! Initialize config.
196 
197  //! Fill unset values with defaults.
199 };
200 
201 //! Parameters of receiver slot.
203  //! Enable routing packets to multiple sessions within slot.
205 
206  //! Initialize config.
208 
209  //! Fill unset values with defaults.
211 };
212 
213 //! Converter parameters.
215  //! Input sample spec
217 
218  //! Output sample spec
220 
221  //! Resampler parameters.
223 
224  //! Profiler configuration.
226 
227  //! Profile moving average of frames being written.
229 
230  //! Initialize config.
232 
233  //! Fill unset values with defaults.
235 };
236 
237 } // namespace pipeline
238 } // namespace roc
239 
240 #endif // ROC_PIPELINE_CONFIG_H_
Sample specification. Describes sample rate and channels.
Definition: sample_spec.h:30
FEC codec parameters.
Feedback monitor.
RTP filter.
Latency tuner.
@ ChanLayout_Surround
Multi-channel mono / stereo / surround sound.
Definition: channel_defs.h:35
const PcmFormat Sample_RawFormat
Format description for raw audio samples.
@ ChanOrder_Smpte
ITU/SMPTE channel order. Order: FL, FR, FC, LFE, BL, BR, BC, SL, SR, TFL, TFR, TBL,...
Definition: channel_defs.h:66
const nanoseconds_t Millisecond
One millisecond represented in nanoseconds.
Definition: time.h:67
int64_t nanoseconds_t
Nanoseconds.
Definition: time.h:58
const core::nanoseconds_t DefaultPacketLength
Default packet length.
Definition: config.h:49
const core::nanoseconds_t DefaultLatency
Default latency.
Definition: config.h:55
const size_t DefaultSampleRate
Default sample rate, number of samples per second.
Definition: config.h:36
Root namespace.
Base class for pipelines.
Profiler.
Protocol ID.
FEC reader.
Resampler config.
RTCP config.
Sample specifications.
Commonly used types and functions.
Feedback monitor configuration.
Latency settings.
Definition: latency_tuner.h:64
Profiler Configuration Parameters. Controls profiling interval and duration of each circular buffer c...
Definition: profiler.h:30
Watchdog parameters.
Definition: watchdog.h:28
FEC codec parameters.
Definition: codec_config.h:22
FEC reader parameters.
Definition: reader.h:30
FEC writer parameters.
Definition: writer.h:29
Pipeline loop task processing parameters.
Definition: pipeline_loop.h:34
Parameters common for all receiver sessions.
Definition: config.h:124
bool enable_auto_reclock
Automatically invoke reclock before returning frames with invocation time.
Definition: config.h:141
audio::ProfilerConfig profiler
Profiler configuration.
Definition: config.h:129
void deduce_defaults()
Fill unset values with defaults.
ReceiverCommonConfig()
Initialize config.
rtcp::Config rtcp
RTCP config.
Definition: config.h:135
bool enable_profiling
Profile moving average of frames being written.
Definition: config.h:144
bool enable_timing
Constrain receiver speed using a CPU timer according to the sample rate.
Definition: config.h:138
audio::SampleSpec output_sample_spec
Output sample spec.
Definition: config.h:126
rtp::FilterConfig rtp_filter
RTP filter parameters.
Definition: config.h:132
Parameters of receiver session.
Definition: config.h:154
audio::LatencyConfig latency
Latency parameters.
Definition: config.h:165
audio::ResamplerConfig resampler
Resampler parameters.
Definition: config.h:171
void deduce_defaults()
Fill unset values with defaults.
fec::ReaderConfig fec_reader
FEC reader parameters.
Definition: config.h:159
unsigned int payload_type
Packet payload type.
Definition: config.h:156
fec::CodecConfig fec_decoder
FEC decoder parameters.
Definition: config.h:162
audio::WatchdogConfig watchdog
Watchdog parameters.
Definition: config.h:168
ReceiverSessionConfig()
Initialize config.
bool enable_beeping
Insert weird beeps instead of silence on packet loss.
Definition: config.h:174
Parameters of receiver slot.
Definition: config.h:202
void deduce_defaults()
Fill unset values with defaults.
ReceiverSlotConfig()
Initialize config.
bool enable_routing
Enable routing packets to multiple sessions within slot.
Definition: config.h:204
Parameters of receiver session.
Definition: config.h:184
ReceiverSourceConfig()
Initialize config.
ReceiverCommonConfig common
Parameters common for all sessions.
Definition: config.h:189
PipelineLoopConfig pipeline_loop
Task processing parameters.
Definition: config.h:186
ReceiverSessionConfig session_defaults
Default parameters for a session.
Definition: config.h:192
void deduce_defaults()
Fill unset values with defaults.
Parameters of sender sink and sender session.
Definition: config.h:58
unsigned payload_type
RTP payload type for audio packets.
Definition: config.h:66
core::nanoseconds_t packet_length
Packet length, in nanoseconds.
Definition: config.h:69
bool enable_timing
Constrain receiver speed using a CPU timer according to the sample rate.
Definition: config.h:93
audio::SampleSpec input_sample_spec
Input sample spec.
Definition: config.h:60
audio::FeedbackConfig feedback
Feedback parameters.
Definition: config.h:81
rtcp::Config rtcp
RTCP config.
Definition: config.h:90
bool enable_auto_cts
Automatically fill capture timestamps of input frames with invocation time.
Definition: config.h:99
bool enable_auto_duration
Automatically fill duration of input frames.
Definition: config.h:96
audio::ResamplerConfig resampler
Resampler parameters.
Definition: config.h:84
audio::ProfilerConfig profiler
Profiler configuration.
Definition: config.h:87
void deduce_defaults()
Fill unset values with defaults.
audio::LatencyConfig latency
Latency parameters.
Definition: config.h:78
fec::WriterConfig fec_writer
FEC writer parameters.
Definition: config.h:72
PipelineLoopConfig pipeline_loop
Task processing parameters.
Definition: config.h:63
fec::CodecConfig fec_encoder
FEC encoder parameters.
Definition: config.h:75
bool enable_interleaving
Interleave packets.
Definition: config.h:105
SenderSinkConfig()
Initialize config.
bool enable_profiling
Profile moving average of frames being written.
Definition: config.h:102
Parameters of sender slot.
Definition: config.h:115
void deduce_defaults()
Fill unset values with defaults.
SenderSlotConfig()
Initialize config.
Converter parameters.
Definition: config.h:214
audio::SampleSpec input_sample_spec
Input sample spec.
Definition: config.h:216
audio::SampleSpec output_sample_spec
Output sample spec.
Definition: config.h:219
audio::ProfilerConfig profiler
Profiler configuration.
Definition: config.h:225
bool enable_profiling
Profile moving average of frames being written.
Definition: config.h:228
void deduce_defaults()
Fill unset values with defaults.
TranscoderConfig()
Initialize config.
audio::ResamplerConfig resampler
Resampler parameters.
Definition: config.h:222
RTCP config.
Definition: config.h:24
RTP filter parameters.
Definition: filter.h:25
Time definitions.
Various units used in packets.
Watchdog.
FEC writer.