Skip to content

Commit

Permalink
Minor fixes in resamplers
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed Oct 10, 2023
1 parent 315b590 commit f1550e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_audio/test_resampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit f1550e8

Please sign in to comment.