Exercise call clocks through Opus and jitter recovery

This commit is contained in:
evgeny committed 2026-10-14 19:36:51 +02:00
1 parent e975d24a73
commit a978bb7b06
2 files changed
+77 -1

No files matched your search

+24 -1
View File
@@ -83,8 +83,31 @@ static void test_long_run() {
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS timeline: 200s actual SoundTouch, tempo jumps, bounded rings, monotonic clock");
}
static void test_failure_and_recovery() {
CallTimeline map;
auto start = [&] {
map.reset(5); map.feed(1000000, 960, 1);
map.source({SourceKind::Copy, SourceError::None, 0, 0, 0, 960}); map.read(960);
map.progress(5, 480, 10000, 10000, true);
CHECK(map.clock(10000).valid);
};
start(); map.progress(5, 240, 20000, 20000, true);
CHECK(!map.clock(20000).valid);
map.progress(5, 960, 30000, 30000, true); CHECK(!map.clock(30000).valid);
start(); map.progress(5, 961, 20000, 20000, true); CHECK(!map.clock(20000).valid);
start(); map.read(1); CHECK(!map.clock(10000).valid);
start(); // Переполнение карты без device-progress не портит звук и не даёт ложный PTS.
for (unsigned i = 1; i < 2200; i++) {
map.feed(1000000 + i * 20000ll, 960, 1);
map.source({SourceKind::Copy, SourceError::None, i * 960, i * 960, 0, 960}); map.read(960);
}
CHECK(!map.clock(10000).valid);
start();
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS timeline: regressing/impossible device head, overread, bounded overflow, reset recovery");
}
int main() {
debug_config_init(); debug_set_level(DEBUG_LEVEL_INFO);
test_boundaries(); test_mix(); test_long_run();
test_boundaries(); test_mix(); test_long_run(); test_failure_and_recovery();
return 0;
}