Skip to content

Commit

Permalink
Fix pipeline test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
baranovmv committed May 19, 2024
1 parent 97af7c7 commit c5ce267
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
34 changes: 18 additions & 16 deletions src/internal_modules/roc_audio/latency_tuner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ LatencyTuner::LatencyTuner(const LatencyConfig& config,
enable_tuning_
? config.start_latency
: config.target_latency);
if (target_latency_ <= 0) {
if (config.tuner_profile != audio::LatencyTunerProfile_Intact
&& target_latency_ <= 0) {
roc_log(LogError,
"latency tuner: invalid config: target latency is invalid:"
" start_latency=%ld(%.3fms), target_latency=%ld(%.3fms)",
Expand All @@ -247,21 +248,6 @@ LatencyTuner::LatencyTuner(const LatencyConfig& config,
return;
}

if (target_latency_ < min_latency_ || target_latency_ > max_latency_) {
roc_log(
LogError,
"latency tuner: invalid config: target_latency is out of bounds:"
" target_latency=%ld(%.3fms)"
" min_latency=%ld(%.3fms) max_latency=%ld(%.3fms)",
(long)sample_spec_.ns_2_stream_timestamp_delta(target_latency_),
(double)config.target_latency / core::Millisecond,
(long)sample_spec_.ns_2_stream_timestamp_delta(config.min_latency),
(double)config.min_latency / core::Millisecond,
(long)sample_spec_.ns_2_stream_timestamp_delta(config.max_latency),
(double)config.max_latency / core::Millisecond);
return;
}

if (enable_bounds_) {
min_latency_ = sample_spec_.ns_2_stream_timestamp_delta(config.min_latency);
max_latency_ = sample_spec_.ns_2_stream_timestamp_delta(config.max_latency);
Expand All @@ -288,6 +274,22 @@ LatencyTuner::LatencyTuner(const LatencyConfig& config,
(long)sample_spec_.ns_2_stream_timestamp_delta(config.max_latency),
(double)config.max_latency / core::Millisecond);
}


if (target_latency_ < min_latency_ || target_latency_ > max_latency_) {
roc_log(
LogError,
"latency tuner: invalid config: target_latency is out of bounds:"
" target_latency=%ld(%.3fms)"
" min_latency=%ld(%.3fms) max_latency=%ld(%.3fms)",
(long)sample_spec_.ns_2_stream_timestamp_delta(target_latency_),
(double)config.target_latency / core::Millisecond,
(long)sample_spec_.ns_2_stream_timestamp_delta(config.min_latency),
(double)config.min_latency / core::Millisecond,
(long)sample_spec_.ns_2_stream_timestamp_delta(config.max_latency),
(double)config.max_latency / core::Millisecond);
return;
}
}

if (enable_tuning_) {
Expand Down
4 changes: 2 additions & 2 deletions src/tests/roc_pipeline/test_receiver_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ TEST_GROUP(receiver_source) {

config.session_defaults.latency.tuner_backend = audio::LatencyTunerBackend_Niq;
config.session_defaults.latency.tuner_profile = audio::LatencyTunerProfile_Intact;
config.session_defaults.latency.target_latency = 0;
config.session_defaults.latency.start_latency =
config.session_defaults.latency.start_latency = 0;
config.session_defaults.latency.target_latency =
target_latency * core::Second / (int)output_sample_spec.sample_rate();
config.session_defaults.latency.min_latency =
min_latency * core::Second / (int)output_sample_spec.sample_rate();
Expand Down

0 comments on commit c5ce267

Please sign in to comment.