Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
profiling_writer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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_audio/profiling_writer.h
10 //! @brief Profiling writer.
11 
12 #ifndef ROC_AUDIO_PROFILING_WRITER_H_
13 #define ROC_AUDIO_PROFILING_WRITER_H_
14 
16 #include "roc_audio/profiler.h"
17 #include "roc_core/noncopyable.h"
18 #include "roc_core/rate_limiter.h"
19 #include "roc_core/time.h"
20 #include "roc_packet/units.h"
21 
22 namespace roc {
23 namespace audio {
24 
25 //! Profiling writer.
27 public:
28  //! Initialization.
30  core::IArena& arena,
31  const audio::SampleSpec& sample_spec,
32  ProfilerConfig profiler_config);
33 
34  //! Check if the profiler was succefully constructed.
35  bool is_valid() const;
36 
37  //! Write audio frame.
38  virtual void write(Frame& frame);
39 
40 private:
41  core::nanoseconds_t write_(Frame& frame);
42 
43  Profiler profiler_;
44  IFrameWriter& writer_;
45 };
46 
47 } // namespace audio
48 } // namespace roc
49 
50 #endif // ROC_AUDIO_PROFILING_WRITER_H_
Audio frame.
Definition: frame.h:25
Frame writer interface.
Definition: iframe_writer.h:22
Profiler The role of the profiler is to report the average processing speed (# of samples processed p...
Definition: profiler.h:65
bool is_valid() const
Check if the profiler was succefully constructed.
virtual void write(Frame &frame)
Write audio frame.
ProfilingWriter(IFrameWriter &writer, core::IArena &arena, const audio::SampleSpec &sample_spec, ProfilerConfig profiler_config)
Initialization.
Sample specification. Describes sample rate and channels.
Definition: sample_spec.h:26
Memory arena interface.
Definition: iarena.h:23
Base class for non-copyable objects.
Definition: noncopyable.h:23
Frame writer interface.
int64_t nanoseconds_t
Nanoseconds.
Definition: time.h:58
Root namespace.
Non-copyable object.
Profiler.
Rate limiter.
Profiler Configuration Parameters. Controls profiling interval and duration of each circular buffer c...
Definition: profiler.h:30
Time definitions.
Various units used in packets.