srs-control 0.2.2
Loading...
Searching...
No Matches
FrameCountChecker.hpp
Go to the documentation of this file.
1#pragma once
2
6#include <atomic>
7#include <cassert>
8#include <cstddef>
9#include <cstdint>
10#include <string_view>
11
12namespace srs::sink
13{
14 class FrameCountChecker : public process::SinkTask<DataWriterOption::no_output, std::string_view, int64_t>
15 {
16 public:
17 static constexpr auto IsStructType = false;
18
19 FrameCountChecker(std::size_t n_lines);
20
23 FrameCountChecker& operator=(const FrameCountChecker&) = delete;
24 FrameCountChecker& operator=(FrameCountChecker&&) noexcept = delete;
26
27 auto run(const OutputTo<InputType> auto& prev_data_converter, std::size_t line_number = 0) -> RunResult
28 {
29 assert(line_number < get_n_lines());
30 auto input_data = prev_data_converter(line_number);
31 return analyze_frame_counter(input_data);
32 }
33
34 [[nodiscard]] auto get_frame_drop_count() const -> int64_t { return frame_drop_counter_.load(); }
35
36 void close() {}
37
38 private:
39 std::atomic<int64_t> last_frame_counter_;
40 std::atomic<int64_t> frame_drop_counter_;
41
42 auto analyze_frame_counter(InputType binary_data) -> RunResult;
43 auto extract_frame_counter(InputType binary_data) -> RunResult;
44 void register_frame_counter(int64_t frame_counter);
45 };
46} // namespace srs::sink
std::expected< OutputType, std::string_view > RunResult
Definition BaseTask.hpp:32
auto extract_frame_counter(InputType binary_data) -> RunResult
static constexpr auto IsStructType
FrameCountChecker(const FrameCountChecker &)=delete
auto get_frame_drop_count() const -> int64_t
auto analyze_frame_counter(InputType binary_data) -> RunResult
std::atomic< int64_t > frame_drop_counter_
std::atomic< int64_t > last_frame_counter_
FrameCountChecker(FrameCountChecker &&) noexcept=delete
void register_frame_counter(int64_t frame_counter)
FrameCountChecker(std::size_t n_lines)
auto run(const OutputTo< InputType > auto &prev_data_converter, std::size_t line_number=0) -> RunResult