From 68403ac03d32ae618c57b5f0698450e2395e1e40 Mon Sep 17 00:00:00 2001 From: Victor Gaydov Date: Mon, 29 Jul 2024 01:18:46 +0400 Subject: [PATCH] draft-713: Move CsvDumper and TempFile to new module roc_dbgio --- SConstruct | 1 + .../roc_audio/feedback_monitor.cpp | 2 +- .../roc_audio/feedback_monitor.h | 3 +- .../roc_audio/freq_estimator.cpp | 4 +-- .../roc_audio/freq_estimator.h | 6 ++-- .../roc_audio/latency_monitor.cpp | 2 +- .../roc_audio/latency_monitor.h | 4 +-- .../roc_audio/latency_tuner.cpp | 4 +-- .../roc_audio/latency_tuner.h | 6 ++-- .../{roc_core => roc_dbgio}/csv_dumper.cpp | 23 ++++++------ .../{roc_core => roc_dbgio}/csv_dumper.h | 36 +++++++++---------- .../target_posix/roc_dbgio}/temp_file.cpp | 30 +++++++++------- .../target_posix/roc_dbgio}/temp_file.h | 12 +++---- src/internal_modules/roc_pipeline/config.h | 5 +-- .../roc_pipeline/receiver_session.cpp | 2 +- .../roc_pipeline/receiver_session.h | 6 ++-- .../roc_pipeline/receiver_session_group.cpp | 4 +-- .../roc_pipeline/receiver_session_group.h | 6 ++-- .../roc_pipeline/receiver_slot.cpp | 3 +- .../roc_pipeline/receiver_slot.h | 4 +-- .../roc_pipeline/receiver_source.cpp | 2 +- .../roc_pipeline/receiver_source.h | 4 +-- .../roc_pipeline/sender_session.cpp | 2 +- .../roc_pipeline/sender_session.h | 5 +-- .../roc_pipeline/sender_sink.cpp | 2 +- .../roc_pipeline/sender_sink.h | 3 +- .../roc_pipeline/sender_slot.cpp | 2 +- .../roc_pipeline/sender_slot.h | 3 +- src/internal_modules/roc_rtp/link_meter.cpp | 4 +-- src/internal_modules/roc_rtp/link_meter.h | 6 ++-- src/tests/roc_sndio/test_backend_sink.cpp | 8 ++--- src/tests/roc_sndio/test_backend_source.cpp | 10 +++--- src/tests/roc_sndio/test_pump.cpp | 6 ++-- 33 files changed, 114 insertions(+), 106 deletions(-) rename src/internal_modules/{roc_core => roc_dbgio}/csv_dumper.cpp (86%) rename src/internal_modules/{roc_core => roc_dbgio}/csv_dumper.h (79%) rename src/internal_modules/{roc_core/target_posix/roc_core => roc_dbgio/target_posix/roc_dbgio}/temp_file.cpp (69%) rename src/internal_modules/{roc_core/target_posix/roc_core => roc_dbgio/target_posix/roc_dbgio}/temp_file.h (82%) diff --git a/SConstruct b/SConstruct index 2e8c6c9d5..df9c90674 100644 --- a/SConstruct +++ b/SConstruct @@ -721,6 +721,7 @@ env['ROC_SOVER'] = '.'.join(env['ROC_VERSION'].split('.')[:2]) env['ROC_MODULES'] = [ 'roc_core', 'roc_status', + 'roc_dbgio', 'roc_address', 'roc_packet', 'roc_audio', diff --git a/src/internal_modules/roc_audio/feedback_monitor.cpp b/src/internal_modules/roc_audio/feedback_monitor.cpp index 7cc4f1b6b..268d50e79 100644 --- a/src/internal_modules/roc_audio/feedback_monitor.cpp +++ b/src/internal_modules/roc_audio/feedback_monitor.cpp @@ -21,7 +21,7 @@ FeedbackMonitor::FeedbackMonitor(IFrameWriter& writer, const FeedbackConfig& feedback_config, const LatencyConfig& latency_config, const SampleSpec& sample_spec, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : tuner_(latency_config, sample_spec, dumper) , use_packetizer_(false) , has_feedback_(false) diff --git a/src/internal_modules/roc_audio/feedback_monitor.h b/src/internal_modules/roc_audio/feedback_monitor.h index 2c7c6bd95..791e89de7 100644 --- a/src/internal_modules/roc_audio/feedback_monitor.h +++ b/src/internal_modules/roc_audio/feedback_monitor.h @@ -20,6 +20,7 @@ #include "roc_core/noncopyable.h" #include "roc_core/rate_limiter.h" #include "roc_core/time.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/ilink_meter.h" namespace roc { @@ -69,7 +70,7 @@ class FeedbackMonitor : public IFrameWriter, public core::NonCopyable<> { const FeedbackConfig& feedback_config, const LatencyConfig& latency_config, const SampleSpec& sample_spec, - core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); //! Check if the object was successfully constructed. status::StatusCode init_status() const; diff --git a/src/internal_modules/roc_audio/freq_estimator.cpp b/src/internal_modules/roc_audio/freq_estimator.cpp index 4c1b105a0..8643b8ddb 100644 --- a/src/internal_modules/roc_audio/freq_estimator.cpp +++ b/src/internal_modules/roc_audio/freq_estimator.cpp @@ -68,7 +68,7 @@ double dot_prod(const double* coeff, FreqEstimator::FreqEstimator(FreqEstimatorProfile profile, packet::stream_timestamp_t target_latency, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : config_(make_config(profile)) , target_(target_latency) , dec1_ind_(0) @@ -202,7 +202,7 @@ double FreqEstimator::run_controller_(double current) { } void FreqEstimator::dump_(double filtered) { - core::CsvEntry e; + dbgio::CsvEntry e; e.type = 'f'; e.n_fields = 5; e.fields[0] = core::timestamp(core::ClockUnix); diff --git a/src/internal_modules/roc_audio/freq_estimator.h b/src/internal_modules/roc_audio/freq_estimator.h index 01399eaf2..a2dd11362 100644 --- a/src/internal_modules/roc_audio/freq_estimator.h +++ b/src/internal_modules/roc_audio/freq_estimator.h @@ -14,8 +14,8 @@ #include "roc_audio/freq_estimator_decim.h" #include "roc_audio/sample.h" -#include "roc_core/csv_dumper.h" #include "roc_core/noncopyable.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/units.h" namespace roc { @@ -84,7 +84,7 @@ class FreqEstimator : public core::NonCopyable<> { //! - @p target_latency defines latency we want to archive. FreqEstimator(FreqEstimatorProfile profile, packet::stream_timestamp_t target_latency, - roc::core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); //! Get current frequecy coefficient. float freq_coeff() const; @@ -125,7 +125,7 @@ class FreqEstimator : public core::NonCopyable<> { // Last time when FreqEstimator was out of range. core::nanoseconds_t last_unstable_time_; - core::CsvDumper* dumper_; + dbgio::CsvDumper* dumper_; }; } // namespace audio diff --git a/src/internal_modules/roc_audio/latency_monitor.cpp b/src/internal_modules/roc_audio/latency_monitor.cpp index f2ace4a0a..6b28eb1b5 100644 --- a/src/internal_modules/roc_audio/latency_monitor.cpp +++ b/src/internal_modules/roc_audio/latency_monitor.cpp @@ -24,7 +24,7 @@ LatencyMonitor::LatencyMonitor(IFrameReader& frame_reader, const LatencyConfig& config, const SampleSpec& packet_sample_spec, const SampleSpec& frame_sample_spec, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : tuner_(config, frame_sample_spec, dumper) , frame_reader_(frame_reader) , incoming_queue_(incoming_queue) diff --git a/src/internal_modules/roc_audio/latency_monitor.h b/src/internal_modules/roc_audio/latency_monitor.h index a852de7db..da5164cc0 100644 --- a/src/internal_modules/roc_audio/latency_monitor.h +++ b/src/internal_modules/roc_audio/latency_monitor.h @@ -19,10 +19,10 @@ #include "roc_audio/resampler_reader.h" #include "roc_audio/sample_spec.h" #include "roc_core/attributes.h" -#include "roc_core/csv_dumper.h" #include "roc_core/noncopyable.h" #include "roc_core/optional.h" #include "roc_core/time.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_fec/block_reader.h" #include "roc_packet/sorted_queue.h" #include "roc_packet/units.h" @@ -70,7 +70,7 @@ class LatencyMonitor : public IFrameReader, public core::NonCopyable<> { const LatencyConfig& config, const SampleSpec& packet_sample_spec, const SampleSpec& frame_sample_spec, - core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); //! Check if the object was successfully constructed. status::StatusCode init_status() const; diff --git a/src/internal_modules/roc_audio/latency_tuner.cpp b/src/internal_modules/roc_audio/latency_tuner.cpp index e6f493983..e009620fc 100644 --- a/src/internal_modules/roc_audio/latency_tuner.cpp +++ b/src/internal_modules/roc_audio/latency_tuner.cpp @@ -191,7 +191,7 @@ LatencyConfig::calc_latency_tolerance(const core::nanoseconds_t latency, LatencyTuner::LatencyTuner(const LatencyConfig& config, const SampleSpec& sample_spec, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : stream_pos_(0) , scale_interval_(0) , scale_pos_(0) @@ -439,7 +439,7 @@ void LatencyTuner::write_metrics(const LatencyMetrics& latency_metrics, } if (dumper_) { - core::CsvEntry e; + dbgio::CsvEntry e; e.type = 't'; e.n_fields = 3; e.fields[0] = core::timestamp(core::ClockUnix); diff --git a/src/internal_modules/roc_audio/latency_tuner.h b/src/internal_modules/roc_audio/latency_tuner.h index 44e0eb663..aef68f67d 100644 --- a/src/internal_modules/roc_audio/latency_tuner.h +++ b/src/internal_modules/roc_audio/latency_tuner.h @@ -14,10 +14,10 @@ #include "roc_audio/freq_estimator.h" #include "roc_audio/sample_spec.h" -#include "roc_core/csv_dumper.h" #include "roc_core/noncopyable.h" #include "roc_core/optional.h" #include "roc_core/time.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/ilink_meter.h" #include "roc_packet/units.h" #include "roc_status/status_code.h" @@ -251,7 +251,7 @@ class LatencyTuner : public core::NonCopyable<> { //! Initialize. LatencyTuner(const LatencyConfig& config, const SampleSpec& sample_spec, - core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); //! Check if the object was successfully constructed. status::StatusCode init_status() const; @@ -350,7 +350,7 @@ class LatencyTuner : public core::NonCopyable<> { core::RateLimiter last_lat_limiter_; - core::CsvDumper* dumper_; + dbgio::CsvDumper* dumper_; status::StatusCode init_status_; void try_decrease_latency_(const core::nanoseconds_t estimate, diff --git a/src/internal_modules/roc_core/csv_dumper.cpp b/src/internal_modules/roc_dbgio/csv_dumper.cpp similarity index 86% rename from src/internal_modules/roc_core/csv_dumper.cpp rename to src/internal_modules/roc_dbgio/csv_dumper.cpp index ba33ec4ba..5a413649b 100644 --- a/src/internal_modules/roc_core/csv_dumper.cpp +++ b/src/internal_modules/roc_dbgio/csv_dumper.cpp @@ -6,15 +6,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "roc_core/csv_dumper.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_core/errno_to_str.h" #include "roc_core/log.h" #include "roc_core/panic.h" namespace roc { -namespace core { +namespace dbgio { -CsvDumper::CsvDumper(const CsvConfig& config, IArena& arena) +CsvDumper::CsvDumper(const CsvConfig& config, core::IArena& arena) : config_(config) , open_flag_(false) , stop_flag_(false) @@ -32,7 +32,7 @@ CsvDumper::~CsvDumper() { } status::StatusCode CsvDumper::open() { - Mutex::Lock lock(open_mutex_); + core::Mutex::Lock lock(open_mutex_); if (open_flag_) { roc_panic("csv dumper: open() already called"); @@ -52,7 +52,7 @@ status::StatusCode CsvDumper::open() { } void CsvDumper::close() { - Mutex::Lock lock(open_mutex_); + core::Mutex::Lock lock(open_mutex_); stop_flag_ = true; write_sem_.post(); @@ -121,13 +121,14 @@ void CsvDumper::run() { roc_log(LogDebug, "csv dumper: exiting background thread"); } -RateLimiter& CsvDumper::limiter_(char type) { +core::RateLimiter& CsvDumper::limiter_(char type) { roc_panic_if(!isalnum(type)); const size_t idx = (size_t)type; if (!rate_lims_[idx]) { - rate_lims_[idx].reset(new (rate_lims_[idx]) RateLimiter(config_.max_interval)); + rate_lims_[idx].reset(new (rate_lims_[idx]) + core::RateLimiter(config_.max_interval)); } return *rate_lims_[idx]; @@ -139,7 +140,7 @@ bool CsvDumper::open_(const char* path) { file_ = fopen(path, "w"); if (!file_) { roc_log(LogError, "csv dumper: failed to open output file \"%s\": %s", path, - errno_to_str().c_str()); + core::errno_to_str().c_str()); return false; } @@ -150,7 +151,7 @@ void CsvDumper::close_() { if (file_) { if (fclose(file_) != 0) { roc_log(LogError, "csv dumper: failed to close output file: %s", - errno_to_str().c_str()); + core::errno_to_str().c_str()); } file_ = NULL; } @@ -180,12 +181,12 @@ bool CsvDumper::dump_(const CsvEntry& entry) { if (fprintf(file_, "%s\n", line) < 0) { roc_log(LogError, "csv dumper: failed to write output file: %s", - errno_to_str().c_str()); + core::errno_to_str().c_str()); return false; } return true; } -} // namespace core +} // namespace dbgio } // namespace roc diff --git a/src/internal_modules/roc_core/csv_dumper.h b/src/internal_modules/roc_dbgio/csv_dumper.h similarity index 79% rename from src/internal_modules/roc_core/csv_dumper.h rename to src/internal_modules/roc_dbgio/csv_dumper.h index 8b781a5ce..226dcabbb 100644 --- a/src/internal_modules/roc_core/csv_dumper.h +++ b/src/internal_modules/roc_dbgio/csv_dumper.h @@ -6,11 +6,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -//! @file roc_core/csv_dumper.h +//! @file roc_dbgio/csv_dumper.h //! @brief Asynchronous CSV dumper. -#ifndef ROC_CORE_CSV_DUMPER_H_ -#define ROC_CORE_CSV_DUMPER_H_ +#ifndef ROC_DBGIO_CSV_DUMPER_H_ +#define ROC_DBGIO_CSV_DUMPER_H_ #include "roc_core/atomic.h" #include "roc_core/mutex.h" @@ -24,7 +24,7 @@ #include "roc_status/status_code.h" namespace roc { -namespace core { +namespace dbgio { //! Maximum number of fields in CSV entry. static const size_t Csv_MaxFields = 10; @@ -55,22 +55,22 @@ struct CsvConfig { //! Maximum allowed interval between subsequent entries of same type. //! If zero, there is no limit. //! If non-zero, each entry type is rate-limited according to this. - nanoseconds_t max_interval; + core::nanoseconds_t max_interval; CsvConfig() : dump_file(NULL) , max_queued(1000) - , max_interval(Millisecond) { + , max_interval(core::Millisecond) { } }; //! Asynchronous CSV dumper. //! Writes entries to CSV file from background thread. //! Recommended to be used from a single thread. -class CsvDumper : private Thread { +class CsvDumper : private core::Thread { public: //! Initialize. - CsvDumper(const CsvConfig& config, IArena& arena); + CsvDumper(const CsvConfig& config, core::IArena& arena); ~CsvDumper(); //! Open file and start background thread. @@ -92,7 +92,7 @@ class CsvDumper : private Thread { private: virtual void run(); - RateLimiter& limiter_(char type); + core::RateLimiter& limiter_(char type); bool open_(const char* path); void close_(); @@ -100,19 +100,19 @@ class CsvDumper : private Thread { const CsvConfig config_; - Mutex open_mutex_; - Atomic open_flag_; - Atomic stop_flag_; + core::Mutex open_mutex_; + core::Atomic open_flag_; + core::Atomic stop_flag_; FILE* file_; - Mutex write_mutex_; - Semaphore write_sem_; - SpscRingBuffer ringbuf_; + core::Mutex write_mutex_; + core::Semaphore write_sem_; + core::SpscRingBuffer ringbuf_; - Optional rate_lims_[128]; + core::Optional rate_lims_[128]; }; -} // namespace core +} // namespace dbgio } // namespace roc -#endif // ROC_CORE_CSV_DUMPER_H_ +#endif // ROC_DBGIO_CSV_DUMPER_H_ diff --git a/src/internal_modules/roc_core/target_posix/roc_core/temp_file.cpp b/src/internal_modules/roc_dbgio/target_posix/roc_dbgio/temp_file.cpp similarity index 69% rename from src/internal_modules/roc_core/target_posix/roc_core/temp_file.cpp rename to src/internal_modules/roc_dbgio/target_posix/roc_dbgio/temp_file.cpp index 1a16b4aee..8f50e7bbf 100644 --- a/src/internal_modules/roc_core/target_posix/roc_core/temp_file.cpp +++ b/src/internal_modules/roc_dbgio/target_posix/roc_dbgio/temp_file.cpp @@ -6,17 +6,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "roc_dbgio/temp_file.h" +#include "roc_core/errno_to_str.h" +#include "roc_core/log.h" + #include #include #include #include -#include "roc_core/errno_to_str.h" -#include "roc_core/log.h" -#include "roc_core/temp_file.h" - namespace roc { -namespace core { +namespace dbgio { TempFile::TempFile(const char* name) { dir_[0] = '\0'; @@ -31,28 +31,31 @@ TempFile::TempFile(const char* name) { } if (snprintf(dir_, sizeof(dir_), "%s/rocXXXXXX", tempdir) < 0) { - roc_log(LogError, "temp file: snprintf(): %s", errno_to_str().c_str()); + roc_log(LogError, "temp file: snprintf(): %s", core::errno_to_str().c_str()); return; } if (mkdtemp(dir_) == NULL) { - roc_log(LogError, "temp file: mkdtemp(): %s: %s", dir_, errno_to_str().c_str()); + roc_log(LogError, "temp file: mkdtemp(): %s: %s", dir_, + core::errno_to_str().c_str()); return; } if (snprintf(file_, sizeof(file_), "%s/%s", dir_, name) < 0) { - roc_log(LogError, "temp file: snprintf(): %s", errno_to_str().c_str()); + roc_log(LogError, "temp file: snprintf(): %s", core::errno_to_str().c_str()); return; } int fd = open(file_, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0600); if (fd == -1) { - roc_log(LogError, "temp file: open(): %s: %s", file_, errno_to_str().c_str()); + roc_log(LogError, "temp file: open(): %s: %s", file_, + core::errno_to_str().c_str()); return; } if (close(fd) == -1) { - roc_log(LogError, "temp file: close(): %s: %s", file_, errno_to_str().c_str()); + roc_log(LogError, "temp file: close(): %s: %s", file_, + core::errno_to_str().c_str()); } roc_log(LogDebug, "temp file: created %s", file_); @@ -64,13 +67,14 @@ TempFile::~TempFile() { if (unlink(file_) == -1) { roc_log(LogError, "temp file: unlink(): %s: %s", file_, - errno_to_str().c_str()); + core::errno_to_str().c_str()); } } if (*dir_) { if (rmdir(dir_) == -1) { - roc_log(LogError, "temp file: rmdir(): %s: %s", dir_, errno_to_str().c_str()); + roc_log(LogError, "temp file: rmdir(): %s: %s", dir_, + core::errno_to_str().c_str()); } } } @@ -79,5 +83,5 @@ const char* TempFile::path() const { return file_; } -} // namespace core +} // namespace dbgio } // namespace roc diff --git a/src/internal_modules/roc_core/target_posix/roc_core/temp_file.h b/src/internal_modules/roc_dbgio/target_posix/roc_dbgio/temp_file.h similarity index 82% rename from src/internal_modules/roc_core/target_posix/roc_core/temp_file.h rename to src/internal_modules/roc_dbgio/target_posix/roc_dbgio/temp_file.h index 4693cbb91..8bbe13b50 100644 --- a/src/internal_modules/roc_core/target_posix/roc_core/temp_file.h +++ b/src/internal_modules/roc_dbgio/target_posix/roc_dbgio/temp_file.h @@ -6,17 +6,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -//! @file roc_core/target_posix/roc_core/temp_file.h +//! @file roc_dbgio/target_posix/roc_dbgio/temp_file.h //! @brief Filesystem functions. -#ifndef ROC_CORE_TEMP_FILE_H_ -#define ROC_CORE_TEMP_FILE_H_ +#ifndef ROC_DBGIO_TEMP_FILE_H_ +#define ROC_DBGIO_TEMP_FILE_H_ #include "roc_core/noncopyable.h" #include "roc_core/stddefs.h" namespace roc { -namespace core { +namespace dbgio { //! Temporary file. //! @remarks @@ -39,7 +39,7 @@ class TempFile : public core::NonCopyable<> { char file_[1024]; }; -} // namespace core +} // namespace dbgio } // namespace roc -#endif // ROC_CORE_TEMP_FILE_H_ +#endif // ROC_DBGIO_TEMP_FILE_H_ diff --git a/src/internal_modules/roc_pipeline/config.h b/src/internal_modules/roc_pipeline/config.h index b5051f7c6..5358911dc 100644 --- a/src/internal_modules/roc_pipeline/config.h +++ b/src/internal_modules/roc_pipeline/config.h @@ -22,6 +22,7 @@ #include "roc_audio/watchdog.h" #include "roc_core/stddefs.h" #include "roc_core/time.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_fec/block_reader.h" #include "roc_fec/block_writer.h" #include "roc_fec/codec_config.h" @@ -103,7 +104,7 @@ struct SenderSinkConfig { bool enable_profiling; //! Parameters for a logger in csv format with some run-time metrics. - core::CsvConfig dumper; + dbgio::CsvConfig dumper; //! Initialize config. SenderSinkConfig(); @@ -145,7 +146,7 @@ struct ReceiverCommonConfig { bool enable_profiling; //! Parameters for a logger in csv format with some run-time metrics. - core::CsvConfig dumper; + dbgio::CsvConfig dumper; //! Initialize config. ReceiverCommonConfig(); diff --git a/src/internal_modules/roc_pipeline/receiver_session.cpp b/src/internal_modules/roc_pipeline/receiver_session.cpp index 122deabe6..acabd80f6 100644 --- a/src/internal_modules/roc_pipeline/receiver_session.cpp +++ b/src/internal_modules/roc_pipeline/receiver_session.cpp @@ -21,7 +21,7 @@ ReceiverSession::ReceiverSession(const ReceiverSessionConfig& session_config, packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : core::RefCounted(arena) , frame_reader_(NULL) , dumper_(dumper) diff --git a/src/internal_modules/roc_pipeline/receiver_session.h b/src/internal_modules/roc_pipeline/receiver_session.h index 5441b82fd..490c1d3da 100644 --- a/src/internal_modules/roc_pipeline/receiver_session.h +++ b/src/internal_modules/roc_pipeline/receiver_session.h @@ -25,12 +25,12 @@ #include "roc_audio/processor_map.h" #include "roc_audio/resampler_reader.h" #include "roc_audio/watchdog.h" -#include "roc_core/csv_dumper.h" #include "roc_core/iarena.h" #include "roc_core/list_node.h" #include "roc_core/optional.h" #include "roc_core/ref_counted.h" #include "roc_core/scoped_ptr.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_fec/block_reader.h" #include "roc_fec/iblock_decoder.h" #include "roc_packet/delayed_reader.h" @@ -71,7 +71,7 @@ class ReceiverSession : public core::RefCounted latency_monitor_; - core::CsvDumper* dumper_; + dbgio::CsvDumper* dumper_; status::StatusCode init_status_; status::StatusCode fail_status_; diff --git a/src/internal_modules/roc_pipeline/receiver_session_group.cpp b/src/internal_modules/roc_pipeline/receiver_session_group.cpp index f9d93fa40..1f7b7049c 100644 --- a/src/internal_modules/roc_pipeline/receiver_session_group.cpp +++ b/src/internal_modules/roc_pipeline/receiver_session_group.cpp @@ -8,10 +8,8 @@ #include "roc_pipeline/receiver_session_group.h" #include "roc_address/socket_addr_to_str.h" -#include "roc_core/csv_dumper.h" #include "roc_core/log.h" #include "roc_core/panic.h" -#include "roc_rtcp/participant_info.h" #include "roc_status/code_to_str.h" namespace roc { @@ -26,7 +24,7 @@ ReceiverSessionGroup::ReceiverSessionGroup(const ReceiverSourceConfig& source_co packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : source_config_(source_config) , slot_config_(slot_config) , state_tracker_(state_tracker) diff --git a/src/internal_modules/roc_pipeline/receiver_session_group.h b/src/internal_modules/roc_pipeline/receiver_session_group.h index b0479c357..946a5d367 100644 --- a/src/internal_modules/roc_pipeline/receiver_session_group.h +++ b/src/internal_modules/roc_pipeline/receiver_session_group.h @@ -15,10 +15,10 @@ #include "roc_audio/frame_factory.h" #include "roc_audio/mixer.h" #include "roc_audio/processor_map.h" -#include "roc_core/csv_dumper.h" #include "roc_core/iarena.h" #include "roc_core/list.h" #include "roc_core/noncopyable.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/packet_factory.h" #include "roc_pipeline/metrics.h" #include "roc_pipeline/receiver_endpoint.h" @@ -59,7 +59,7 @@ class ReceiverSessionGroup : public core::NonCopyable<>, private rtcp::IParticip packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); ~ReceiverSessionGroup(); @@ -164,7 +164,7 @@ class ReceiverSessionGroup : public core::NonCopyable<>, private rtcp::IParticip sessions_; ReceiverSessionRouter session_router_; - core::CsvDumper* dumper_; + dbgio::CsvDumper* dumper_; status::StatusCode init_status_; }; diff --git a/src/internal_modules/roc_pipeline/receiver_slot.cpp b/src/internal_modules/roc_pipeline/receiver_slot.cpp index abbd8be5b..38a4cf46a 100644 --- a/src/internal_modules/roc_pipeline/receiver_slot.cpp +++ b/src/internal_modules/roc_pipeline/receiver_slot.cpp @@ -7,7 +7,6 @@ */ #include "roc_pipeline/receiver_slot.h" -#include "roc_core/csv_dumper.h" #include "roc_core/log.h" #include "roc_pipeline/endpoint_helpers.h" @@ -23,7 +22,7 @@ ReceiverSlot::ReceiverSlot(const ReceiverSourceConfig& source_config, packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : core::RefCounted(arena) , encoding_map_(encoding_map) , state_tracker_(state_tracker) diff --git a/src/internal_modules/roc_pipeline/receiver_slot.h b/src/internal_modules/roc_pipeline/receiver_slot.h index dbcf10067..5fce96f2c 100644 --- a/src/internal_modules/roc_pipeline/receiver_slot.h +++ b/src/internal_modules/roc_pipeline/receiver_slot.h @@ -17,10 +17,10 @@ #include "roc_audio/frame_factory.h" #include "roc_audio/mixer.h" #include "roc_audio/processor_map.h" -#include "roc_core/csv_dumper.h" #include "roc_core/iarena.h" #include "roc_core/list_node.h" #include "roc_core/ref_counted.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/packet_factory.h" #include "roc_pipeline/metrics.h" #include "roc_pipeline/receiver_endpoint.h" @@ -49,7 +49,7 @@ class ReceiverSlot : public core::RefCountedopen()) != status::StatusOK) { return; } diff --git a/src/internal_modules/roc_pipeline/receiver_source.h b/src/internal_modules/roc_pipeline/receiver_source.h index 00fa0a3ae..7b0906262 100644 --- a/src/internal_modules/roc_pipeline/receiver_source.h +++ b/src/internal_modules/roc_pipeline/receiver_source.h @@ -18,10 +18,10 @@ #include "roc_audio/pcm_mapper_reader.h" #include "roc_audio/processor_map.h" #include "roc_audio/profiling_reader.h" -#include "roc_core/csv_dumper.h" #include "roc_core/iarena.h" #include "roc_core/optional.h" #include "roc_core/stddefs.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/packet_factory.h" #include "roc_pipeline/config.h" #include "roc_pipeline/receiver_endpoint.h" @@ -135,7 +135,7 @@ class ReceiverSource : public sndio::ISource, public core::NonCopyable<> { StateTracker state_tracker_; - core::Optional dumper_; + core::Optional dumper_; core::Optional mixer_; core::Optional profiler_; diff --git a/src/internal_modules/roc_pipeline/sender_session.cpp b/src/internal_modules/roc_pipeline/sender_session.cpp index 2b86688ee..d66be0495 100644 --- a/src/internal_modules/roc_pipeline/sender_session.cpp +++ b/src/internal_modules/roc_pipeline/sender_session.cpp @@ -20,7 +20,7 @@ SenderSession::SenderSession(const SenderSinkConfig& sink_config, packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : arena_(arena) , sink_config_(sink_config) , processor_map_(processor_map) diff --git a/src/internal_modules/roc_pipeline/sender_session.h b/src/internal_modules/roc_pipeline/sender_session.h index 5b9be7efe..ba736ff5e 100644 --- a/src/internal_modules/roc_pipeline/sender_session.h +++ b/src/internal_modules/roc_pipeline/sender_session.h @@ -25,6 +25,7 @@ #include "roc_core/noncopyable.h" #include "roc_core/optional.h" #include "roc_core/scoped_ptr.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_fec/block_writer.h" #include "roc_fec/iblock_encoder.h" #include "roc_packet/interleaver.h" @@ -61,7 +62,7 @@ class SenderSession : public core::NonCopyable<>, packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); //! Check if the pipeline was successfully constructed. status::StatusCode init_status() const; @@ -170,7 +171,7 @@ class SenderSession : public core::NonCopyable<>, audio::IFrameWriter* frame_writer_; - core::CsvDumper* dumper_; + dbgio::CsvDumper* dumper_; status::StatusCode init_status_; status::StatusCode fail_status_; diff --git a/src/internal_modules/roc_pipeline/sender_sink.cpp b/src/internal_modules/roc_pipeline/sender_sink.cpp index ea80f6bf2..de9b1aede 100644 --- a/src/internal_modules/roc_pipeline/sender_sink.cpp +++ b/src/internal_modules/roc_pipeline/sender_sink.cpp @@ -33,7 +33,7 @@ SenderSink::SenderSink(const SenderSinkConfig& sink_config, sink_config_.deduce_defaults(processor_map); if (sink_config_.dumper.dump_file) { - dumper_.reset(new (dumper_) core::CsvDumper(sink_config_.dumper, arena)); + dumper_.reset(new (dumper_) dbgio::CsvDumper(sink_config_.dumper, arena)); if ((init_status_ = dumper_->open()) != status::StatusOK) { return; } diff --git a/src/internal_modules/roc_pipeline/sender_sink.h b/src/internal_modules/roc_pipeline/sender_sink.h index 3a0d93f48..0208c4688 100644 --- a/src/internal_modules/roc_pipeline/sender_sink.h +++ b/src/internal_modules/roc_pipeline/sender_sink.h @@ -21,6 +21,7 @@ #include "roc_core/ipool.h" #include "roc_core/noncopyable.h" #include "roc_core/optional.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/packet_factory.h" #include "roc_pipeline/config.h" #include "roc_pipeline/sender_endpoint.h" @@ -123,7 +124,7 @@ class SenderSink : public sndio::ISink, public core::NonCopyable<> { StateTracker state_tracker_; - core::Optional dumper_; + core::Optional dumper_; core::Optional fanout_; core::Optional profiler_; diff --git a/src/internal_modules/roc_pipeline/sender_slot.cpp b/src/internal_modules/roc_pipeline/sender_slot.cpp index 21ce20c15..b51cea8b1 100644 --- a/src/internal_modules/roc_pipeline/sender_slot.cpp +++ b/src/internal_modules/roc_pipeline/sender_slot.cpp @@ -23,7 +23,7 @@ SenderSlot::SenderSlot(const SenderSinkConfig& sink_config, packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : core::RefCounted(arena) , sink_config_(sink_config) , fanout_(fanout) diff --git a/src/internal_modules/roc_pipeline/sender_slot.h b/src/internal_modules/roc_pipeline/sender_slot.h index db811b5f4..608c65e2e 100644 --- a/src/internal_modules/roc_pipeline/sender_slot.h +++ b/src/internal_modules/roc_pipeline/sender_slot.h @@ -21,6 +21,7 @@ #include "roc_core/noncopyable.h" #include "roc_core/optional.h" #include "roc_core/ref_counted.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/packet_factory.h" #include "roc_pipeline/config.h" #include "roc_pipeline/metrics.h" @@ -49,7 +50,7 @@ class SenderSlot : public core::RefCounted, packet::PacketFactory& packet_factory, audio::FrameFactory& frame_factory, core::IArena& arena, - core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); ~SenderSlot(); diff --git a/src/internal_modules/roc_rtp/link_meter.cpp b/src/internal_modules/roc_rtp/link_meter.cpp index d35011de3..c5d198946 100644 --- a/src/internal_modules/roc_rtp/link_meter.cpp +++ b/src/internal_modules/roc_rtp/link_meter.cpp @@ -17,7 +17,7 @@ LinkMeter::LinkMeter(packet::IWriter& writer, const audio::LatencyConfig& latency_config, const EncodingMap& encoding_map, core::IArena& arena, - core::CsvDumper* dumper) + dbgio::CsvDumper* dumper) : encoding_map_(encoding_map) , encoding_(NULL) , writer_(writer) @@ -164,7 +164,7 @@ size_t LinkMeter::running_window_len() const { void LinkMeter::dump_(const packet::Packet& packet, const long d_enq_ns, const long d_s_ns) { - core::CsvEntry e; + dbgio::CsvEntry e; e.type = 'm'; e.n_fields = 5; e.fields[0] = packet.udp()->queue_timestamp; diff --git a/src/internal_modules/roc_rtp/link_meter.h b/src/internal_modules/roc_rtp/link_meter.h index 4a9eb5ba7..08620c0c3 100644 --- a/src/internal_modules/roc_rtp/link_meter.h +++ b/src/internal_modules/roc_rtp/link_meter.h @@ -14,11 +14,11 @@ #include "roc_audio/latency_tuner.h" #include "roc_audio/sample_spec.h" -#include "roc_core/csv_dumper.h" #include "roc_core/iarena.h" #include "roc_core/mov_stats.h" #include "roc_core/noncopyable.h" #include "roc_core/time.h" +#include "roc_dbgio/csv_dumper.h" #include "roc_packet/ilink_meter.h" #include "roc_packet/iwriter.h" #include "roc_rtcp/reports.h" @@ -44,7 +44,7 @@ class LinkMeter : public packet::ILinkMeter, const audio::LatencyConfig& latency_config, const EncodingMap& encoding_map, core::IArena& arena, - core::CsvDumper* dumper); + dbgio::CsvDumper* dumper); //! Check if the object was successfully constructed. status::StatusCode init_status() const; @@ -107,7 +107,7 @@ class LinkMeter : public packet::ILinkMeter, packet::stream_timestamp_t prev_stream_timestamp_; core::MovStats packet_jitter_stats_; - core::CsvDumper* dumper_; + dbgio::CsvDumper* dumper_; }; } // namespace rtp diff --git a/src/tests/roc_sndio/test_backend_sink.cpp b/src/tests/roc_sndio/test_backend_sink.cpp index fea4baa9d..be1062d4a 100644 --- a/src/tests/roc_sndio/test_backend_sink.cpp +++ b/src/tests/roc_sndio/test_backend_sink.cpp @@ -12,7 +12,7 @@ #include "roc_core/heap_arena.h" #include "roc_core/scoped_ptr.h" -#include "roc_core/temp_file.h" +#include "roc_dbgio/temp_file.h" #include "roc_sndio/backend_map.h" #include "roc_sndio/pump.h" @@ -54,7 +54,7 @@ TEST(backend_sink, open) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); core::ScopedPtr backend_sink; test::expect_open_sink(status::StatusOK, backend, frame_factory, arena, @@ -95,7 +95,7 @@ TEST(backend_sink, open_bad_config) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); Config bad_config = sink_config; bad_config.sample_spec.set_pcm_format(audio::PcmFormat_SInt18_3_Be); @@ -116,7 +116,7 @@ TEST(backend_sink, open_default_config) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); Config default_config = sink_config; default_config.sample_spec.clear(); diff --git a/src/tests/roc_sndio/test_backend_source.cpp b/src/tests/roc_sndio/test_backend_source.cpp index 4e7a8561c..5d6f3cd3a 100644 --- a/src/tests/roc_sndio/test_backend_source.cpp +++ b/src/tests/roc_sndio/test_backend_source.cpp @@ -14,7 +14,7 @@ #include "roc_core/heap_arena.h" #include "roc_core/scoped_ptr.h" #include "roc_core/slab_pool.h" -#include "roc_core/temp_file.h" +#include "roc_dbgio/temp_file.h" #include "roc_sndio/backend_map.h" #include "roc_sndio/pump.h" @@ -98,7 +98,7 @@ TEST(backend_source, open) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); write_wav(backend, sink_config, file.path(), MaxBufSize * 10); core::ScopedPtr backend_source; @@ -140,7 +140,7 @@ TEST(backend_source, open_bad_config) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); write_wav(backend, sink_config, file.path(), MaxBufSize * 10); Config bad_config = source_config; @@ -162,7 +162,7 @@ TEST(backend_source, rewind) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); write_wav(backend, sink_config, file.path(), MaxBufSize * 10); core::ScopedPtr backend_source; @@ -201,7 +201,7 @@ TEST(backend_source, rewind_after_eof) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); write_wav(backend, sink_config, file.path(), FrameSize * 2); core::ScopedPtr backend_source; diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index 280cc12ef..722d7ac1b 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -15,7 +15,7 @@ #include "roc_core/heap_arena.h" #include "roc_core/scoped_ptr.h" #include "roc_core/stddefs.h" -#include "roc_core/temp_file.h" +#include "roc_dbgio/temp_file.h" #include "roc_sndio/backend_map.h" #include "roc_sndio/config.h" #include "roc_sndio/pump.h" @@ -71,7 +71,7 @@ TEST(pump, write_read) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); test::MockSource mock_source(frame_factory, sink_config.sample_spec); mock_source.add(NumSamples); @@ -120,7 +120,7 @@ TEST(pump, write_overwrite_read) { continue; } - core::TempFile file("test.wav"); + dbgio::TempFile file("test.wav"); test::MockSource mock_source(frame_factory, sink_config.sample_spec); mock_source.add(NumSamples);