From f1550e83ce53cf12707e511ae6f1b798511cf001 Mon Sep 17 00:00:00 2001 From: Victor Gaydov Date: Tue, 10 Oct 2023 22:24:04 +0400 Subject: [PATCH] Minor fixes in resamplers --- .../target_speexdsp/roc_audio/speex_resampler.cpp | 14 +++++++------- src/tests/roc_audio/test_resampler.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/internal_modules/roc_audio/target_speexdsp/roc_audio/speex_resampler.cpp b/src/internal_modules/roc_audio/target_speexdsp/roc_audio/speex_resampler.cpp index 27ae9086a..3bc564114 100644 --- a/src/internal_modules/roc_audio/target_speexdsp/roc_audio/speex_resampler.cpp +++ b/src/internal_modules/roc_audio/target_speexdsp/roc_audio/speex_resampler.cpp @@ -58,6 +58,8 @@ SpeexResampler::SpeexResampler(core::IArena& arena, , in_frame_pos_(in_frame_size_) , num_ch_((spx_uint32_t)in_spec.num_channels()) , startup_countdown_(0) + , initial_input_latency_(0) + , current_input_latency_diff_(0) , rate_limiter_(LogReportInterval) , valid_(false) { if (!in_spec.is_valid() || !out_spec.is_valid()) { @@ -103,7 +105,6 @@ SpeexResampler::SpeexResampler(core::IArena& arena, startup_countdown_ = (size_t)speex_resampler_get_output_latency(speex_state_); initial_input_latency_ = (size_t)speex_resampler_get_input_latency(speex_state_); - current_input_latency_diff_ = 0; valid_ = true; } @@ -281,12 +282,11 @@ void SpeexResampler::report_stats_() { const int in_latency = speex_resampler_get_input_latency(speex_state_); - roc_log( - LogDebug, - "speex resampler:" - " ratio_num=%u ratio_den=%u in_rate=%u out_rate=%u in_latency=%d latency_diff=%d", - (unsigned int)ratio_num, (unsigned int)ratio_den, (unsigned int)in_rate, - (unsigned int)out_rate, (int)in_latency, (int)current_input_latency_diff_); + roc_log(LogDebug, + "speex resampler:" + " ratio=%u/%u rates=%u/%u latency=%d latency_diff=%d", + (unsigned int)ratio_num, (unsigned int)ratio_den, (unsigned int)in_rate, + (unsigned int)out_rate, (int)in_latency, (int)current_input_latency_diff_); } } // namespace audio diff --git a/src/tests/roc_audio/test_resampler.cpp b/src/tests/roc_audio/test_resampler.cpp index 393147cd1..1c5bab1cb 100644 --- a/src/tests/roc_audio/test_resampler.cpp +++ b/src/tests/roc_audio/test_resampler.cpp @@ -409,7 +409,7 @@ TEST(resampler, invalid_scalings) { // Set scaling, continously resample, and check that actual // scaling eventually becomes close to configured scaling. TEST(resampler, scaling_trend) { - enum { ChMask = 0x1, WaitSamples = 5000 }; + enum { ChMask = 0x1, WaitSamples = 3000 }; for (size_t n_back = 0; n_back < ResamplerMap::instance().num_backends(); n_back++) { for (size_t n_irate = 0; n_irate < ROC_ARRAY_SIZE(supported_rates); n_irate++) {