Browse Source

Test phase alignment after device silence and keep diagnostics current

master
evgeny 4 days ago
parent
commit
26c91e6295
  1. 1
      src/call/call_jitter.cpp
  2. 18
      tools/chatgui/tests/test_call_delay.cpp

1
src/call/call_jitter.cpp

@ -204,6 +204,7 @@ void call_jitter_silence(struct call_jitter* j, unsigned samples) {
if (!j) return;
std::lock_guard<std::mutex> lock(j->mtx);
j->delay.silence(samples);
j->diagnostics.phase_samples = j->delay.stats().phase;
j->timeline.silence(samples);
}

18
tools/chatgui/tests/test_call_delay.cpp

@ -127,9 +127,25 @@ static void tail_and_reset() {
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS delay final tail preserved without flush, reset clears phase/history");
}
static void phase_after_silence() {
for (unsigned block : {240, 480, 777, 960}) for (unsigned silence : {1, 239, 480, 777, 959}) {
Trial t;
t.timeline.silence(silence); t.delay.silence(silence); t.device += silence;
t.available = 5 * 960; // Прямой режим без SoundTouch; стартовая фаза произвольна.
uint64_t next = 960;
for (uint64_t time = 0; time < 20 * 48000; time += block) {
while (next <= time) { t.available += 960; next += 960; }
t.pull(block);
}
auto s = t.delay.stats();
CHECK(!s.entered && !s.exited && s.cuts > 0 && !s.phase && s.tempo == 1);
}
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS delay phase: 20 arbitrary initial silence/block combinations converge using cuts only");
}
int main() {
debug_config_init(); debug_set_level(DEBUG_LEVEL_INFO);
for (unsigned block : {240, 480, 777, 960}) for (unsigned phase : {0, 239, 479, 719, 959}) steady(block, phase);
switching(); tail_and_reset();
switching(); tail_and_reset(); phase_after_silence();
return 0;
}

Loading…
Cancel
Save